Date picker
Choose a date without losing context.
npx shadcn@latest add @silicon-ui/date-pickerInstallation
With the shadcn CLI
npx shadcn@latest add @silicon-ui/date-pickerManually
Install the dependencies
npm install lucide-react motionCopy these files into your project
- components/silicon-ui/date-picker/date-picker.tsx
- components/silicon-ui/date-picker/date-picker.module.css
Shared with other components. Skip any you already have.
- components/silicon-ui/calendar/calendar.tsx
- components/silicon-ui/lib/use-today.ts
- components/silicon-ui/calendar/calendar.module.css
- components/silicon-ui/lib/fluid-hover.tsx
Add the foundation, once per app, for the design and motion tokens
npx shadcn@latest add @silicon-ui/silicon-foundation
Usage
API reference
| Prop | Type | Default |
|---|---|---|
label* | string | — |
value | Date | — |
onChange | (date: Date | undefined) => void | — |
description | string | — |
placeholder | string | "Select a date" |
minDate | Date | — |
maxDate | Date | — |
disabledDates | CalendarDateMatcher | — |
locale | string | "en-US" |
format | Intl.DateTimeFormatOptions | { month: "short", day: "numeric", year: "numeric" } |
showTodayAdds a Today button to the calendar header. | boolean | — |
Also accepts the props of ButtonHTMLAttributes<HTMLButtonElement>, except value, onChange.