Clock Picker
The Material 3 time picker, rebuilt to be used rather than looked at.
Walkthrough
1. Basic
Drag or tap the dial, or type into the boxes — they are the same value. Let go of an hour and the dial moves to the minutes. Stored "14:30", shown 12-hour.
value: 07:30
<script lang="ts"> import { Card, ClockPicker, Text } from 'omaris'; let time = $state<string | null>('07:30');</script><div class="flex flex-col items-start gap-2"> <Card class="max-w-full p-0"> <ClockPicker bind:value={time} /> </Card> <Text variant="body-sm" tone="muted">value: {time ?? 'null'}</Text></div> 2. Range
mode="range": Start and End tabs, the length, a bar across the day and durations chips. Moving the start carries the end with it; an end before the start runs overnight.
value: {"start":"22:00","end":"06:00"}
<script lang="ts"> import { Card, ClockPicker, Text, type TimeRange } from 'omaris'; let shift = $state<TimeRange | null>({ start: '22:00', end: '06:00' });</script><div class="flex flex-col items-start gap-2"> <Card class="max-w-full p-0"> <ClockPicker mode="range" bind:value={shift} minuteStep={15} durations={[240, 480, 720]} /> </Card> <Text variant="body-sm" tone="muted">value: {JSON.stringify(shift)}</Text></div> 3. Bounded
minuteStep, min, max and isTimeDisabled grey out what cannot be booked — here every 15 minutes, 9 AM to 6 PM, closed for lunch — and the handle will not stop there. The keyboard view hides the dial.
<script lang="ts"> import { Card, ClockPicker } from 'omaris'; let slot = $state<string | null>('10:30'); const lunch = (time: string) => time >= '12:00' && time < '13:00';</script><div class="flex flex-wrap items-start gap-4"> <Card class="max-w-full p-0"> <ClockPicker bind:value={slot} minuteStep={15} min="09:00" max="18:00" isTimeDisabled={lunch} shape="cookie-12" /> </Card> <Card class="max-w-full p-0"> <ClockPicker bind:value={slot} view="input" minuteStep={15} min="09:00" max="18:00" /> </Card></div> 4. Overridden
--dial-size sizes the dial, shape swaps its face, and classes reaches the boxes, the handle and the numbers under it. In a narrow column the dial and the boxes shrink to fit.
<script lang="ts"> import { ClockPicker } from 'omaris'; let alarm = $state<string | null>('06:45');</script><div class="w-64 max-w-full"> <ClockPicker bind:value={alarm} shape="soft-burst" showViewToggle={false} class="p-0 [--dial-size:20rem]" classes={{ input: 'rounded-full', hand: 'fill-tertiary stroke-tertiary', selected: 'fill-tertiary-foreground' }} /></div>