Skip to content

Material 3

Components

Calendar

Calendars show a month of days for selecting a date or a range of dates.

9:30
New eventChoose a date

Event date, June 2025

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

Calendars let people select a date, or a range of dates, on a grid of days, without an input or a dialog around it. Compose your own calendar from the parts on this page, in a Calendar or a RangeCalendar. For a complete picker, with a header and a date input, use a date picker.

import {
  Calendar,
  CalendarCell,
  CalendarGrid,
  CalendarGridBody,
  CalendarGridHeader,
  CalendarHeaderCell,
  CalendarHeading,
  CalendarMenuButton,
  CalendarMonthPicker,
  CalendarMonths,
  CalendarPage,
  CalendarWeekdays,
  CalendarYearPicker,
  RangeCalendar,
} from '@material-web/react'
import { parseDate } from '@internationalized/date'

Basic calendar

A Calendar selects one date. Write its parts as its children, and name it with an aria-label. This one has the layout of a date picker's calendar: see Layout.

Event date, August 2025

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
29
30
31
1
2
3
4
5
6
import { parseDate } from '@internationalized/date'
import {
  Calendar,
  CalendarCell,
  CalendarGrid,
  CalendarGridBody,
  CalendarHeaderCell,
  CalendarMenuButton,
  CalendarPage,
  CalendarWeekdays,
  CalendarYearPicker,
  Icon,
  IconButton,
} from '@material-web/react'

export default function Basic() {
  return (
    <Calendar aria-label="Event date" defaultValue={parseDate('2025-08-17')} className="w-90">
      <div className="calendar-nav">
        <CalendarMenuButton />
        <div className="calendar-nav-arrows">
          <span className="calendar-arrow-slot">
            <IconButton slot="previous" aria-label="Previous month">
              <Icon name="chevron_left" className="rtl:icon-mirrored" />
            </IconButton>
          </span>
          <span className="calendar-arrow-slot">
            <IconButton slot="next" aria-label="Next month">
              <Icon name="chevron_right" className="rtl:icon-mirrored" />
            </IconButton>
          </span>
        </div>
      </div>
      <div className="calendar-body">
        <div className="calendar-days">
          <CalendarWeekdays>
            {(day) => <CalendarHeaderCell>{day}</CalendarHeaderCell>}
          </CalendarWeekdays>
          <CalendarPage>
            <CalendarGrid>
              <CalendarGridBody>{(date) => <CalendarCell date={date} />}</CalendarGridBody>
            </CalendarGrid>
          </CalendarPage>
        </div>
        <CalendarYearPicker />
      </div>
    </Calendar>
  )
}

Range calendar

Use a RangeCalendar to select a range of dates, such as the dates of a flight or of a hotel stay: the first day pressed starts the range, and the second ends it. Its grids highlight the range between its ends.

Trip dates, 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

2025-02-03 to 2025-02-12

import { parseDate } from '@internationalized/date'
import {
  CalendarCell,
  CalendarGrid,
  CalendarGridBody,
  CalendarHeaderCell,
  CalendarMenuButton,
  CalendarPage,
  CalendarWeekdays,
  CalendarYearPicker,
  Icon,
  IconButton,
  RangeCalendar,
} from '@material-web/react'
import { useState } from 'react'
import type { DateValue, RangeValue } from 'react-aria-components'

