Skip to Content

Calendar

A date picker calendar panel built on Radix UI and date-fns. Renders a monthly grid for date selection. For a form-integrated date input, see CalendarInput.


Import

import { Calendar } from "@phpcreation/frontend-components-react-nextjs-bundle/components/Calendar";

Props

PropTypeDefaultDescription
selectedDate | undefinedSelected date
onSelect(date: Date | undefined) => voidSelection handler
mode"single" | "range" | "multiple""single"Selection mode
disabledMatcher | Matcher[]Disable specific dates
initialFocusbooleanfalseFocus on mount
classNamestringAdditional CSS classes

Usage

import { useState } from "react"; import { Calendar } from "..."; const [date, setDate] = useState<Date | undefined>(); <Calendar mode="single" selected={date} onSelect={setDate} initialFocus />

For form fields with a text input + calendar popover, use CalendarInput instead. The raw Calendar is useful for embedding a date picker inline on a page.


Last updated on