Date Range PickerPro
Presets and two months with a hover preview after the first click, comparison with the previous period or year, Apply and Cancel.
oxyn add date-range-pickerThe preview stays free for everyone. Pro opens the code of every Pro component, screen, agent-app template, block and kit, plus the Pro CLI.
Rendered from Rust at build time · goes live when visible
When to use
- Choose a span for usage, runs, cost or logs, often compared with the span before it.
- The user starts from a preset most of the time and fine-tunes with two clicks.
When not to use
- A compact month view for one date: use Calendar instead.
- A field that opens the calendar in a popover: use Date picker instead.
- On or off for things that apply right away: use Switch instead.
Installation
Date Range Picker is part of Oxyn Pro; the preview is free. Pro items install with the oxyn CLI once your licence is signed in; until then Pro members copy the code from this page.
oxyn add date-range-pickerUsage
The preview is free. Pro opens the code of every Pro component, screen and template.
Examples
Two months
Presets, two months and the comparison.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
One month
One month, no comparison.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Year
Compared with last year.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Closed
The trigger with its range.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
API reference
DateRangePicker
| Prop | Type | Default | Description |
|---|---|---|---|
label | String | "Date range" | Accessible name of the trigger and the dialog. |
start | Option<String> | Default::default() | Starting range start (ISO). |
end | Option<String> | Default::default() | Starting range end (ISO). |
placeholder | String | "Select dates" | Placeholder. |
today | String | "2026-11-13" | Today (ISO); reference for presets. |
compare | bool | true | Offer the comparison control. |
default_compare | String | "previous" | `off` · `previous` · `year`. |
week_starts_on | u8 | 1 | 0 = Sunday, 1 = Monday. |
months | u8 | 2 | `1` · `2` months. |
min | Option<String> | Default::default() | Earliest day. |
max | Option<String> | Default::default() | Latest day (default: today). |
default_open | bool | Default::default() | Open right away. |
on_change | EventHandler<RangeValue> | — | Applied: `(start, end, compare start, compare end)` as ISO. |
Read from the Rust signature and doc comments.
Keyboard interactions
| Key | Action |
|---|---|
| EnterorSpace | Open; in the grid pick a start, then an end |
| Arrow keys | Move by day or week; once a start is picked the preview follows |
| HomeorEnd | Start / end of the week |
| Page UporPage Down | A month (Shift: a year) |
| Esc | Close without applying |
Accessibility
- The trigger opens a dialog and its name includes the current range.
- Each month is a grid; days have full dates, aria-selected inside the range and aria-current for today.
- A polite region announces the start, then the range and its length.
From the spec
The trigger's name includes the current range. Each month is a grid with full-date cells, aria-selected for every day inside the range and aria-current for today. A polite region announces "Start Oct 15, pick an end" and then the range with its length. Compare is a radiogroup.
Motion & interaction
The panel grows from the trigger. Months slide when paging. The band grows to the hovered day. The trigger label rolls on Apply. The preset rail highlight moves to the matching preset (or none for a custom range).
Timing
| Transition | Duration | Easing | Reduced motion |
|---|---|---|---|
| Panel in | 220 ms | ease.out | 80 ms fade |
| Band / preview | 120 ms colour | ease.out | instant |
| Month slide | 240 ms | ease.out | 1 ms |
| Trigger roll | 220 ms | ease.out | swap |
Responsive behaviour
- Below 600 px the presets become a scrolling row of chips and one month shows; the footer stacks.
- The panel is as wide as the screen allows, up to 652 px.
Edge cases (spec)
Reverse picks (end before start) are ordered. Ranges across a year show both years. Comparison for leap days clamps. Very narrow (< 600 px): presets become a scrolling chip row, one month shows, the footer stacks. Max today: future days are disabled.
Notes for AI
- Import
DateRangePickerfromoxyn_dioxusand includePRIMITIVES_CSSplus the token stylesheet once. - A GPUI version exists:
RangePickerElinoxyn_gpui. - Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.