export default function Range() {
  const [range, setRange] = useState<RangeValue<DateValue>>({
    start: parseDate('2025-02-03'),
    end: parseDate('2025-02-12'),
  })
  return (
    <div className="flex w-90 flex-col gap-space-100">
      <RangeCalendar aria-label="Trip dates" value={range} onChange={setRange}>
        <div className="calendar-nav">
          <CalendarMenuButton />
          <div className="calendar-nav-arrows">
            <span className="calendar-arrow-slot">
              <IconButton slot="previous" aria-label="Previous month">
                <Icon name="chevron_left" className="rtl:icon-mirrored" />
              </IconButton>
            </span>
            <span className="calendar-arrow-slot">
              <IconButton slot="next" aria-label="Next month">
                <Icon name="chevron_right" className="rtl:icon-mirrored" />
              </IconButton>
            </span>
          </div>
        </div>
        <div className="calendar-body">
          <div className="calendar-days">
            <CalendarWeekdays>
              {(day) => <CalendarHeaderCell>{day}</CalendarHeaderCell>}
            </CalendarWeekdays>
            <CalendarPage>
              <CalendarGrid>
                <CalendarGridBody>{(date) => <CalendarCell date={date} />}</CalendarGridBody>
              </CalendarGrid>
            </CalendarPage>
          </div>
          <CalendarYearPicker />
        </div>
      </RangeCalendar>
      <p className="m-0 px-space-300 text-body-md text-on-surface-variant">
        {range.start.toString()} to {range.end.toString()}
      </p>
    </div>
  )
}

Composition

A Calendar and a RangeCalendar hold the other parts as their children, and take the same parts.

React Aria parts

These parts take the same props as the parts of the same name in React Aria's Calendar and RangeCalendar, and are composed the same way:

PartInUse
CalendarGridThe calendar or a CalendarPageShows a month, with its seven columns spread evenly across its width. Pass it a function that returns a CalendarCell for a date, and it shows a CalendarGridHeader of CalendarHeaderCells above a CalendarGridBody of those cells.
CalendarCellCalendarGridShows a day. Return it from the function of a CalendarGrid or a CalendarGridBody. Its children are the day's number by default.
CalendarHeadingThe calendar or a CalendarPageThe heading of a month, as above each month of a range

This example uses these parts alone: a CalendarHeading between the previous and next buttons, above a CalendarGrid with a function as its children. The days of the adjacent months are dimmed.

Event date, August 2025

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
29
30
31
1
2
3
4
5
6
import { parseDate } from '@internationalized/date'
import {
  Calendar,
  CalendarCell,
  CalendarGrid,
  CalendarHeading,
  Icon,
  IconButton,
} from '@material-web/react'

export default function Anatomy() {
  return (
    <Calendar aria-label="Event date" defaultValue={parseDate('2025-08-17')} className="w-90">
      <div className="flex items-center justify-between px-space-150">
        <IconButton slot="previous" aria-label="Previous month">
          <Icon name="chevron_left" className="rtl:icon-mirrored" />
        </IconButton>
        <CalendarHeading className="p-0" />
        <IconButton slot="next" aria-label="Next month">
          <Icon name="chevron_right" className="rtl:icon-mirrored" />
        </IconButton>
      </div>
      <div className="px-space-150">
        <CalendarGrid>{(date) => <CalendarCell date={date} />}</CalendarGrid>
      </div>
    </Calendar>
  )
}

M3 parts

These parts are specific to this library:

PartInUse
CalendarWeekdaysThe calendarShows the days of the week once above a calendar's grids, so that they stay in place while the days page or scroll
CalendarPageThe calendarHolds what the previous and next buttons page through. It is as tall as six weeks, or as its content when that is taller.
CalendarMonthsThe calendarShows the months of the calendar's visibleDuration in a scrolling column, under a CalendarWeekdays. See Months in a column.
CalendarMenuButtonThe calendarOpens a picker over the days: the years (the default), or the months with picker="month"
CalendarYearPickerThe calendarA grid of years. See Month and year pickers.
CalendarMonthPickerThe calendarA menu of months. See Month and year pickers.

Layout

Lay the parts out with the calendar's classes. This is the layout of the date picker's calendar:

