pnpm dlx shadcn@latest add https://matos-ui.com/r/date-picker.jsonimport { DatePicker } from '@/components/matos-ui/date-picker'const [date, setDate] = useState<Date | null>(null)
<DatePicker value={date} onValueChange={setDate} /><form action={submit}>
<DatePicker name="starts" defaultValue={new Date()} min={new Date()} />
<button type="submit">Save</button>
</form>The hidden input posts ISO yyyy-mm-dd.
<DatePicker
format={(d) => d.toLocaleDateString('en-GB', { dateStyle: 'medium' })}
/><input> takes ISO yyyy-mm-dd or the locale's
numeric form — 11/22/2033 under en-US, 22/11/2033 under en-GB, the
field order read from Intl.DateTimeFormat. No natural language. It parses on
blur and on Enter; an unparseable value flags the field (aria-invalid)
rather than clearing what you typed.surfaceClasses(useSurface() + 2) — two
rungs above wherever the field sits, the dropdown convention — so it never
disappears into a dialog it opens inside. No bg-popover.@base-ui/react/popover (through
the Popover component): it moves focus into the grid on open and back to
the calendar button on close, traps it while open, and closes on Esc and
outside-click.| Prop | Type | Default | Description |
|---|---|---|---|
value | Date | null | — | Controlled selection. |
defaultValue | Date | null | null | Initial selection when uncontrolled. |
onValueChange | (value: Date | null) => void | — | Fires with the picked or parsed date. |
placeholder | string | "Select a date" | Input placeholder. |
format | (date: Date) => string | Intl long date | Render the value in the input. |
parse | (input: string, locale: string) => Date | null | ISO + numeric | Parse what the reader typed. |
name | string | — | Hidden input name; posts ISO yyyy-mm-dd. |
min / max | Date | null | — | Selectable bounds (also enforced on typed input). |
isDateDisabled | (date: Date) => boolean | — | Disable specific dates. |
weekStartsOn | number | locale's first day | 0 (Sunday) – 6 (Saturday). |
locale | string | "en-US" | BCP-47 tag for names and numeric parsing. |
disabled / readOnly | boolean | false | — |
open / defaultOpen / onOpenChange | — | — | Control the popover. |
Install Matos UI
Choose a package manager and copy one command for every component.