Forms and dates
useDateRangePicker
Keeps paired native date inputs constrained so the end date cannot be before the start date.
Live component preview · Astro
Explore DateRangePicker
Try the component this hook connects to. The preview uses the Astro adapter; the React example below uses useDateRangePicker.
July 2026
| Mon | Tue | Wed | Thu | Fri | Sat | Sun |
|---|---|---|---|---|---|---|
| 29 | 30 | 1 | 2 | 3 | 4 | 5 |
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 | 31 | 1 | 2 |
| 3 | 4 | 5 | 6 | 7 | 8 | 9 |
July 2026
| Mon | Tue | Wed | Thu | Fri | Sat | Sun |
|---|---|---|---|---|---|---|
| 29 | 30 | 1 | 2 | 3 | 4 | 5 |
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 | 31 | 1 | 2 |
| 3 | 4 | 5 | 6 | 7 | 8 | 9 |
React usage
Import from @santi020k/lumen-react and spread the controller props onto the matching components.
import { useDateRangePicker } from '@santi020k/lumen-react'
export function BookingRange() {
const range = useDateRangePicker()
return (
<div className="ui-date-range-picker" {...range.rootProps}>
<input className="ui-input ui-date-picker" aria-label="Start date" {...range.getStartProps()} />
<input className="ui-input ui-date-picker" aria-label="End date" {...range.getEndProps()} />
</div>
)
}Scroll horizontally to read more
Load @santi020k/lumen-react/styles.css once in your application. With React Server Components, put 'use client' at the top of the module that calls the hook. Follow the React setup guide for the framework boundary.
Options
Scroll horizontally to compare
| Property | Type | Default | Description |
|---|---|---|---|
| onRangeChange | (detail: DateRangePickerChangeDetail) => void | - | Callback fired after the date range is synchronized. |
Controller return values
Scroll horizontally to compare
| Property | Type | Description |
|---|---|---|
| rootProps | LumenProps<"div"> | Spread onto the date range root. |
| rootRef | RefObject<HTMLElement> | Ref to the date range root. |
| getStartProps | (props?) => LumenProps<"input"> | Returns props for the start date input. |
| getEndProps | (props?) => LumenProps<"input"> | Returns props for the end date input. |
| syncRange | (root?) => DateRangePickerChangeDetail | Synchronize min/max constraints and return the current range. |