<Calendar aria-label="Event date">
  <div className="calendar-nav">
    <CalendarMenuButton />
    <div className="calendar-nav-arrows">
      <span className="calendar-arrow-slot">
        <IconButton slot="previous" aria-label="Previous month">
          <Icon name="chevron_left" />
        </IconButton>
      </span>
      <span className="calendar-arrow-slot">
        <IconButton slot="next" aria-label="Next month">
          <Icon name="chevron_right" />
        </IconButton>
      </span>
    </div>
  </div>
  <div className="calendar-body">
    <div className="calendar-days">
      <CalendarWeekdays>{(day) => <CalendarHeaderCell>{day}</CalendarHeaderCell>}</CalendarWeekdays>
      <CalendarPage>
        <CalendarGrid>
          <CalendarGridBody>{(date) => <CalendarCell date={date} />}</CalendarGridBody>
        </CalendarGrid>
      </CalendarPage>
    </div>
    <CalendarYearPicker />
  </div>
</Calendar>
ClassUse
calendar-navThe navigation row, with the menu button at its start.
calendar-nav-arrowsHolds the previous and next buttons at the end of the row, and hides them in place while a picker is open.
calendar-arrow-slotHolds one of these buttons, in its middle.
calendar-bodyThe area under the navigation row. It is as tall as the days of the week and six weeks of days, whatever the month, and a picker covers it while open.
calendar-daysHolds the days of the week and the page, and hides the days of the adjacent months.

A calendar is as wide as the element that holds it. Give it a width with a class, such as w-90 for 360dp.

Slots

  1. previous
  2. next
  3. errorMessage
SlotChildUse
previousAny button, such as an icon buttonThe previous button, which pages back
nextAny buttonThe next button, which pages forward
errorMessageA TextThe error message. See Invalid selection.

Note: Inside a calendar, a button without a slot throws an error. Give any other button slot={null}.

Month and year pickers

A CalendarMenuButton opens a picker over the days: the years (the default), or the months with picker="month". Its label is the month and year shown, unless you give it children. CalendarYearPicker is a grid of years, and CalendarMonthPicker is a menu of months. Each opens from its menu button and closes when a year or a month is chosen, which the calendar then shows.

A picker covers the element that holds it. Put it next to the days, in your own element with position: relative, such as one with the calendar-body class.

Shift+M moves the focus to the months' menu button, and Shift+Y to the years'. With one menu button, both move the focus to it. On a keyboard layout without Latin letters, use the keys in the places of M and Y on a US keyboard. Escape in a picker closes the picker alone, not what is around the calendar.

This example has a menu button for each picker. Their labels are written from the state that the Calendar passes to a function as its children:

Event date, August 2025

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
29
30
31
1
2
3
4
5
6
import { DateFormatter, parseDate } from '@internationalized/date'
import {
  Calendar,
  CalendarCell,
  CalendarGrid,
  CalendarGridBody,
  CalendarHeaderCell,
  CalendarMenuButton,
  CalendarMonthPicker,
  CalendarPage,
  CalendarWeekdays,
  CalendarYearPicker,
  Icon,
  IconButton,
} from '@material-web/react'
import { useLocale } from 'react-aria-components'

export default function Menus() {
  const { locale } = useLocale()
  const month = new DateFormatter(locale, { month: 'short' })
  const year = new DateFormatter(locale, { year: 'numeric' })
  return (
    <Calendar aria-label="Event date" defaultValue={parseDate('2025-08-17')} className="w-90">
      {({ state }) => {
        const shown = state.visibleRange.start.toDate(state.timeZone)
        return (
          <>
            <div className="calendar-nav gap-space-100">
              <CalendarMenuButton picker="month">{month.format(shown)}</CalendarMenuButton>
              <CalendarMenuButton picker="year">{year.format(shown)}</CalendarMenuButton>
              <div className="calendar-nav-arrows">
                <span className="calendar-arrow-slot">
                  <IconButton slot="previous" aria-label="Previous month">
                    <Icon name="chevron_left" className="rtl:icon-mirrored" />
                  </IconButton>
                </span>
                <span className="calendar-arrow-slot">
                  <IconButton slot="next" aria-label="Next month">
                    <Icon name="chevron_right" className="rtl:icon-mirrored" />
                  </IconButton>
                </span>
              </div>
            </div>
            <div className="calendar-body">
              <div className="calendar-days">
                <CalendarWeekdays>
                  {(day) => <CalendarHeaderCell>{day}</CalendarHeaderCell>}
                </CalendarWeekdays>
                <CalendarPage>
                  <CalendarGrid>
                    <CalendarGridBody>{(date) => <CalendarCell date={date} />}</CalendarGridBody>
                  </CalendarGrid>
                </CalendarPage>
              </div>
              <CalendarMonthPicker />
              <CalendarYearPicker />
            </div>
          </>
        )
      }}
    </Calendar>
  )
}

