Tangible Design System · @tangible/ui 0.2.29 · Interactive version · Markdown

DatePicker

import { DatePicker } from '@tangible/ui';

Interactive docs and examples: DatePicker in Storybook.

DatePicker props

Prop Type Default Description
aria-describedby? string ID of element(s) that describe the trigger. Field.Control injects this so helper text and errors are announced; without it the injection is silently dropped (no rest-spread on this component).
aria-invalid? "false" | "true" | boolean Marks the control invalid. Lands on the trigger button, which also wears tui-input-group — that is what lights the danger border.
aria-label? string
aria-labelledby? string ID of the element that labels the trigger. Field.Control injects this, and it outranks aria-label per AccName 2A — which is why the trigger's own aria-label fallback does not have to change. The trigger's value span is appended so the current date stays audible — except under asChild, where there is no value span and a phantom id would strip the name.
calendarLabels? CalendarLabels
children? ReactNode Trigger placement. Omit and the picker renders its own input-group button, exactly as before. Provide children to place the trigger yourself — inside a text field's suffix slot, a toolbar — with <DatePicker.Trigger> marking the spot, and asChild on that Trigger to supply your own element: <DatePicker value={date} onChange={commit}> <TextInput value={text} onChange={(e) => setText(e.target.value)} suffix={ <DatePicker.Trigger asChild> <IconButton icon="lms/calendar" label="Pick a date" /> </DatePicker.Trigger> } /> </DatePicker> Children with no Trigger among them leaves the picker unopenable; a dev warning fires for that case.
className? string
defaultValue? Date | null
disabled? boolean
hour12? boolean true 12-hour time UI with an AM/PM toggle.
id? string
isDayDisabled? (day: Date) => boolean Per-day disable hook, applied on top of min/max.
labels? DatePickerLabels
locale? string the document language, falling back to 'en-US' BCP 47 locale for month/weekday names and numeric formats.
max? Date Latest selectable day (inclusive, time-of-day ignored).
min? Date Earliest selectable day (inclusive, time-of-day ignored).
onChange? (value: Date) => void
value? Date | null
weekStartsOn? 0 | 1 | 2 | 3 | 4 | 5 | 6 1 First day of the week. 0 = Sunday … 6 = Saturday.
withTime? boolean false Include the time field (and format the trigger with time).
zoneLabel? ReactNode Display-only zone badge next to the time field, e.g. "UTC+0".

DatePicker.Trigger

Also exported as DatePickerTrigger.

Prop Type Default Description
asChild? boolean Render children as the trigger instead of the built-in input-group button. The child owns its accessible name and receives no chrome — see this file's header for what that costs and why.
children? React.ReactNode Trigger element, used when asChild is set.
className? string

Other exports

Examples

Other stories: Default, With time (Pick a Date and Time), Disabled, Min/Max bounds (interactive page).

Component API tokens

Read via fallback, never declared. Set one on an ancestor to restyle every instance under it.