cnippet/ui
  1. ui
  2. pickers
  3. date picker

pickers

Date Picker

A date picker component built with Calendar and Popover. Built with Base UI and Tailwind CSS. Copy-paste ready.

API Reference

Installation

Usage

A date picker is built by composing Calendar inside a Popover. There is no separate date-picker component file — copy the pieces you need.

Anatomy

Good to know

  • There is no DatePicker component to install. It's a pattern: a Calendar inside a Popover. Install both (@cnippet/calendar and @cnippet/popover).
  • The examples format dates with date-fns, which isn't installed with the calendar. Run npm install date-fns, or format dates another way.
  • The popover doesn't close when a date is picked. To close it, control open on Popover and set it to false in onSelect.
  • For a date range, use mode="range" and store a DateRange ({ from, to }).

API Reference

A date picker is a composition of Calendar inside a Popover — there is no separate component file. The following props cover the pieces you'll combine.

Calendar (inside the popover)

See the Calendar API Reference for the full prop list. Common props when used inside a date picker:

PopoverPopup (wrapping the Calendar)

See the Popover API Reference. The popover closes when the user selects a date if you call the popover's close handle in onSelect.

Examples

Date Range

A range picker using mode="range" that highlights all days between the selected start and end date.

Year and month selection via a searchable Combobox dropdown, spanning 1900 to today — useful for date-of-birth or historical date inputs.

With Presets

Quick-select buttons for common offsets (Today, Tomorrow, In 3 days, In a week) alongside a full calendar so users can jump to frequent dates in one click.

With Input

Combines a native type="date" text field with a popover calendar — users can type a date directly or open the picker, and both stay in sync.

Auto-close on Select

Closes the popover immediately after a date is chosen, reducing the number of clicks needed for a simple selection task.

Appointment Booking

Displays a specialist card with available time slots that update per selected date — booked slots are struck through and disabled, confirming only when both a date and slot are chosen.

Team Meeting Scheduler

Pick a date to instantly see each team member's availability (Free / Busy) based on their schedule — weekends are disabled, and the invite button stays locked until a valid day is chosen.

Delivery Date Selector

Choose between Standard and Express shipping — the calendar disables ineligible dates per method (no weekends for Standard), and the estimated delivery window updates live as the user picks a date.

Task Deadline Reschedule

A project task card with assignee avatars and a protected date picker — the calendar requires explicit Apply before the deadline updates, preventing accidental changes; a Rescheduled badge and the original date appear once a new deadline is set.

Report Period Range with Presets

Quick-select month and multi-month preset buttons (This month, Next month, Next 3 months, Next 6 months) paired with a 2-month range calendar and a day-count badge in the trigger.

Recurring Event Date Picker

A single date picker combined with recurrence pill buttons (Does not repeat, Daily, Weekly, Monthly) that outputs a human-readable schedule summary below.

Hotel Stay Range with Duration Shortcuts

Duration shortcut buttons (1 week, 2 weeks, 1 month) snap the range instantly; the trigger badge shows the night count and a Clear / Done footer controls the popover.

Birthday Picker with Age Validation

A dropdown-navigation calendar scoped to the 18–100 year age window, auto-closing on selection and displaying the computed age below the input.

Multi-date Availability Selector

A multiple-selection calendar for picking available days, with removable chip tags below the trigger and a night-count badge summarising the selection.