Controlled

Pass dates as CalendarDate objects from @internationalized/date, as parseDate returns for a string such as 2025-08-17. Set the initial date with defaultValue, or control it with value and onChange, which is called with the date when a day is selected.

Event date, August 2025

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
29
30
31
1
2
3
4
5
6

2025-08-17

import { parseDate } from '@internationalized/date'
import {
  Calendar,
  CalendarCell,
  CalendarGrid,
  CalendarHeading,
  CalendarPage,
  Icon,
  IconButton,
} from '@material-web/react'
import { useState } from 'react'
import type { DateValue } from 'react-aria-components'

export default function Controlled() {
  const [date, setDate] = useState<DateValue>(parseDate('2025-08-17'))
  return (
    <div className="flex w-90 flex-col gap-space-100">
      <Calendar aria-label="Event date" value={date} onChange={setDate}>
        <div className="calendar-nav">
          <CalendarHeading className="p-0" />
          <div className="calendar-nav-arrows">
            <span className="calendar-arrow-slot">
              <IconButton slot="previous" aria-label="Previous month">
                <Icon name="chevron_left" className="rtl:icon-mirrored" />
              </IconButton>
            </span>
            <span className="calendar-arrow-slot">
              <IconButton slot="next" aria-label="Next month">
                <Icon name="chevron_right" className="rtl:icon-mirrored" />
              </IconButton>
            </span>
          </div>
        </div>
        <div className="calendar-days">
          <CalendarPage>
            <CalendarGrid>{(date) => <CalendarCell date={date} />}</CalendarGrid>
          </CalendarPage>
        </div>
      </Calendar>
      <p className="m-0 px-space-300 text-body-md text-on-surface-variant">{date.toString()}</p>
    </div>
  )
}

A RangeCalendar takes the same props. Its value is a { start, end } pair of CalendarDate objects, and its onChange is called once the second day ends the range. The range calendar above is controlled.

Initial month

A calendar opens at the month of its value, or at the current month when it has none. To open at another month, set defaultFocusedValue to a date in that month.

To move the calendar from your own code, control the focused date with focusedValue and onFocusChange: the calendar shows the month of that date. See React Aria's Controlling the focused date.

This calendar opens at April 2022 with no date selected, and its Today button moves it to the current month.

Event date, April 2022

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
29
30
import { getLocalTimeZone, parseDate, today } from '@internationalized/date'
import {
  Button,
  Calendar,
  CalendarCell,
  CalendarGrid,
  CalendarHeading,
  CalendarPage,
  Icon,
  IconButton,
} from '@material-web/react'
import { useState } from 'react'

export default function Focused() {
  const [focused, setFocused] = useState(parseDate('2022-04-17'))
  return (
    <div className="flex w-90 flex-col items-center gap-space-200">
      <Button variant="outlined" onPress={() => setFocused(today(getLocalTimeZone()))}>
        Today
      </Button>
      <Calendar aria-label="Event date" focusedValue={focused} onFocusChange={setFocused}>
        <div className="calendar-nav">
          <CalendarHeading className="p-0" />
          <div className="calendar-nav-arrows">
            <span className="calendar-arrow-slot">
              <IconButton slot="previous" aria-label="Previous month">
                <Icon name="chevron_left" className="rtl:icon-mirrored" />
              </IconButton>
            </span>
            <span className="calendar-arrow-slot">
              <IconButton slot="next" aria-label="Next month">
                <Icon name="chevron_right" className="rtl:icon-mirrored" />
              </IconButton>
            </span>
          </div>
        </div>
        <div className="calendar-days">
          <CalendarPage>
            <CalendarGrid>{(date) => <CalendarCell date={date} />}</CalendarGrid>
          </CalendarPage>
        </div>
      </Calendar>
    </div>
  )
}

