DatePicker

A date field that reads like a label on a value, with a round calendar button and a clear button. Inputs.

Open playground

About

DatePicker 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 { DatePicker } from "@ashutoshswamy/smoui" and set label, value, onChange among its 5 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

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

<DatePicker label="Due date" onChange={setDate} />

Props 5

label

Visible and accessible field name.

string
value / defaultValue

Controlled or initial date.

Datenull
onChange

Called when a day is picked.

(date: Date) => void
min / max

Allowed date bounds.

Date
locale

Date format and calendar language.

stringdefault "en-US"