DateRangePicker

Two presses make a range. The field shows both days with the number of nights between them. Inputs.

Open playground

About

DateRangePicker is a React component in the Inputs category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { DateRangePicker } from "@ashutoshswamy/smoui" and set label, value, onChange among its 5 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { DateRangePicker } from "@ashutoshswamy/smoui";

<DateRangePicker label="Travel dates" onChange={setDates} />

Props 5

label

Visible and accessible field name.

string
value / defaultValue

Controlled or initial range.

{ from: Date | null; to: Date | null }
onChange

Called after each endpoint is picked.

(range: DateRange) => void
min / max

Allowed date bounds.

Date
locale

Date format and calendar language.

stringdefault "en-US"