Form props

Set isDisabled to disable a calendar: its days and its buttons are dimmed, they cannot be pressed or focused, and the selected date is not marked. Set isReadOnly to keep the value as it is: the days can be focused and the months paged, but a press on a day selects nothing.

Disabled, August 2025

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
29
30
31
1
2
3
4
5
6

Read-only, August 2025

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
29
30
31
1
2
3
4
5
6
import { parseDate } from '@internationalized/date'
import {
  Calendar,
  CalendarCell,
  CalendarGrid,
  CalendarHeading,
  CalendarPage,
  Icon,
  IconButton,
} from '@material-web/react'

function Parts() {
  return (
    <>
      <div className="calendar-nav">
        <CalendarHeading className="p-0" />
        <div className="calendar-nav-arrows">
          <span className="calendar-arrow-slot">
            <IconButton slot="previous" aria-label="Previous month">
              <Icon name="chevron_left" className="rtl:icon-mirrored" />
            </IconButton>
          </span>
          <span className="calendar-arrow-slot">
            <IconButton slot="next" aria-label="Next month">
              <Icon name="chevron_right" className="rtl:icon-mirrored" />
            </IconButton>
          </span>
        </div>
      </div>
      <div className="calendar-days">
        <CalendarPage>
          <CalendarGrid>{(date) => <CalendarCell date={date} />}</CalendarGrid>
        </CalendarPage>
      </div>
    </>
  )
}

export default function FormProps() {
  const date = parseDate('2025-08-17')
  return (
    <>
      <Calendar aria-label="Disabled" defaultValue={date} isDisabled className="w-90">
        <Parts />
      </Calendar>
      <Calendar aria-label="Read-only" defaultValue={date} isReadOnly className="w-90">
        <Parts />
      </Calendar>
    </>
  )
}

Validation

Set minValue and maxValue to limit the dates that can be selected. Pass isDateUnavailable to mark days as unavailable: they are struck out, and can be focused with the keyboard but not selected.

Set allowsNonContiguousRanges on a RangeCalendar to let a range run over unavailable days. These days are left out of the selection, and of the highlight of the range.

Trip dates, 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
import { parseDate } from '@internationalized/date'
import {
  CalendarCell,
  CalendarGrid,
  CalendarHeading,
  CalendarPage,
  Icon,
  IconButton,
  RangeCalendar,
} from '@material-web/react'
import type { DateValue } from 'react-aria-components'

const booked = [
  [parseDate('2025-02-11'), parseDate('2025-02-12')],
  [parseDate('2025-02-20'), parseDate('2025-02-22')],
] as const

const isBooked = (date: DateValue) =>
  booked.some(([start, end]) => date.compare(start) >= 0 && date.compare(end) <= 0)

export default function Unavailable() {
  return (
    <div className="w-90">
      <RangeCalendar
        aria-label="Trip dates"
        defaultValue={{ start: parseDate('2025-02-06'), end: parseDate('2025-02-14') }}
        minValue={parseDate('2025-02-04')}
        isDateUnavailable={isBooked}
        allowsNonContiguousRanges
      >
        <div className="calendar-nav">
          <CalendarHeading className="p-0" />
          <div className="calendar-nav-arrows">
            <span className="calendar-arrow-slot">
              <IconButton slot="previous" aria-label="Previous month">
                <Icon name="chevron_left" className="rtl:icon-mirrored" />
              </IconButton>
            </span>
            <span className="calendar-arrow-slot">
              <IconButton slot="next" aria-label="Next month">
                <Icon name="chevron_right" className="rtl:icon-mirrored" />
              </IconButton>
            </span>
          </div>
        </div>
        <div className="calendar-days">
          <CalendarPage>
            <CalendarGrid>{(date) => <CalendarCell date={date} />}</CalendarGrid>
          </CalendarPage>
        </div>
      </RangeCalendar>
    </div>
  )
}

