Components
Loading preview...
A calendar displays one or more date grids and allows users to select a single date. There is no standalone calendar element in HTML. <input type="date">is close, but this is very limited in functionality, lacking in internationalization capabilities, inconsistent between browsers, and difficult to style. Calendar helps achieve accessible and international calendar components that can be styled as needed.
@jolbol1
npx shadcn@latest add https://21st.dev/r/jolbol1/calendarimport {
Calendar,
CalendarCell,
CalendarGrid,
CalendarGridBody,
CalendarGridHeader,
CalendarHeaderCell,
CalendarHeading,
} from "@/components/ui/calendar"
export function CalendarDemo() {
return (
<Calendar aria-label="Appointment date" className="bg-background rounded-lg px-2 py-3 border">
<CalendarHeading />
<CalendarGrid>
<CalendarGridHeader>
{(day) => <CalendarHeaderCell>{day}</CalendarHeaderCell>}
</CalendarGridHeader>
<CalendarGridBody>
{(date) => <CalendarCell date={date} />}
</CalendarGridBody>
</CalendarGrid>
</Calendar>
)
}