Date Range Picker

Selects a start and an end date from a calendar popover.

Configurations

Supported configurations for this component.

States

Interaction states covered by the API and the style contract.

Configurations

4 examples
Live
With preset
Single day
Open

States

3 examples
Trigger hover
Rest
Trigger hover
Trigger focus visible
Rest
Trigger focus visible
Trigger open
Rest
Trigger open

Add to your project

One command adds this component to your project.

1

Run the following command. New project? Run npx shadcn@latest init first to set up Tailwind and path aliases.

npx shadcn@latest add @aicanvas/••••••••••••

Light and dark both come with the install and follow the dark class on <html>, the shadcn dark mode setup (next-themes with attribute="class").

Props

Every prop this component accepts. Any other prop is forwarded to the underlying element.

PropTypeDefaultDescription
value{ start: Date, end: Date }-Selected date range; controlled.
onChange(range: { start: Date, end: Date }, presetLabel?: string) => void-Called with the new range and, for preset picks, the label that produced it.
presetLabelstring-Label for the active preset shown in the trigger (for example "Last month").
presets{ label: string, range: { start: Date, end: Date } }[]-Deterministic preset ranges shown below the day grid.
defaultOpenbooleanfalseWhether the calendar panel starts open (uncontrolled).
staticOpenbooleanfalsePins the panel open and disables the dismissers; for a page that documents the calendar.
classNamestring-Additional CSS classes applied to the root element.
styleReact.CSSProperties-Inline styles applied to the root element.

More Andromeda Pro components