Forms
Date Picker
A calendar date picker using react-day-picker with portal rendering, custom format strings, and clear button.
Quick Preview
Installation
npm install react-day-picker date-fns
// Copy DatePicker.tsx to your components/forms/ folder// src/components/forms/DatePicker.tsx
Usage
import { DatePicker } from '@/components/forms/DatePicker'const [date, setDate] = useState<Date | undefined>()<DatePickervalue={date}onChange={setDate}label="Date"placeholder="Pick a date"formatStr="PPP" // e.g. "January 1st, 2025"/>
Examples
Disabled state
Custom format
Prompt Preview
Copy a prompt that recreates this UI
Paste this into your AI coding assistant to generate code that closely matches the reference, including color, size, shape, typography, spacing, and polish.
Copy-ready AI prompt
Starts from the current visual reference and project constraints.
Tweak only product-specific copy or data after the first generation pass.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
value | Date | undefined | - | Controlled selected date |
onChange | (date: Date | undefined) => void | - | Called when date changes |
placeholder | string | "Pick a date" | Trigger placeholder text |
disabled | boolean | false | Disables the picker |
label | string | - | Label rendered above trigger |
formatStr | string | "PPP" | date-fns format string for display |