Skip to Content
ComponentsDatePicker

DatePicker

A trigger-and-popover date picker built on Base UI’s Popover primitive and the Calendar component. Selecting a date closes the popover automatically.

Import

import { DatePicker } from "chunks-ui";

Basic Usage

<DatePicker />

Controlled

function ControlledDatePicker() { const [date, setDate] = useState<Date | null>(null); return ( <DatePicker value={date} onValueChange={setDate} placeholder="Select a date" /> ); }

Date Constraints

Use min and max to limit the selectable range. Dates outside the range are rendered disabled in the calendar:

const today = new Date(); const nextMonth = new Date(today.getFullYear(), today.getMonth() + 1, today.getDate()); <DatePicker min={today} max={nextMonth} />

Disabled

<DatePicker disabled />

DatePicker Props

PropTypeDefaultDescription
valueDate | nullControlled selected date
defaultValueDate | nullnullInitial selected date (uncontrolled)
onValueChange(date: Date | null) => voidCalled when a date is selected
placeholderstring"Pick a date"Trigger placeholder text
disabledbooleanfalseDisable the trigger and prevent opening
minDateEarliest selectable date
maxDateLatest selectable date
isDateDisabled(date: Date) => booleanPredicate to disable individual dates
classNamestringAdditional CSS classes on the root element
Last updated on