React Date Picker
A glass React date picker that opens a calendar in a popover, or in a bottom sheet on phones, for single dates and ranges.
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/date-picker.jsonSchedule your delivery
Pick a day for the courier.
DatePickerDateRangePickerdefaultDatePickerLabelsdefaultDateRangePickerLabels- +2 more
Using it in a form? See the react-hook-form and zod recipe.
Single date
Today / Clear in the footer, × in the field. Resize below 640px to get the bottom sheet.
We'll remind you the day before.
import { useState } from "react";
import { DatePicker } from "@/components/sheenui/date-picker/date-picker";
// Package build (after the first npm release, or a packed tarball): import { DatePicker } from "@sheenui/theme";
export function Example() {
const [due, setDue] = useState<Date | null>(null);
return (
<DatePicker label="Due date" value={due} onValueChange={setDue} description="We'll remind you the day before." />
);
}Files to copy
9 folders · 14 files · 4 packages
- From
theme/src/ components/calendar/components/date-picker/components/button/components/spinner/components/status-icons/hooks/{use-controllable.ts, use-direction.ts, use-latest.ts, use-magnetic.ts, use-media-query.ts, use-preferences.ts}motion/{gate.ts, tokens.ts}lib/{cn.ts, field-size.ts, form.ts, popup-motion.ts, state-light.tsx, warn-once.ts}styles/
- shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/date-picker.jsonRegistry item: date-picker. The styles need the Tailwind v4 glass UI setup.- Packages
pnpm add @base-ui/react clsx motion tailwind-merge
Bounds and unavailable days
Weekdays in the next 60 days only. The month arrows stop at the bounds.
import { DatePicker } from "@/components/sheenui/date-picker/date-picker";
// Package build (after the first npm release, or a packed tarball): import { DatePicker } from "@sheenui/theme";
const startOfDay = (d: Date) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
const addDays = (d: Date, n: number) => new Date(d.getFullYear(), d.getMonth(), d.getDate() + n);
export function Example() {
const today = startOfDay(new Date());
return (
<DatePicker
label="Delivery date"
min={today}
max={addDays(today, 60)}
isDateDisabled={(d) => d.getDay() === 0 || d.getDay() === 6}
formatOptions={{ weekday: "short", day: "numeric", month: "long" }}
/>
);
}Date range with presets
Two months side by side where they fit beside the presets, one on tablets and phones (there the presets become a swipeable row). Hover previews the range; nothing after today.
import { useState } from "react";
import { type DateRange } from "@/components/sheenui/calendar/date-utils";
import { DateRangePicker, type DateRangePreset } from "@/components/sheenui/date-picker/date-picker";
// Package build (after the first npm release, or a packed tarball): import { DateRangePicker, type DateRange, type DateRangePreset } from "@sheenui/theme";
const startOfDay = (d: Date) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
const addDays = (d: Date, n: number) => new Date(d.getFullYear(), d.getMonth(), d.getDate() + n);
const today = () => startOfDay(new Date());
const PRESETS: DateRangePreset[] = [
{ label: "Today", range: () => ({ start: today(), end: today() }) },
{ label: "Last 7 days", range: () => ({ start: addDays(today(), -6), end: today() }) },
{ label: "Last 30 days", range: () => ({ start: addDays(today(), -29), end: today() }) },
{ label: "This month so far", range: () => ({ start: new Date(new Date().getFullYear(), new Date().getMonth(), 1), end: today() }) },
];
export function Example() {
const [period, setPeriod] = useState<DateRange | null>(null);
return (
<DateRangePicker label="Reporting period" value={period} onValueChange={setPeriod} max={today()} presets={PRESETS} />
);
}In a form
name submits YYYY-MM-DD; a range submits startName / endName. Errors show under the field.
import { Button } from "@/components/sheenui/button/button";
import { DatePicker } from "@/components/sheenui/date-picker/date-picker";
// Package build (after the first npm release, or a packed tarball): import { Button, DatePicker } from "@sheenui/theme";
export function Example() {
const missing = false; // set from your validation
return (
<form onSubmit={(event) => { event.preventDefault(); /* validate, then submit */ }}>
<DatePicker name="checkIn" label="Check-in" required error={missing && "Pick a check-in date."} />
<Button type="submit">Book</Button>
</form>
);
}DatePicker props
CalendarLabels keys and English defaults (11)
DatePickerLabels keys and English defaults (7)
DateRangePicker props
DateRangePickerLabels keys and English defaults (10)
Keyboard
Accessibility
- The trigger is a labeled button showing the chosen date; the calendar opens in a popover, or as a swipe-to-close bottom sheet on phones.
- Focus lands on the selected day (or today) and returns to the field on close; the sheet keeps the field above the software keyboard.
- name submits an ISO date with a form; error is announced politely. Pass locale and today on prerendered pages so server and browser text match.
All exports on this page
DatePicker— DatePicker: a glass field that opens a Calendar to pick one day.DateRangePicker— DateRangePicker: a glass field that opens a Calendar to pick a start and an end day (bookings, reports).defaultDatePickerLabels— Default English strings of DatePickerLabels; spread it and override single keys to reword.defaultDateRangePickerLabels— Default English strings of DateRangePickerLabels; spread it and override single keys to reword.
When to use the date picker
- Use it as a mobile-friendly date picker, a popover on desktop and a bottom sheet on phones, for a check-in field on a hotel or rental form where people type nothing and instead open a calendar from a labeled button, with min set to today so past dates are unavailable.
- Use DateRangePicker when you need a start and an end, for example a reporting period, where its presets such as Next 7 days let people skip the grid entirely.
- Use it in a form posted to a server: the name prop submits the chosen day as YYYY-MM-DD, so a plain form action or FormData read gets a predictable string.
- Skip it when the calendar should be permanently visible on the page, as in a scheduling sidebar; Calendar on its own does that, without the field, popover or sheet around it.
- Pair it with its own description and error props for helper text and the message, Button for a custom reset action beside it, and the calendarLabels prop when translating the grid inside the popup.
Frequently asked questions
Related pages
67 components pages in all: browse them on All components.
By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .