Skip to content

Date picker

Choose a date without losing context.

DateField
npx shadcn@latest add @silicon-ui/date-picker

Installation

With the shadcn CLI

npx shadcn@latest add @silicon-ui/date-picker

Manually

  1. Install the dependencies

    npm install lucide-react motion
  2. Copy 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
  3. Add the foundation, once per app, for the design and motion tokens

    npx shadcn@latest add @silicon-ui/silicon-foundation

Usage

usage.tsx
import { DatePicker } from "@/components/silicon-ui/date-picker/date-picker";

API reference

PropTypeDefault
label*string—
valueDate—
onChange(date: Date | undefined) => void—
descriptionstring—
placeholderstring"Select a date"
minDateDate—
maxDateDate—
disabledDatesCalendarDateMatcher—
localestring"en-US"
formatIntl.DateTimeFormatOptions{ month: "short", day: "numeric", year: "numeric" }
showToday

Adds a Today button to the calendar header.

boolean—

Also accepts the props of ButtonHTMLAttributes<HTMLButtonElement>, except value, onChange.

Dependencies

npm
lucide-reactmotion
Registry
silicon-motion-tokenscalendar