Components
HeroUI v3 Calendar — date calendar with year picker, controlled state, week/day views, min/max, unavailable dates, multiple selection, read-only, focused value, cell indicators, multiple months, booking example and custom styles.
npx @21st-dev/cli@beta add hero_ui/heroui-calendarLoading preview...
"use client"
import type { DateValue } from "@internationalized/date"
import { Description } from "@heroui/react"
import { isWeekend } from "@internationalized/date"
import { I18nProvider, useLocale } from "react-aria-components"
import Calendar from "@/components/ui/heroui-calendar"
function UnavailableCalendar() {
const { locale } = useLocale()
const isDateUnavailable = (date: DateValue) => isWeekend(date, locale)
return (
<div className="flex flex-col items-center gap-4">
<Calendar aria-label="Appointment date" isDateUnavailable={isDateUnavailable}>
<Calendar.Header>
<Calendar.Heading />
<Calendar.NavButton slot="previous" />
<Calendar.NavButton slot="next" />
</Calendar.Header>
<Calendar.Grid>
<Calendar.GridHeader>
{(day) => <Calendar.HeaderCell>{day}</Calendar.HeaderCell>}
</Calendar.GridHeader>
<Calendar.GridBody>{(date) => <Calendar.Cell date={date} />}</Calendar.GridBody>
</Calendar.Grid>
</Calendar>
<Description className="text-center">Weekends are unavailable</Description>
</div>
)
}
export default function UnavailableDates() {
return (
<I18nProvider locale="en-US">
<UnavailableCalendar />
</I18nProvider>
)
}
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...