Standalone single-date picker popover: a month grid with month / year / decade navigation views. Controlled.
Use DatePicker when you need the calendar UI on its own (e.g. inside your own popover or inline panel). For a ready-made input field with a calendar popover use DatePickerInput; inside a @uxf/form form use @uxf/form/date-picker-input.
For selecting a range rather than a single day, use DateRangePicker. There is no @uxf/form twin of DatePicker itself.
"use client";
import { DatePicker } from "@uxf/ui/date-picker";
import React, { useState } from "react";
export function BasicDatePicker() {
const [value, setValue] = useState<Date | null>(null);
return <DatePicker onChange={setValue} selectedDate={value} />;
}
| Prop | Type | Default | Description |
|---|---|---|---|
selectedDate |
Date | null |
— | Required. Currently selected date (controlled). |
onChange |
(value: Date | null) => void |
— | Required. Called when a day is picked. |
minDate |
Date |
— | Earliest selectable date; earlier dates are dimmed and blocked. |
maxDate |
Date |
— | Latest selectable date; later dates are dimmed and blocked. |
datesConfig |
DatesConfig[] |
— | Per-date CSS flags and disabled groups (see below). |
onMonthChange |
(months: MonthType[]) => void |
— | Fires when the visible month changes. |
customButtonTitles |
CustomButtonTitles |
— | Overrides for navigation button labels/titles (see below). |
bottomContent |
ReactNode |
— | Arbitrary JSX rendered below the grid (legend, CTA, …). |
closePopoverHandler |
() => void |
— | Called right after a date is selected; use it to close a wrapping popover. |
preventScroll |
boolean |
— | Passed to the day cell's focus() to suppress scrolling on auto-focus. |
style |
CSSProperties |
— | Inline style on the root element. |
unavailableDates |
Date[] |
— | Deprecated. Dates that cannot be selected. Prefer datesConfig with isDisabled. |
Supporting types:
type DatesConfig = { flag?: string; dates: Date[]; isDisabled?: boolean };
type MonthType = { year: number; month: number; date: Date };
type CustomButtonTitles = {
nextMonth?: string;
prevMonth?: string;
nextYear?: string;
prevYear?: string;
nextDecade?: string;
prevDecade?: string;
selectMonth?: string;
selectYear?: string;
};
ViewModeType ("month" | "year" | "decade") is also exported for typing the internal navigation views.
minDate / maxDate. Dates outside the window render dimmed and are non-selectable.datesConfig. Each entry attaches an optional flag (CSS class hook) to dates, and isDisabled: true blocks the whole group. This is the non-deprecated replacement for unavailableDates.customButtonTitles.Client component ("use client"). Import the required stylesheets once in your global CSS:
@import url("@uxf/ui/css/button.css");
@import url("@uxf/ui/css/calendar.css");
@import url("@uxf/ui/css/date-picker.css");
Also requires the global @uxf/ui token layer, set up once per app — see @uxf/ui setup.