Back to Shark UI

Date Picker

docs/components/date-picker

latest8.9 KB
Original Source

Sections

Components

Utilities

Forms

Hooks

Date Picker

Copy Markdown

Input with a built-in calendar.

DocsAPI

PreviewCode

Pick a date

Installation#

CLIManual

pnpmbunnpmyarn

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

Anatomy#

DatePicker
├── DatePickerTrigger
└── DatePickerContent
    ── (Calendar components)

Usage#

import {
  DatePicker,
  DatePickerCalendar,
  DatePickerClearTrigger,
  DatePickerContent,
  DatePickerControl,
  DatePickerInput,
  DatePickerLabel,
  DatePickerPositioner,
  DatePickerTrigger,
} from "@/components/ui/date-picker";
<DatePicker selectionMode="single">
  <DatePickerLabel>Pick a date</DatePickerLabel>
  <DatePickerControl>
    <DatePickerInput index={0} placeholder="Select date" />
    <DatePickerTrigger />
    <DatePickerClearTrigger asChild>
      <Button size="sm" variant="outline">Clear</Button>
    </DatePickerClearTrigger>
  </DatePickerControl>
  <DatePickerPositioner>
    <DatePickerContent>
      <DatePickerCalendar />
    </DatePickerContent>
  </DatePickerPositioner>
</DatePicker>

Examples#

Input#

Use DatePickerInput for a text input with calendar icon that opens the date picker.

PreviewCode

Range#

Select a date range with selectionMode="range".

PreviewCode

Pick a date range

Time#

Use DatePickerTimer for time selection.

PreviewCode

Time

With Presets#

Add quick single-date presets in a side panel.

PreviewCode

07/02/2026

Custom format#

Customize the format of the presets using external date formatting library like date-fns.

PreviewCode

January 15th, 2025

API Reference#

DatePicker#

Root element. Extends Calendar.

PropTypeDefault
valueDateValue[]-
defaultValueDateValue[]-
onValueChange(details: ValueChangeDetails) => void-
selectionMode`"single""range"
positioningPositioningOptions{ placement: "top" }
lazyMountboolean-
unmountOnExitboolean-

DatePickerTrigger#

Button that opens the date picker. button

PropTypeDefault
asChildboolean-
classNamestring-

DatePickerInput#

Input with calendar icon that opens the date picker on click. input

PropTypeDefault
placeholderstring-
indexnumber-
size`"sm""md"
classNamestring-

DatePickerContent#

Wraps the calendar. Inherits --cell-size from calendar for date cell sizing.

PropTypeDefault
classNamestring-
AttributeDefault
--cell-size--spacing(8)

DatePickerValue#

Displays the selected date(s) as text. Use inside DatePickerTrigger. span

PropTypeDefault
placeholderstring-
classNamestring-
asChildboolean-

DatePickerTimer#

Time input for selecting hour and minute. Use alongside the calendar for date-time selection. input

PropTypeDefault
valuestring-
defaultValuestring-
onValueChange(details: ValueChangeDetails) => void-
classNamestring-

DatePickerPresetTrigger#

Quick preset button for dates. button

PropTypeDefault
classNamestring-
valueDateValue[]-
asChildboolean-

For a complete list of props, see the Ark UI documentation.

[

Previous page

Date Input ](/docs/components/date-input)[

Next page

Dialog ](/docs/components/dialog)

On This Page

InstallationAnatomyUsageExamplesInputRangeTimeWith PresetsCustom formatAPI ReferenceDatePickerDatePickerTriggerDatePickerInputDatePickerContentDatePickerValueDatePickerTimerDatePickerPresetTrigger