Skip to content

Date Picker

Download .md

A date picker is a form field that opens a Calendar in a popover and shows the chosen date, such as a release date.

  • Use it for one date in a form, near today: a release date, a deadline.
  • In long forms where people know the exact date, such as a birth date or a contract date years ago, a native date input (<input type="date">) is faster to type.
  • Show the date as 14 Nov 2026. Send it to the backend as ISO 2026-11-14, never as the displayed text.
React
Vue
1234
  1. 1Trigger showing the date
  2. 2Calendar icon
  3. 3Calendar in a popover
  4. 4Selected day

An outline Button with a calendar icon and the date, or the placeholder “Pilih tanggal” in muted-foreground. Clicking it opens the calendar in a Popover; picking a day closes it.

React Vue Flutter Type Default Use
value, onValueChange v-model ShadDatePicker onChanged Date / DateValue / DateTime none The chosen date.
placeholder placeholder placeholder text Pick a date Shown before a date is picked, such as “Pilih tanggal”.
disabled disabled enabled: false boolean false Turns the field off.
locale locale the app’s locale locale English (en-GB) Month names, and how the date reads. For Indonesian, id from react-day-picker/locale or "id-ID".
dateFormat formatDate text / function the locale’s short date (14 Aug 2026) A date-fns pattern, when the date needs another shape.
import { useState } from "react"
import { id } from "react-day-picker/locale"
import { DatePicker } from "@/components/ui/date-picker"
export default function DatePickerDemo() {
const [date, setDate] = useState<Date>()
return <DatePicker locale={id} value={date} onValueChange={setDate} placeholder="Pilih tanggal" className="w-56" />
}
Terminal window
npx shadcn@latest add https://design.sosialoka.tech/r/react/date-picker.json
  • Opening the picker puts focus on the chosen day, or today, so the arrow keys work straight away.
  • Enter picks the day and closes the popover; Escape closes it. Either way, focus goes back to the button.
  • Give the field a visible label with Field, such as “Tanggal rilis”.