ComponentsSelection & pickers
Time field
A time typed one part at a time, with arrow keys to step each part, on a 12- or 24-hour clock.
"use client";
import { Time } from "@internationalized/date";
import { TimeField } from "@/components/miyuki-ui/time-field";
export default function TimeFieldDemo() {
return (
<div className="grid w-full max-w-sm grid-cols-2 gap-x-4 gap-y-6">
<TimeField label="Opens" hourCycle={12} defaultValue={new Time(9, 0)} />
<TimeField label="Closes" hourCycle={12} defaultValue={new Time(18, 0)} />
<TimeField
label="First lift"
hourCycle={24}
shouldForceLeadingZeros
defaultValue={new Time(8, 30)}
description="24-hour clock"
/>
</div>
);
}Install
npx shadcn@latest add @miyuki-ui/time-fieldThis needs the @miyuki-ui registry in your components.json. See Using the shadcn CLI.
In a Next.js app
Time field reads today's date while it renders. With Cache Components turned on, Next.js stops the build unless that happens inside React's Suspense, so wrap it in one. Give the fallback the size of the control so nothing moves when it appears. Our blocks and templates that use it already do this.
import { Suspense } from "react";
<Suspense fallback={<div className="h-16" />}>
<TimeField label="Time" />
</Suspense>Props
TimeField
Prop
Type