- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Attachment
- Avatar
- Badge
- Breadcrumb
- Bubble
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Code Block
- Collapsible
- Combobox
- Command
- Context Menu
- Data Table
- Date Picker
- Dialog
- Direction
- Drawer
- Dropdown Menu
- Empty
- Field
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- Marker
- Message
- Message Scroller
- Native Select
- Pagination
- Popover
- Progress
- Questionnaire
- Radio Group
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toast
- Toggle
- Toggle Group
- Tooltip
- Trace
- Typography
November 2026
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 1 | 2 | 3 | 4 | 5 |
"use client"
import * as React from "react""use client"
import * as React from "react"
import {
getLocalTimeZone,
today,
type CalendarDate,
} from "@internationalized/date"
import { Calendar } from "@/components/ui/calendar"
export function CalendarDemo() {
const [date, setDate] = React.useState<CalendarDate | undefined>(
today(getLocalTimeZone())
)
return (
<Calendar
value={date}
onChange={setDate}
className="rounded-lg border"
captionLayout="dropdown"
/>
)
}
Installation#
pnpm dlx shadcn@latest add calendar
Install the following dependencies:
pnpm add react-aria-components @internationalized/date
Add the Button component to your project.
The Calendar component uses the Button component. Make sure you have it installed in your project.
Copy and paste the following code into your project.
"use client"
import * as React from "react"
import { cva } from "class-variance-authority"
import { cn } from "cn"
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react"
import {
Calendar as AriaCalendar,
CalendarGridHeader as AriaCalendarGridHeader,
RangeCalendar as AriaRangeCalendar,
CalendarCell,
CalendarGrid,
CalendarGridBody,
CalendarHeaderCell,
CalendarHeading,
CalendarMonthPicker,
CalendarYearPicker,
type CalendarCellRenderProps,
type CalendarProps,
type DateValue,
type RangeCalendarProps,
} from "react-aria-components"
import { Button, buttonVariants } from "@/components/ui/button"
import {
Select,
SelectContent,
SelectGroup,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select"
const cellVariants = cva(
"group/day relative mt-2 aspect-square h-full w-full cursor-default rounded-(--cell-radius) p-0 text-center select-none [&:is(:last-child>[data-selected=true])>div]:rounded-r-(--cell-radius)",
{
variants: {
showWeekNumber: {
false:
"[&:is(:first-child>[data-selected=true])>div]:rounded-l-(--cell-radius)",
true: "[&:is(:nth-child(2)>[data-selected=true])>div]:rounded-l-(--cell-radius)",
},
isToday: {
true: "rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none",
},
isSelectionStart: {
true: "relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-muted",
},
isSelectionEnd: {
true: "relative isolate z-0 rounded-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-muted",
},
isUnavailable: {
true: "text-muted-foreground opacity-50 [&>div]:line-through",
},
isDisabled: {
true: "text-muted-foreground opacity-50",
},
isOutsideMonth: {
true: "text-muted-foreground aria-selected:text-muted-foreground",
},
},
}
)
function Calendar<
T extends DateValue,
M extends "single" | "multiple" = "single",
>(
props: Omit<CalendarProps<T, M>, "visibleDuration"> & {
buttonVariant?: React.ComponentProps<typeof Button>["variant"]
captionLayout?: "label" | "dropdown"
numberOfMonths?: number
showWeekNumber?: boolean
headerFormat?: Intl.DateTimeFormatOptions
renderCell?: (
renderProps: CalendarCellRenderProps & {
defaultChildren: React.ReactNode
}
) => React.ReactNode
}
) {
return (
<AriaCalendar
{...props}
data-slot="calendar"
visibleDuration={{ months: props.numberOfMonths || 1 }}
className={cn(
"group/calendar w-fit bg-background p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent",
props.className
)}
>
<CalendarInner {...props} />
</AriaCalendar>
)
}
function RangeCalendar<T extends DateValue>(
props: RangeCalendarProps<T> & {
buttonVariant?: React.ComponentProps<typeof Button>["variant"]
captionLayout?: "label" | "dropdown"
headerFormat?: Intl.DateTimeFormatOptions
numberOfMonths?: number
showWeekNumber?: boolean
renderCell?: (
renderProps: CalendarCellRenderProps & {
defaultChildren: React.ReactNode
}
) => React.ReactNode
}
) {
return (
<AriaRangeCalendar
{...props}
data-slot="calendar"
visibleDuration={{ months: props.numberOfMonths || 1 }}
className={cn(
"group/calendar w-fit bg-background p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent",
props.className
)}
>
<CalendarInner {...props} isRange />
</AriaRangeCalendar>
)
}
function CalendarInner({
captionLayout = "label",
buttonVariant = "ghost",
numberOfMonths = 1,
showWeekNumber = false,
headerFormat,
renderCell,
isRange,
}: {
buttonVariant?: React.ComponentProps<typeof Button>["variant"]
captionLayout?: "label" | "dropdown"
numberOfMonths?: number
showWeekNumber?: boolean
headerFormat?: Intl.DateTimeFormatOptions
renderCell?: (
renderProps: CalendarCellRenderProps & { defaultChildren: React.ReactNode }
) => React.ReactNode
isRange?: boolean
}) {
return (
<div className="relative flex flex-col gap-4 md:flex-row">
<header className="absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1">
<Button
variant={buttonVariant}
slot="previous"
className="size-(--cell-size) p-0 select-none aria-disabled:opacity-50"
>
<ChevronLeftIcon className="cn-rtl-flip size-4" />
</Button>
<Button
variant={buttonVariant}
slot="next"
className="size-(--cell-size) p-0 select-none aria-disabled:opacity-50"
>
<ChevronRightIcon className="cn-rtl-flip size-4" />
</Button>
</header>
{Array.from({ length: numberOfMonths }, (_, i) => (
<div key={i} className="flex w-full flex-col gap-4">
<div className="flex h-(--cell-size) w-full items-center justify-center gap-1 px-(--cell-size)">
{captionLayout === "dropdown" ? (
<>
<MonthDropdown format={headerFormat} />
<YearDropdown format={headerFormat} />
</>
) : (
<CalendarHeading
offset={{ months: i }}
format={headerFormat}
className="text-sm font-medium select-none"
/>
)}
</div>
<CalendarGrid
className="w-full border-collapse"
offset={{ months: i }}
>
<AriaCalendarGridHeader>
{(day) => (
<CalendarHeaderCell className="rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none">
{day}
</CalendarHeaderCell>
)}
</AriaCalendarGridHeader>
<CalendarGridBody>
{(date) => (
<CalendarCell
date={date}
className={(renderProps) =>
cellVariants({ ...renderProps, showWeekNumber })
}
>
{(renderProps) => (
<div
data-selected-single={renderProps.isSelected && !isRange}
data-range-start={renderProps.isSelectionStart && isRange}
data-range-end={renderProps.isSelectionEnd && isRange}
data-range-middle={
renderProps.isSelected &&
!renderProps.isSelectionStart &&
!renderProps.isSelectionEnd &&
isRange
}
className={cn(
buttonVariants({ variant: "ghost", size: "icon" }),
"relative isolate z-10 flex aspect-square h-full w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70"
)}
>
{renderCell
? renderCell(renderProps)
: renderProps.defaultChildren}
</div>
)}
</CalendarCell>
)}
</CalendarGridBody>
</CalendarGrid>
</div>
))}
</div>
)
}
function MonthDropdown({ format }: { format?: Intl.DateTimeFormatOptions }) {
return (
<CalendarMonthPicker format={format?.month}>
{(props) => (
<Select {...props} className="relative">
<SelectTrigger>
<SelectValue />
</SelectTrigger>
<SelectContent className="min-w-0">
<SelectGroup>
{props.items.map((item) => (
<SelectItem key={item.id} id={item.id}>
{item.formatted}
</SelectItem>
))}
</SelectGroup>
</SelectContent>
</Select>
)}
</CalendarMonthPicker>
)
}
function YearDropdown({ format }: { format?: Intl.DateTimeFormatOptions }) {
return (
<CalendarYearPicker format={format}>
{(props) => (
<Select {...props} className="relative">
<SelectTrigger>
<SelectValue />
</SelectTrigger>
<SelectContent className="min-w-0">
{props.items.map((item) => (
<SelectItem key={item.id} id={item.id}>
{item.formatted}
</SelectItem>
))}
</SelectContent>
</Select>
)}
</CalendarYearPicker>
)
}
export { Calendar, RangeCalendar }
Update the import paths to match your project setup.
Usage#
import {
getLocalTimeZone,
today,
type CalendarDate,
} from "@internationalized/date"
import { Calendar } from "@/components/ui/calendar"const [date, setDate] = React.useState<CalendarDate | null>(
today(getLocalTimeZone())
)
return (
<Calendar value={date} onChange={setDate} className="rounded-lg border" />
)See the React Aria documentation for more information.
Date Picker#
You can use the <Calendar> component to build a date picker. See the Date Picker page for more information.
International Calendars#
To use international calendar systems such as Persian, Islamic, or Buddhist, use React Aria's I18nProvider to set the locale.
۱۴۰۴ جوزا
۱۴۰۴ جوزا
| ش | ی | د | س | چ | پ | ج |
|---|---|---|---|---|---|---|
۲۷ | ۲۸ | ۲۹ | ۳۰ | ۳۱ | ۱ | ۲ |
۳ | ۴ | ۵ | ۶ | ۷ | ۸ | ۹ |
۱۰ | ۱۱ | ۱۲ | ۱۳ | ۱۴ | ۱۵ | ۱۶ |
۱۷ | ۱۸ | ۱۹ | ۲۰ | ۲۱ | ۲۲ | ۲۳ |
۲۴ | ۲۵ | ۲۶ | ۲۷ | ۲۸ | ۲۹ | ۳۰ |
۳۱ | ۱ | ۲ | ۳ | ۴ | ۵ | ۶ |
"use client"
import * as React from "react""use client"
import * as React from "react"
import { Vazirmatn } from "next/font/google"
import { CalendarDate } from "@internationalized/date"
import { cn } from "cn"
import {
ChevronDownIcon,
ChevronLeftIcon,
ChevronRightIcon,
} from "lucide-react"
import { I18nProvider } from "react-aria-components"
import { getDefaultClassNames, type DayButton } from "react-day-picker"
import { DayPicker } from "react-day-picker/persian"
import { Calendar } from "@/components/ui/calendar"
import { Button, buttonVariants } from "@/components/ui/button"
const vazirmatn = Vazirmatn({ subsets: ["arabic"] })
export function CalendarHijri() {
const [date, setDate] = React.useState<CalendarDate | undefined>(
new CalendarDate(2025, 6, 12)
)
return (
<div className={vazirmatn.className}>
<I18nProvider locale="fa-AF-u-ca-persian">
<Calendar
value={date}
onChange={setDate}
className="rounded-lg border"
/>
</I18nProvider>
</div>
)
}
// // ----------------------------------------------------------------------------
// // The code below is for this example only.
// // For your own calendar, you would edit the calendar.tsx component directly.
// // ----------------------------------------------------------------------------
// function Calendar({
// className,
// classNames,
// showOutsideDays = true,
// captionLayout = "label",
// buttonVariant = "ghost",
// formatters,
// components,
// ...props
// }: React.ComponentProps<typeof DayPicker> & {
// buttonVariant?: React.ComponentProps<typeof Button>["variant"]
// }) {
// const defaultClassNames = getDefaultClassNames()
// return (
// <DayPicker
// showOutsideDays={showOutsideDays}
// className={cn(
// "group/calendar bg-background p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
// String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
// String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
// className
// )}
// captionLayout={captionLayout}
// formatters={{
// formatMonthDropdown: (date) =>
// date.toLocaleString("default", { month: "short" }),
// ...formatters,
// }}
// classNames={{
// root: cn("w-fit", defaultClassNames.root),
// months: cn(
// "relative flex flex-col gap-4 md:flex-row",
// defaultClassNames.months
// ),
// month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
// nav: cn(
// "absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",
// defaultClassNames.nav
// ),
// button_previous: cn(
// buttonVariants({ variant: buttonVariant }),
// "size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
// defaultClassNames.button_previous
// ),
// button_next: cn(
// buttonVariants({ variant: buttonVariant }),
// "size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
// defaultClassNames.button_next
// ),
// month_caption: cn(
// "flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)",
// defaultClassNames.month_caption
// ),
// dropdowns: cn(
// "flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium",
// defaultClassNames.dropdowns
// ),
// dropdown_root: cn(
// "relative rounded-md border border-input shadow-xs has-focus:border-ring has-focus:ring-[3px] has-focus:ring-ring/50",
// defaultClassNames.dropdown_root
// ),
// dropdown: cn("absolute inset-0 opacity-0", defaultClassNames.dropdown),
// caption_label: cn(
// "font-medium select-none",
// captionLayout === "label"
// ? "text-sm"
// : "flex h-8 items-center gap-1 rounded-md pr-1 pl-2 text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground",
// defaultClassNames.caption_label
// ),
// table: "w-full border-collapse",
// weekdays: cn("flex", defaultClassNames.weekdays),
// weekday: cn(
// "flex-1 rounded-md text-[0.8rem] font-normal text-muted-foreground select-none",
// defaultClassNames.weekday
// ),
// week: cn("mt-2 flex w-full", defaultClassNames.week),
// week_number_header: cn(
// "w-(--cell-size) select-none",
// defaultClassNames.week_number_header
// ),
// week_number: cn(
// "text-[0.8rem] text-muted-foreground select-none",
// defaultClassNames.week_number
// ),
// day: cn(
// "group/day relative aspect-square h-full w-full p-0 text-center select-none [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",
// defaultClassNames.day
// ),
// range_start: cn(
// "rounded-l-md bg-accent",
// defaultClassNames.range_start
// ),
// range_middle: cn("rounded-none", defaultClassNames.range_middle),
// range_end: cn("rounded-r-md bg-accent", defaultClassNames.range_end),
// today: cn(
// "rounded-md bg-accent text-accent-foreground data-[selected=true]:rounded-none",
// defaultClassNames.today
// ),
// outside: cn(
// "text-muted-foreground aria-selected:text-muted-foreground",
// defaultClassNames.outside
// ),
// disabled: cn(
// "text-muted-foreground opacity-50",
// defaultClassNames.disabled
// ),
// hidden: cn("invisible", defaultClassNames.hidden),
// ...classNames,
// }}
// components={{
// Root: ({ className, rootRef, ...props }) => {
// return (
// <div
// data-slot="calendar"
// ref={rootRef}
// className={cn(className)}
// {...props}
// />
// )
// },
// Chevron: ({ className, orientation, ...props }) => {
// if (orientation === "left") {
// return (
// <ChevronLeftIcon className={cn("size-4", className)} {...props} />
// )
// }
// if (orientation === "right") {
// return (
// <ChevronRightIcon
// className={cn("size-4", className)}
// {...props}
// />
// )
// }
// return (
// <ChevronDownIcon className={cn("size-4", className)} {...props} />
// )
// },
// DayButton: CalendarDayButton,
// WeekNumber: ({ children, ...props }) => {
// return (
// <td {...props}>
// <div className="flex size-(--cell-size) items-center justify-center text-center">
// {children}
// </div>
// </td>
// )
// },
// ...components,
// }}
// {...props}
// />
// )
// }
// function CalendarDayButton({
// className,
// day,
// modifiers,
// ...props
// }: React.ComponentProps<typeof DayButton>) {
// const defaultClassNames = getDefaultClassNames()
// const ref = React.useRef<HTMLButtonElement>(null)
// React.useEffect(() => {
// if (modifiers.focused) ref.current?.focus()
// }, [modifiers.focused])
// return (
// <Button
// variant="ghost"
// size="icon"
// data-day={day.date.toLocaleDateString()}
// data-selected-single={
// modifiers.selected &&
// !modifiers.range_start &&
// !modifiers.range_end &&
// !modifiers.range_middle
// }
// data-range-start={modifiers.range_start}
// data-range-end={modifiers.range_end}
// data-range-middle={modifiers.range_middle}
// className={cn(
// "flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-accent-foreground [&>span]:text-xs [&>span]:opacity-70",
// defaultClassNames.day,
// className
// )}
// {...(props as React.ComponentProps<typeof Button>)}
// />
// )
// }
Basic#
A basic calendar component. We used className="rounded-lg border" to style the calendar.
November 2026
January 2026
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 1 | 2 | 3 | 4 | 5 |
"use client"
import { Calendar } from "@/components/ui/calendar""use client"
import { Calendar } from "@/components/ui/calendar"
export function CalendarBasic() {
return <Calendar className="rounded-lg border" />
}
Range Calendar#
Use the RangeCalendar component to enable range selection.
January to February 2026
January 2026
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
28 | 29 | 30 | 31 | 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
February 2026
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
"use client"
import * as React from "react""use client"
import * as React from "react"
import { CalendarDate } from "@internationalized/date"
import { type DateRange } from "react-aria-components"
import { RangeCalendar } from "@/components/ui/calendar"
export function CalendarRange() {
const [dateRange, setDateRange] = React.useState<DateRange | undefined>({
start: new CalendarDate(new Date().getFullYear(), 1, 12),
end: new CalendarDate(new Date().getFullYear(), 1, 12).add({ days: 30 }),
})
return (
<RangeCalendar
value={dateRange}
onChange={setDateRange}
numberOfMonths={2}
className="rounded-lg border"
/>
)
}
Month and Year Selector#
Use captionLayout="dropdown" to show month and year dropdowns.
November 2026
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 1 | 2 | 3 | 4 | 5 |
"use client"
import { Calendar } from "@/components/ui/calendar""use client"
import { Calendar } from "@/components/ui/calendar"
export function CalendarCaption() {
return <Calendar captionLayout="dropdown" className="rounded-lg border" />
}
Presets#
November 2026
January 2026
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 |
"use client"
import * as React from "react""use client"
import * as React from "react"
import { CalendarDate, getLocalTimeZone, today } from "@internationalized/date"
import { Button } from "@/components/ui/button"
import { Calendar } from "@/components/ui/calendar"
import { Card, CardContent, CardFooter } from "@/components/ui/card"
export function CalendarWithPresets() {
const [date, setDate] = React.useState<CalendarDate | undefined>(
new CalendarDate(new Date().getFullYear(), 2, 12)
)
const [currentMonth, setCurrentMonth] = React.useState<CalendarDate>(
new CalendarDate(new Date().getFullYear(), new Date().getMonth() + 1, 1)
)
return (
<Card className="mx-auto w-fit max-w-[300px]" size="sm">
<CardContent>
<Calendar
value={date}
onChange={setDate}
focusedValue={currentMonth}
onFocusChange={setCurrentMonth}
weeksInMonth={6}
className="p-0 [--cell-size:--spacing(9.5)]"
/>
</CardContent>
<CardFooter className="flex flex-wrap gap-2 border-t">
{[
{ label: "Today", value: 0 },
{ label: "Tomorrow", value: 1 },
{ label: "In 3 days", value: 3 },
{ label: "In a week", value: 7 },
{ label: "In 2 weeks", value: 14 },
].map((preset) => (
<Button
key={preset.value}
variant="outline"
size="sm"
className="flex-1"
onPress={() => {
const newDate = today(getLocalTimeZone()).add({
days: preset.value,
})
setDate(newDate)
setCurrentMonth(newDate)
}}
>
{preset.label}
</Button>
))}
</CardFooter>
</Card>
)
}
Date and Time Picker#
November 2026
January 2026
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 1 | 2 | 3 | 4 | 5 |
"use client"
import * as React from "react""use client"
import * as React from "react"
import { CalendarDate } from "@internationalized/date"
import { Clock2Icon } from "lucide-react"
import { Calendar } from "@/components/ui/calendar"
import { Card, CardContent, CardFooter } from "@/components/ui/card"
import { Field, FieldGroup, FieldLabel } from "@/components/ui/field"
import {
InputGroup,
InputGroupAddon,
InputGroupInput,
} from "@/components/ui/input-group"
export function CalendarWithTime() {
const [date, setDate] = React.useState<CalendarDate | undefined>(
new CalendarDate(new Date().getFullYear(), new Date().getMonth() + 1, 12)
)
return (
<Card size="sm" className="mx-auto w-fit">
<CardContent>
<Calendar value={date} onChange={setDate} className="p-0" />
</CardContent>
<CardFooter className="border-t bg-card">
<FieldGroup>
<Field>
<FieldLabel htmlFor="time-from">Start Time</FieldLabel>
<InputGroup>
<InputGroupInput
id="time-from"
type="time"
step="1"
defaultValue="10:30:00"
className="appearance-none [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none"
/>
<InputGroupAddon>
<Clock2Icon className="text-muted-foreground" />
</InputGroupAddon>
</InputGroup>
</Field>
<Field>
<FieldLabel htmlFor="time-to">End Time</FieldLabel>
<InputGroup>
<InputGroupInput
id="time-to"
type="time"
step="1"
defaultValue="12:30:00"
className="appearance-none [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none"
/>
<InputGroupAddon>
<Clock2Icon className="text-muted-foreground" />
</InputGroupAddon>
</InputGroup>
</Field>
</FieldGroup>
</CardFooter>
</Card>
)
}
Booked dates#
February 2026
February 2026
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
"use client"
import * as React from "react""use client"
import * as React from "react"
import { CalendarDate, isSameDay } from "@internationalized/date"
import { Calendar } from "@/components/ui/calendar"
import { Card, CardContent } from "@/components/ui/card"
export function CalendarBookedDates() {
const [date, setDate] = React.useState<CalendarDate | undefined>(
new CalendarDate(new Date().getFullYear(), 2, 3)
)
const bookedDates = Array.from(
{ length: 15 },
(_, i) => new CalendarDate(new Date().getFullYear(), 2, 12 + i)
)
return (
<Card className="mx-auto w-fit p-0">
<CardContent className="p-0">
<Calendar
value={date}
onChange={setDate}
isDateUnavailable={(date) =>
bookedDates.some((d) => isSameDay(date, d))
}
/>
</CardContent>
</Card>
)
}
Custom Cell Size#
December 2026
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
29 | 30 | 1$100 | 2$100 | 3$100 | 4$100 | 5$120 |
6$120 | 7$100 | 8$100 | 9$100 | 10$100 | 11$100 | 12$120 |
13$120 | 14$100 | 15$100 | 16$100 | 17$100 | 18$100 | 19$120 |
20$120 | 21$100 | 22$100 | 23$100 | 24$100 | 25$100 | 26$120 |
27$120 | 28$100 | 29$100 | 30$100 | 31$100 | 1 | 2 |
"use client"
import * as React from "react""use client"
import * as React from "react"
import { CalendarDate, isWeekend } from "@internationalized/date"
import { useLocale, type DateRange } from "react-aria-components"
import { RangeCalendar } from "@/components/ui/calendar"
import { Card, CardContent } from "@/components/ui/card"
export function CalendarCustomDays() {
const { locale } = useLocale()
const [range, setRange] = React.useState<DateRange | undefined>({
start: new CalendarDate(new Date().getFullYear(), 12, 8),
end: new CalendarDate(new Date().getFullYear(), 12, 8).add({ days: 10 }),
})
return (
<Card className="mx-auto w-fit p-0">
<CardContent className="p-0">
<RangeCalendar
value={range}
onChange={setRange}
numberOfMonths={1}
captionLayout="dropdown"
className="[--cell-size:--spacing(10)] md:[--cell-size:--spacing(12)]"
headerFormat={{ month: "long" }}
renderCell={({ isOutsideMonth, date, defaultChildren }) => (
<>
{defaultChildren}
{!isOutsideMonth && (
<span>{isWeekend(date, locale) ? "$120" : "$100"}</span>
)}
</>
)}
/>
</CardContent>
</Card>
)
}
You can customize the size of calendar cells using the --cell-size CSS variable. You can also make it responsive by using breakpoint-specific values:
<Calendar
value={date}
onChange={setDate}
className="rounded-lg border [--cell-size:--spacing(11)] md:[--cell-size:--spacing(12)]"
/>Or use fixed values:
<Calendar
value={date}
onChange={setDate}
className="rounded-lg border [--cell-size:2.75rem] md:[--cell-size:3rem]"
/>RTL#
To enable RTL support in shadcn/ui, see the RTL configuration guide.
See also the International Calendars Guide for enabling the international calendars such as Persian / Hijri / Jalali.
نوفمبر 2026
| س | ح | ن | ث | ر | خ | ج |
|---|---|---|---|---|---|---|
31 | 1 | 2 | 3 | 4 | 5 | 6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 1 | 2 | 3 | 4 |
"use client"
import * as React from "react"// You will notice this example uses dir and data-lang attributes. // This is because this site is not RTL by default. // In your application, you won't need these.// See the RTL guide for more information.
"use client"
import * as React from "react"
import {
getLocalTimeZone,
today,
type CalendarDate,
} from "@internationalized/date"
import { I18nProvider } from "react-aria-components"
import { Calendar } from "@/components/ui/calendar"
export function CalendarRtl() {
const [date, setDate] = React.useState<CalendarDate | undefined>(
today(getLocalTimeZone())
)
return (
<I18nProvider locale="ar">
<Calendar
value={date}
onChange={setDate}
className="rounded-lg border [--cell-size:--spacing(9)]"
captionLayout="dropdown"
/>
</I18nProvider>
)
}
API Reference#
See the React Aria documentation for more information on the Calendar component.