Invalid selection

A calendar is invalid when you set isInvalid, or when its value is outside the bounds or on an unavailable day. It then shows its selected day or its range in the error colors. For an error message under the days, put a Text from react-aria-components in the errorMessage slot, and render it while the calendar is invalid.

Stay, 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
Maximum stay duration is 1 week
import { parseDate } from '@internationalized/date'
import {
  CalendarCell,
  CalendarGrid,
  CalendarHeading,
  CalendarPage,
  Icon,
  IconButton,
  RangeCalendar,
} from '@material-web/react'
import { useState } from 'react'
import { Text, type DateValue, type RangeValue } from 'react-aria-components'

export default function Invalid() {
  const [range, setRange] = useState<RangeValue<DateValue>>({
    start: parseDate('2025-02-06'),
    end: parseDate('2025-02-18'),
  })
  const isInvalid = range.end.compare(range.start) > 7
  return (
    <div className="w-90">
      <RangeCalendar aria-label="Stay" value={range} onChange={setRange} isInvalid={isInvalid}>
        <div className="calendar-nav">
          <CalendarHeading className="p-0" />
          <div className="calendar-nav-arrows">
            <span className="calendar-arrow-slot">
              <IconButton slot="previous" aria-label="Previous month">
                <Icon name="chevron_left" className="rtl:icon-mirrored" />
              </IconButton>
            </span>
            <span className="calendar-arrow-slot">
              <IconButton slot="next" aria-label="Next month">
                <Icon name="chevron_right" className="rtl:icon-mirrored" />
              </IconButton>
            </span>
          </div>
        </div>
        <div className="calendar-days">
          <CalendarPage>
            <CalendarGrid>{(date) => <CalendarCell date={date} />}</CalendarGrid>
          </CalendarPage>
        </div>
        {isInvalid && <Text slot="errorMessage">Maximum stay duration is 1 week</Text>}
      </RangeCalendar>
    </div>
  )
}

Localization

A calendar formats its dates for the locale, which also sets the calendar system, the first day of the week, the names and digits of the days, months and years, and the direction the arrow keys move. To set a locale, wrap the calendar in an I18nProvider from react-aria-components. See Internationalization.

  • First day of the week: Set firstDayOfWeek on the calendar to start the week on another day than the locale's, as in firstDayOfWeek="mon".
  • Days of the week: Set weekdayStyle on a CalendarGrid or a CalendarWeekdays to narrow (the default), short or long, for names such as S, Sun or Sunday.
  • Direction: A calendar follows the page's dir. Make it agree with the locale, so that the days run in the direction the arrow keys move.
  • Calendar systems: See React Aria's International calendars and Custom calendar systems.

For more on the locale and the direction, see Text and locale on the date picker page.

Customization

Pass classes in className to restyle a part: each part takes its own. See Styling for the classes, the states and the theme.

  • States: A CalendarCell reports the states of its day. Style one with its variant, such as selected:, unavailable: or outside-month:. See States.
  • Functions: className, style and the children of a Calendar, a RangeCalendar and a CalendarCell can be functions of its state. See Children as a function.

Months side by side

To show several months side by side, set visibleDuration on the calendar, and put a CalendarHeading and a CalendarGrid for each month in one CalendarPage, each with an offset from the first month. The previous and next buttons page through all the months at once, or by one month with pageBehavior="single".

Trip dates, February to March 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
23
24
25
26
27
28
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
1
2
3
4
5
import { parseDate } from '@internationalized/date'
import {
  CalendarCell,
  CalendarGrid,
  CalendarHeading,
  CalendarPage,
  Icon,
  IconButton,
  RangeCalendar,
} from '@material-web/react'

