Forms

Time picker.

Choose a local time with clear intervals, limits and familiar keyboard controls.

LIVE PREVIEWTry it. It works.

Install the source

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/time-picker.json

Registry setup · Examples · API and behavior · Open the playground

COMPLETE EXAMPLES

Use it in context.

Each example includes its imports, data and state. The preview runs that same source. Include the stylesheet once in your application.

A wall-clock preference

The selected value is HH:mm; no date, time-zone conversion or availability service is implied.

Loads this example when you need it.

Keyboard

  • Arrow keys navigate the menu.
  • Enter commits; Escape dismisses.

States covered

  • Selected time
  • Disabled interval

Install this complete example and its component dependencies.

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/example-basic-time-picker.json
Complete source
React / TypeScript
/*!
MIT License

Copyright (c) 2026 Jaison

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
'use client';
import {useState} from 'react';
import {TimePicker,UIProvider} from '@bld8/ui';
import '@bld8/ui/styles.css';
export default function TimeExample(){const [time,setTime]=useState<string|null>('09:30');return <UIProvider><TimePicker label="Example preferred start" name="preferredStart" value={time} onValueChange={setTime} minTime="09:00" maxTime="17:00" interval={30} disabledTimes={['12:00']} locale="en-AU" hourCycle="h23"/><p>Canonical value: {time??'none'}</p></UIProvider>;}

Typed times with native form ownership

Type strict HH:mm text, choose a slot and keep invalid drafts visible. External forms, prevented reset, read-only values and disabled exclusion use the same contract.

Keyboard

  • Enter or leaving the control commits a valid time. Escape restores the previous committed time.
  • Alt+ArrowDown opens slots. Arrow keys, Home and End move; Enter chooses.
  • Native submit focuses invalid text. Reset restores uncontrolled defaults unless cancelled.

States covered

  • Editable HH:mm
  • External native form
  • Required and unavailable slots
  • Controlled and uncontrolled
  • Prevented reset
  • Read only and disabled

Install this complete example and its component dependencies.

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/example-time-entry-form-lifecycle.json
Complete source
React / TypeScript
/*!
MIT License

Copyright (c) 2026 Jaison

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
'use client';
import '@bld8/ui/styles.css';
import {useId,useState} from 'react';
import {Button,Checkbox,TimePicker,UIProvider} from '@bld8/ui';
export default function TimeEntryFormExample(){const id=useId(),[prevent,setPrevent]=useState(false),[changes,setChanges]=useState(0),[owned,setOwned]=useState<string|null>('10:00'),[status,setStatus]=useState('No time submitted.');
  return <UIProvider><div style={{display:'grid',gap:20,maxWidth:600}}>
    <TimePicker label="Session time" name="session" form={id} editable defaultValue="09:30" required minTime="09:00" maxTime="17:00" interval={15} hourCycle="h23" disabledTimes={['12:00']} onValueChange={()=>setChanges(count=>count+1)}/>
    <TimePicker label="Host-owned time" name="owned" form={id} editable value={owned} onValueChange={setOwned} minTime="09:00" maxTime="17:00"/>
    <TimePicker label="Locked time" name="locked" form={id} editable defaultValue="11:00" readOnly/>
    <TimePicker label="Unavailable time" name="disabled" form={id} editable defaultValue="11:00" disabled/>
    <Checkbox label="Prevent time reset" checked={prevent} onCheckedChange={setPrevent}/>
    <form id={id} aria-label="Time form" onReset={event=>{if(prevent){event.preventDefault();setStatus('Time reset prevented.');}else setStatus('Time defaults restored.');}} onSubmit={event=>{event.preventDefault();const data=new FormData(event.currentTarget);setStatus('Time: '+data.get('session')+' | Owned: '+data.get('owned')+' | Locked: '+data.get('locked')+' | Disabled: '+data.has('disabled'));}}>
      <div style={{display:'flex',gap:12,flexWrap:'wrap'}}><Button type="submit">Read time values</Button><Button type="reset" variant="secondary">Reset times</Button><Button variant="ghost" onClick={()=>setOwned(null)}>Clear host time</Button></div>
    </form><p role="status">{status}</p><p data-time-changes>{'Changes: '+changes}</p>
  </div></UIProvider>;
}

Apply or discard a time draft

Prepare a typed or selected time without replacing the submitted value. Apply commits once; Cancel, Escape or outside dismissal restores the original.

Keyboard

  • Edit a time, then use Apply or Enter to confirm. Invalid or unavailable times stay in the field.
  • Open slots with Alt+ArrowDown. Tab reaches Cancel and Apply. Escape discards the draft.

States covered

  • Explicit commit
  • Controlled null
  • Canonical native entry
  • Invalid draft retention
  • Apply and Cancel

Install this complete example and its component dependencies.

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/example-time-entry-confirmation.json
Complete source
React / TypeScript
/*!
MIT License

Copyright (c) 2026 Jaison

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
'use client';
import '@bld8/ui/styles.css';
import {useState} from 'react';
import {Button,TimePicker,UIProvider} from '@bld8/ui';
export default function TimeConfirmationExample(){const [time,setTime]=useState<string|null>('09:30'),[changes,setChanges]=useState(0),[result,setResult]=useState('No confirmed time submitted.');return <UIProvider><form aria-label="Confirmed time form" style={{display:'grid',gap:16,maxWidth:500}} onSubmit={event=>{event.preventDefault();setResult('Confirmed: '+new FormData(event.currentTarget).get('confirmed'));}}>
  <TimePicker label="Confirmed start" name="confirmed" value={time} onValueChange={next=>{setTime(next);setChanges(count=>count+1);}} editable commitMode="explicit" minTime="09:00" maxTime="11:00" interval={15} hourCycle="h23"/>
  <Button type="submit">Read confirmed time</Button><p data-confirmed-time>{'Committed: '+(time??'empty')+' | Changes: '+changes}</p><p role="status">{result}</p>
</form></UIProvider>;}

An Arabic form with stable submitted values

Localize labels, built-in feedback and reading direction while keeping ASCII time values and stable channel IDs. Translation does not rewrite the form model.

Keyboard

  • Submit without a title, then follow its linked error back to the field.
  • Type HH:mm in the time field. Enter applies; Arabic Cancel restores the prior value.
  • Tab and Space operate the same native channel choices under RTL.

States covered

  • Arabic messages
  • Explicit RTL
  • Linked form errors
  • Native stable values
  • Scoped reduced motion

Install this complete example and its component dependencies.

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/example-localized-arabic-form.json
Complete source
React / TypeScript
/*!
MIT License

Copyright (c) 2026 Jaison

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
'use client';
import '@bld8/ui/styles.css';
import {useState} from 'react';
import {Button,CheckboxGroup,Field,FormErrorSummary,Input,TimePicker,UIProvider} from '@bld8/ui';
export default function LocalizedFormExample(){const [errors,setErrors]=useState<Record<string,string>>({}),[status,setStatus]=useState('لم يتم إعداد الطلب.');return <UIProvider theme="light" locale="ar" direction="rtl" motion="reduced"><form noValidate aria-label="طلب مراجعة" style={{display:'grid',gap:20,maxWidth:600,padding:24,background:'var(--bui-surface)'}} onSubmit={event=>{event.preventDefault();const data=new FormData(event.currentTarget);if(!String(data.get('title')??'').trim()){setErrors({title:'أدخل عنوان الطلب.'});return;}const time=event.currentTarget.querySelector<HTMLInputElement>('[data-time-field] input:not([type=hidden])');if(time&&!time.checkValidity()){time.reportValidity();return;}setErrors({});setStatus('channel='+data.getAll('channels').join(',')+' | time='+data.get('start'));}}>
  <FormErrorSummary errors={errors} fieldLabels={{title:'عنوان الطلب'}}/>
  <Field label="عنوان الطلب" error={errors.title}><Input name="title" onChange={()=>setErrors({})}/></Field>
  <CheckboxGroup label="قنوات الإشعار" name="channels" defaultValue={['email']} options={[{value:'email',label:'البريد الإلكتروني'},{value:'in-app',label:'داخل التطبيق'}]}/>
  <div data-time-field><TimePicker label="وقت البدء" name="start" editable commitMode="explicit" defaultValue="09:30" minTime="09:00" maxTime="11:00" hourCycle="h23"/></div>
  <Button type="submit">إعداد الطلب</Button><p role="status">{status}</p>
</form></UIProvider>;}

Quick reference

React / TypeScript
<TimePicker label="Preferred start" value={time} onValueChange={setTime}
  minTime="09:00" maxTime="17:00" interval={15}
  locale="en-AU" hourCycle="h23" />

In the workspace or ZIP starter, import components from @bld8/ui and include @bld8/ui/styles.css once. Registry installations use your local bld8/ source path. Wrap overlays in UIProvider.

API & behaviour

Values are canonical HH:mm strings or null. Base UI Select provides keyboard navigation, typeahead, focus and native form submission. Labels use Intl.DateTimeFormat with an optional h12/h23 hourCycle; formatting does not change the stored value. Supported intervals are 5, 10, 15, 20, 30 or 60 minutes, anchored to midnight. Limits are inclusive and within one day; overnight ranges are not included. disabledTimes disables exact slots. Opt into editable strict HH:mm entry and commitMode=explicit for Apply/Cancel. Invalid drafts remain visible; external native form, prevented reset, controlled null, readOnly and disabled behavior preserve canonical values. The pure time-options module supports server validation. This is a wall-clock preference without a date, timezone conversion, DST resolution or availability service.

TimePicker

TimePicker public properties
PropTypeDefault
labelRequiredstring—
clearableboolean | undefinedtrue
commitMode"immediate" | "explicit" | undefined

Explicit commits only Apply. Dismissal and Cancel restore the committed value.

'immediate'
defaultValuestring | null | undefinednull
density"compact" | "comfortable" | undefined'comfortable'
disabledboolean | undefinedfalse
disabledTimesreadonly string[] | undefined—
editableboolean | undefined

Opt-in strict HH:mm entry. Slot-only presentation remains the default.

false
errorstring | undefined—
formstring | undefined—
hintstring | undefined—
hourCycle"h12" | "h23" | undefined—
inputRefRef<HTMLButtonElement> | undefined—
interval5 | 10 | 15 | 30 | 60 | 20 | undefined15
labelVisibility"hidden" | "visible" | undefined'visible'
localestring | undefined—
maxTimestring | undefined—
minTimestring | undefined—
namestring | undefined—
onBlurFocusEventHandler<HTMLButtonElement> | undefined—
onInputBlurFocusEventHandler<HTMLInputElement> | undefined—
onInputKeyDownKeyboardEventHandler<HTMLInputElement> | undefined—
onValueChange((value: string | null) => void) | undefined—
placeholderstring | undefined—
readOnlyboolean | undefinedfalse
requiredboolean | undefinedfalse
textInputRefRef<HTMLInputElement> | undefined—
valuestring | null | undefined—

TimeOptions

TimeOptions public properties
PropTypeDefault
disabledTimesreadonly string[] | undefined—
hourCycle"h12" | "h23" | undefined—
interval5 | 10 | 15 | 30 | 60 | 20 | undefined—
localestring | undefined—
maxTimestring | undefined—
minTimestring | undefined—

TimePickerProps

TimePickerProps public properties
PropTypeDefault
labelRequiredstring—
clearableboolean | undefined—
commitMode"immediate" | "explicit" | undefined

Explicit commits only Apply. Dismissal and Cancel restore the committed value.

—
defaultValuestring | null | undefined—
density"compact" | "comfortable" | undefined—
disabledboolean | undefined—
disabledTimesreadonly string[] | undefined—
editableboolean | undefined

Opt-in strict HH:mm entry. Slot-only presentation remains the default.

—
errorstring | undefined—
formstring | undefined—
hintstring | undefined—
hourCycle"h12" | "h23" | undefined—
inputRefRef<HTMLButtonElement> | undefined—
interval5 | 10 | 15 | 30 | 60 | 20 | undefined—
labelVisibility"hidden" | "visible" | undefined—
localestring | undefined—
maxTimestring | undefined—
minTimestring | undefined—
namestring | undefined—
onBlurFocusEventHandler<HTMLButtonElement> | undefined—
onInputBlurFocusEventHandler<HTMLInputElement> | undefined—
onInputKeyDownKeyboardEventHandler<HTMLInputElement> | undefined—
onValueChange((value: string | null) => void) | undefined—
placeholderstring | undefined—
readOnlyboolean | undefined—
requiredboolean | undefined—
textInputRefRef<HTMLInputElement> | undefined—
valuestring | null | undefined—

Tables come from the public TypeScript declarations. Related types and function parameters are shown alongside their component. A dash means no default is declared at the public function boundary.

Related controls

Notes to self

Test this component with real content, keyboard input and both themes. The example is a starting point; labels, error handling and behaviour still need to fit the application.