Talisman LogoTalisman Logo Design System
Browse documentation
Components

Calendar

A month grid for picking one day, several days or a range, used inside the date pickers and available on its own.

Stableimport { Calendar } from "@repo/ui/calendar";Source
março 2025

Select a day to mark it. Use the arrows to change the month.

When to use

  • To show a month that is always visible on the page, such as a deadline calendar next to a form.
  • To select a range of days directly, with no field in front of it.
  • To build a new picker with its own trigger and footer.

When not to use

Selection modes

mode sets how days are chosen. selected and onSelect change type with it.

Mode selected Use for
single Date | undefined One day, such as a deadline.
multiple Date[] | undefined Several separate days, such as hearings.
range DateRange A start and an end, with the days between.

Range

março 2025
abril 2025

Multiple days

março 2025

Examples

Month and year dropdowns

captionLayout="dropdown" replaces the title with a month select and a year select. The years run from 100 years back to 10 years ahead unless you pass startMonth and endMonth.

março 2025

Disabled days

disabled takes react-day-picker matchers: a date, a list, { before }, { after } or { dayOfWeek }. Disabled days cannot be selected.

março 2025

Content

  • Pass locale. The default is English (enUS), so Portuguese products must pass ptBR from date-fns/locale.
  • Pass defaultMonth (or a controlled month) when the first month should be predictable. Without it the calendar opens on the current month.
  • Explain disabled days next to the calendar, for example “Fins de semana e feriados não estão disponíveis”.

Accessibility

  • Built on react-day-picker v9. The grid has the grid role, days are buttons, and the selected state is announced.
  • Arrow keys move between days, Home and End go to the start and end of the week, PageUp and PageDown change the month, Enter or Space select a day.
  • Disabled days are not selectable and set aria-disabled.
  • The previous and next buttons have accessible names from the locale.
  • The month and year dropdowns are native selects overlaid on the label, so they keep native keyboard and screen reader behavior.
  • A calendar shown on the page needs a visible title or a label that names its purpose, for example “Prazo fatal”.

Code

import { Calendar } from "@repo/ui/calendar";
import { ptBR } from "date-fns/locale";

const [day, setDay] = useState<Date | undefined>();

<Calendar locale={ptBR} mode="single" onSelect={setDay} selected={day} />;

Props

Calendar
PropTypeDefaultDescription
buttonVariant"ghost" | "secondary" | "tertiary"ghostButton variant of the previous and next month buttons
captionLayout"label" | "dropdown" | "dropdown-months" | "dropdown-years"labelMonth caption: plain label or month and year dropdowns
mode"single" | "multiple" | "range"—Selection mode: one day, several days or a range
numberOfMonthsnumber1Number of months shown side by side
showOutsideDaysbooleantrueShows days from the previous and next month
showWeekNumberbooleanfalseShows the week number column
weekStartsOn"0" | "1" | "2" | "3" | "4" | "5" | "6"—First day of the week, from 0 (Sunday) to 6 (Saturday)
More props
PropTypeDefaultDescription
selected, onSelectdepends on mode—Selected value and its change handler. Their types follow `mode`.
defaultMonth, month, onMonthChangeDate, Date, (month: Date) => void—First month shown, or a controlled month.
localeLocaleenUSdate-fns locale for month, weekday and label texts.
disabledMatcher | Matcher[]—Days that cannot be selected.
startMonth, endMonthDate—First and last month the user can reach. With dropdowns the defaults are 100 years back and 10 years ahead.
formatters, components, classNamesreact-day-picker props—Customization of the grid. `components` and `classNames` are merged with the defaults.
classNamestring—Extra classes for the root, for layout only.

The component also accepts every other DayPicker prop, such as min, max, modifiers and fixedWeeks. See the react-day-picker documentation.

Known issues

Issue Effect
locale defaults to enUS. A calendar without locale shows English month and weekday names in a Portuguese product.
Disabled days use opacity-50, and the secondary text of day buttons uses [&>span]:opacity-70. Opacity lowers contrast instead of using disabled tokens.
The focus ring of the focused day is ring-focus/50 and the dropdown focus ring is ring-focus/50. A translucent ring is harder to see, mainly on the Dark and Darker themes.
The dropdown range is computed from new Date() at render time. The year list shifts on January 1, so the same code lists different years in different years.
The DateTimePicker does not use this component. It has its own calendar in date-picker/calendar.tsx. Calendars in the date and time picker and in the simple date picker look and behave differently.
Edit this page on GitHub