Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Date Picker

ProNew

A field that opens a calendar, writes the date in words and closes on a choice.

Installation

pnpm dlx shadcn@latest add @viewport/date-picker

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above comes with Truffle Pro.

Props

PropTypeDefault
valueDate | null—
defaultValueDate | nullnull
onValueChange(date: Date | null) => void—
placeholderstring

Shown while no date is chosen.

"Pick a date"
formatIntl.DateTimeFormatOptions

How the chosen date is written in the field.

{ day: "numeric", month: "short", year: "numeric" }
localestring—
minDate—
maxDate—
isDateDisabled(date: Date) => boolean

Return true for days that cannot be chosen.

—
weekStart0 | 1—
clearableboolean

Show a button that clears the date.

false

Accessibility

  • Opens with focus on the selected day and returns focus to the field.
  • Escape and a press outside close it without changing the date.
  • Works with Field for a label, a hint and an error.
  • No scale animation under reduced motion.