1. Docs
  2. components
  3. Calendar

Calendar

A calendar displays one or more date grids and allows users to select a single date.

February 2025

26
27
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
1

Installation

Copy and paste the following code into your project.

Update the import paths to match your project setup.

Usage

Single import

import { Button } from "~/components/ui/button";
import { Calendar } from "~/components/ui/calendar";
<Calendar.Root>
  <Calendar.Header>
    <Calendar.Nav>
      <Button slot="previous"></Button>
      <Calendar.Month />
      <Button slot="next"></Button>
    </Calendar.Nav>
  </Calendar.Header>
 
  <Calendar.Grid>
    <Calendar.GridHeader>
      {(weekDay) => <Calendar.HeaderCell>{weekDay}</Calendar.HeaderCell>}
    </Calendar.GridHeader>
    <Calendar.GridBody>
      {(date) => <Calendar.Cell date={date} />}
    </Calendar.GridBody>
  </Calendar.Grid>
</Calendar.Root>

Multiple imports

import { Button } from "~/components/ui/button";
import {
  CalendarCell,
  CalendarGrid,
  CalendarGridBody,
  CalendarGridHeader,
  CalendarHeader,
  CalendarHeaderCell,
  CalendarMonth,
  CalendarNav,
  CalendarRoot,
} from "~/components/ui/calendar";
<CalendarRoot>
  <CalendarHeader>
    <CalendarNav>
      <Button slot="previous"></Button>
      <CalendarMonth />
      <Button slot="next"></Button>
    </CalendarNav>
  </CalendarHeader>
 
  <CalendarGrid>
    <CalendarGridHeader>
      {(weekDay) => <CalendarHeaderCell>{weekDay}</CalendarHeaderCell>}
    </CalendarGridHeader>
    <CalendarGridBody>
      {(date) => <CalendarCell date={date} />}
    </CalendarGridBody>
  </CalendarGrid>
</CalendarRoot>