export default function Months() {
  return (
    <RangeCalendar
      aria-label="Trip dates"
      defaultValue={{ start: parseDate('2025-02-24'), end: parseDate('2025-03-05') }}
      visibleDuration={{ months: 2 }}
    >
      <div className="calendar-nav">
        <div className="calendar-nav-arrows">
          <span className="calendar-arrow-slot">
            <IconButton slot="previous" aria-label="Previous">
              <Icon name="chevron_left" className="rtl:icon-mirrored" />
            </IconButton>
          </span>
          <span className="calendar-arrow-slot">
            <IconButton slot="next" aria-label="Next">
              <Icon name="chevron_right" className="rtl:icon-mirrored" />
            </IconButton>
          </span>
        </div>
      </div>
      <div className="calendar-days">
        <CalendarPage className="flex flex-wrap gap-x-space-300">
          {[0, 1].map((months) => (
            <div key={months} className="min-w-60 flex-1">
              <CalendarHeading offset={{ months }} />
              <CalendarGrid offset={{ months }}>
                {(date) => <CalendarCell date={date} />}
              </CalendarGrid>
            </div>
          ))}
        </CalendarPage>
      </div>
    </RangeCalendar>
  )
}

selectionAlignment sets where the month of the value is among them when the calendar opens: start, center (the default) or end.

Months in a column

CalendarMonths shows the months of the calendar's visibleDuration in a scrolling column, each under its CalendarHeading. It starts scrolled to the focused month. Put it under a CalendarWeekdays in a RangeCalendar, as in this example:

Trip dates, September 2024 to August 2026

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
29
30
31
1
2
3
4
5
6
import { parseDate } from '@internationalized/date'
import {
  CalendarHeaderCell,
  CalendarMonths,
  CalendarWeekdays,
  RangeCalendar,
} from '@material-web/react'

export default function Scrolling() {
  return (
    <div className="flex h-140 w-90 flex-col">
      <RangeCalendar
        aria-label="Trip dates"
        defaultValue={{ start: parseDate('2025-08-17'), end: parseDate('2025-08-23') }}
        visibleDuration={{ months: 24 }}
      >
        <CalendarWeekdays>
          {(day) => <CalendarHeaderCell>{day}</CalendarHeaderCell>}
        </CalendarWeekdays>
        <CalendarMonths />
      </RangeCalendar>
    </div>
  )
}

Custom day rendering

To draw a day yourself, pass a function as the children of its CalendarCell. It is called with the state of the day, such as formattedDate, the number of the day in the locale, isSelected and isToday. This example marks the days that have an event with a dot:

Event date, August 2025

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
29
30
31
1
2
3
4
5
6
import { parseDate } from '@internationalized/date'
import {
  Calendar,
  CalendarCell,
  CalendarGrid,
  CalendarHeading,
  CalendarPage,
  Icon,
  IconButton,
} from '@material-web/react'

const events = ['2025-08-05', '2025-08-14', '2025-08-17', '2025-08-22']

export default function CustomDay() {
  return (
    <Calendar aria-label="Event date" defaultValue={parseDate('2025-08-17')} className="w-90">
      <div className="calendar-nav">
        <CalendarHeading className="p-0" />
        <div className="calendar-nav-arrows">
          <span className="calendar-arrow-slot">
            <IconButton slot="previous" aria-label="Previous month">
              <Icon name="chevron_left" className="rtl:icon-mirrored" />
            </IconButton>
          </span>
          <span className="calendar-arrow-slot">
            <IconButton slot="next" aria-label="Next month">
              <Icon name="chevron_right" className="rtl:icon-mirrored" />
            </IconButton>
          </span>
        </div>
      </div>
      <div className="calendar-days">
        <CalendarPage>
          <CalendarGrid>
            {(date) => (
              <CalendarCell date={date}>
                {({ formattedDate }) => (
                  <>
                    {formattedDate}
                    {events.includes(date.toString()) && (
                      <span className="absolute inset-x-0 bottom-space-50 mx-auto size-1 rounded-shape-full bg-current" />
                    )}
                  </>
                )}
              </CalendarCell>
            )}
          </CalendarGrid>
        </CalendarPage>
      </div>
    </Calendar>
  )
}