Time Range Picker
A time range whose value is an expression, so it stays relative across a reload.
- Forms
- 2 files
- 1 npm package
- Accessibility notes
pnpm dlx @dowel-ui/cli add time-range-pickernpm packages installed: react-day-picker.
import { TimeRange } from "@/components/ui/time-range-picker";Default
Stays Relative
Snapping
With Calendar
Expression Entry
In Another Zone
Custom Presets
Invalid Value
<TimeRange>
| Prop | Type | Default |
|---|---|---|
children (required) | ReactNode | — |
defaultValue | string | "now-6h..now" |
locale | string | — |
nowThe instant relative expressions are measured from. Supplied by the consumer so nothing here reads the clock during render. Pass a value that changes when you refresh; a stable one holds the window still between them. | Date | — |
onOpenChange | (open: boolean) => void | — |
onValueChange | (expression: string) => void | — |
open | boolean | — |
presets | TimeRangePreset[] | DEFAULT_PRESETS |
timeZoneIANA zone the snapping happens in. Defaults to the runtime zone. | string | — |
valueThe expression, e.g. | string | — |
<TimeRangeTrigger>
| Prop | Type | Default |
|---|---|---|
showResolvedShows the resolved window under the label. Off by default; it is long. | boolean | false |
Plus every attribute of <button>.
<TimeRangeContent>
| Prop | Type | Default |
|---|---|---|
labelNames the dialog. | string | "Choose a time range" |
<TimeRangePresets>
Plus every attribute of <div> except children.
<TimeRangeExpression>
Plus every attribute of <div> except children.
<TimeRangeCalendar>
| Prop | Type | Default |
|---|---|---|
numberOfMonths | number | 1 |
Plus every attribute of <div> except children.
10/10
checks passed
- Tested — passes
- axe assertion — passes
- Keyboard tested — passes
- Storybook examples — passes
- Accessibility documented — passes
- Semantic tokens only — passes
- Motion from tokens — passes
- className merged — passes
- Visible focus — passes
- No fixed widths — passes