Forms/DatePicker
DatePicker
A text input that opens a popover calendar on click. Closes on select, outside click, or Escape.
import { DatePicker } from "@animui/ui"Basic
Custom format
Use formatDate to control how the selected date is displayed.
Disabled
Props
| Prop | Type | Default | Description |
|---|---|---|---|
value | Date | — | Currently selected date (controlled). |
onChange | (date: Date) => void | — | Called when a date is selected in the calendar. |
placeholder | string | "Select date" | Text shown in the trigger when no date is selected. |
formatDate | (date: Date) => string | toLocaleDateString() | Custom formatter for the selected date label. |
disabled | boolean | false | Prevents opening the popover. |
className | string | — | Additional classes for the wrapper element. |
Accessibility
- ✓Trigger exposes
aria-haspopupandaria-expanded. - ✓Pressing
Escapeor clicking outside closes the calendar. - ✓The embedded
Calendarsupports full keyboard navigation with arrow keys.