Date Picker
A popover calendar for picking single dates, ranges, and birthdays in forms and filters — with neobrutalist borders and hard shadows.
"use client"
import * as React from "react"The date picker is not a single primitive — it composes the Popover and Calendar components, with react-day-picker handling the calendar grid, styled to the neobrutalist recipe: thick borders, hard shadows, and bold type.
Reach for it when:
- Booking and scheduling — check-in/check-out ranges, appointment slots, delivery dates.
- Form fields — date of birth, deadlines, start dates; pair with an input for typed entry.
- Dashboard filters — date-range selection over analytics, orders, and reports.
Installation#
The Date Picker is built using a composition of the <Popover /> and the <Calendar /> components.
See installation instructions for the Popover and the Calendar components.
Usage#
"use client"
import * as React from "react"
import { format } from "date-fns"
import { Calendar as CalendarIcon } from "lucide-react"
import { cn } from "@/lib/utils"
import { Button } from "@/components/ui/button"
import { Calendar } from "@/components/ui/calendar"
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover"
export function DatePickerDemo() {
const [date, setDate] = React.useState<Date>()
return (
<Popover>
<PopoverTrigger
render={
<Button
variant="outline"
data-empty={!date}
className="justify-start text-left font-normal data-[empty=true]:text-muted-foreground"
/>
}
>
<CalendarIcon />
{date ? format(date, "PPP") : <span>Pick a date</span>}
</PopoverTrigger>
<PopoverContent className="w-auto p-0">
<Calendar mode="single" selected={date} onSelect={setDate} />
</PopoverContent>
</Popover>
)
}See the React DayPicker documentation for more information.
Composition#
A date picker is built from Popover and Calendar (there is no DatePicker root component):
Popover
├── PopoverTrigger
└── PopoverContent
└── CalendarExamples#
Basic#
A basic date picker component.
"use client"
import * as React from "react"Range Picker#
A date picker component for selecting a range of dates.
"use client"
import * as React from "react"Date of Birth#
A date picker component for selecting a date of birth. This component includes a dropdown caption layout for month and year selection.
"use client"
import * as React from "react"Input#
A date picker component with an input field for selecting a date.
"use client"
import * as React from "react"Time Picker#
A date picker component with a time input field for selecting a time.
"use client"
import * as React from "react"Natural Language Picker#
This component uses the chrono-node library to parse natural language dates.
"use client"
import * as React from "react"RTL#
To enable RTL support in Neobrutalism.com, see the RTL configuration guide.
"use client"
import * as React from "react"Accessibility#
The composition follows the WAI-ARIA Date Picker Dialog example: the Popover wires the trigger with aria-expanded and aria-controls and returns focus on close, while react-day-picker renders the month as a grid of labeled day cells with a roving tabindex.
Keyboard interactions:
| Key | Action |
|---|---|
Space / Enter (on trigger) | Open the popover |
ArrowLeft / ArrowRight | Move focus to the previous / next day |
ArrowUp / ArrowDown | Move focus to the same day in the previous / next week |
PageUp / PageDown | Move to the previous / next month |
Shift + PageUp / Shift + PageDown | Move to the previous / next year |
Home / End | Move to the first / last day of the week |
Space / Enter | Select the focused day |
Escape | Close the popover and return focus to the trigger |