suiss/ui · Component
Calendar
A month-grid date picker for selecting a single date, several dates or a date range.
Calendar is an open-source component from suiss/ui for React, React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.
Calendar is a styled wrapper around DayPicker from react-day-picker, so it accepts the full DayPicker API, including mode, selected, onSelect, numberOfMonths, captionLayout, disabled and showWeekNumber. It replaces the day cells with CalendarDayButton, which renders each day as a Button and styles today, single selections and range start, middle and end.
Use a calendar when people need to see dates in context, such as availability or a stay range. Place it inside a Popover to build a compact date picker; the calendar's background becomes transparent inside popover and card content.
Installation
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
Usage
Examples
Sizes
Use the size prop to change the cell size and type scale. This compares the sm, default and lg sizes.
Range
Set mode="range" to select a range. This selects seven days across two months; numberOfMonths={2} shows two months side by side on wider screens.
Dropdown caption
Set captionLayout to dropdown, dropdown-months or dropdown-years to let people jump to a month or year directly. The default is label.
Week numbers
Set showWeekNumber to show the week number at the start of each row.
Disabled days
Pass disabled with a matcher, such as { dayOfWeek: [0, 6] }, to block days. This disables weekends.
Accessibility
- Each month renders as a
gridlabelled with its month and year; selected days setaria-selectedon their cell. - Arrow keys move focus between days, and clicking or pressing a day selects it.
- The navigation buttons are labelled for the next and previous month.
- Disabled days render disabled buttons.
- Caption dropdowns are native
selectelements labelled for month and year.
API Reference
Calendar
The date grid, with month navigation and caption.
| Prop | Type | Default |
|---|---|---|
buttonVariant | React.ComponentProps<typeof Button>["variant"] | "plain" |
size | "sm" | "default" | "lg" | "default" |
Also accepts the props of DayPicker from react-day-picker.
Set mode to single, multiple or range, and control the selection with selected and onSelect. buttonVariant is the Button variant of the previous and next month buttons. size sets the --cell-size and --cell-radius custom properties. Unlike the DayPicker default, outside days are hidden unless you pass showOutsideDays, and the default locale is enUS. Pass classNames to override any react-day-picker class key; your values replace the defaults for that key. Navigation chevrons flip in right-to-left layouts.
The calendar reads today's date while it renders, and so does new Date() in your own state. In a Next.js app with cacheComponents, that stops the prerender of the page: wrap the calendar in <Suspense>, or pass today and fixed dates.
CalendarDayButton
The button rendered for each day, styled by its selection state.
Also accepts the props of DayButtonProps from react-day-picker.
Use CalendarDayButton when you supply your own components and still want the library's day styling. Day buttons expose data-day, data-today, data-selected-single, data-range-start, data-range-middle and data-range-end; the root sets data-slot="calendar" and data-size.
Web preview
Calendar renders one or more month grids with a caption, previous and next buttons, weekday headers and pressable day cells. Selection mode is set with mode: single, multiple or range. Ranges are drawn as a continuous shaded band with filled start and end days.
Three sizes are available: sm, default and lg. The caption can be a plain label or month and year dropdowns built on Select, which suits birth dates and other dates far from today.
Installation
- Install the following dependencies:
-
Copy the primitives it uses into
components/primitives:
- Copy and paste the following code into
components/ui/calendar.tsx:
- Update the import paths to match your project setup.
- Install the following dependencies:
-
Copy the primitives it uses into
components/primitives:
- Copy and paste the following code into
components/ui/calendar.tsx:
- Update the import paths to match your project setup.
- Install the following dependencies:
-
Copy the primitives it uses into
components/primitives:
- Copy and paste the following code into
components/ui/calendar.tsx:
- Update the import paths to match your project setup.
-
Target iOS 17 or later.
-
Add the Swift package to your app:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Add the files to your app target.
- Apply the Compose compiler plugin, enable Compose, set
compileSdkto 37 or higher andminSdkto 24 or higher, and add the dependencies:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Update the
com.esuiss.uipackage names to match your project.
Usage
Examples
Sizes
The sm, default and lg sizes.
Web preview
Range
Range selection across two months. Use numberOfMonths to show several months.
Web preview
Multiple
Several separate dates selected with mode="multiple".

Dropdown caption
Month and year dropdowns in the caption, set with captionLayout.
Web preview
Week numbers
Week numbers in a leading column, shown with showWeekNumber.
Web preview
Disabled days
Use disabled with date matchers, such as { dayOfWeek: [0, 6] }, to block days. This disables weekends.
Web preview
Outside days
Days from adjacent months shown with showOutsideDays.

Button variants
Use buttonVariant to set the variant of the navigation buttons. This shows ghost, secondary and tinted.

Locale
Turkish month and weekday names with locale="tr-TR".
Set locale for month and weekday names, and weekStartsOn to change the first day of the week.

Accessibility
- Each month is a
gridlabelled with its caption. - Day cells have the
buttonrole, a full date label, andselectedanddisabledstate. - On React Native and Android, the previous and next buttons are labelled with the relative month in the calendar's locale, such as "Last month" and "Next month" in English. On iOS they are labelled "Previous month" and "Next month".
- Caption dropdowns are labelled "Choose the Month" and "Choose the Year".
API Reference
CalendarDayButton
Pressable day cell styled for each selection state.
Also accepts the props of React.ComponentProps<typeof CalendarPrimitive.DayButton>.
Use it for custom day rendering.
Calendar
Month grids with caption and navigation.
| Prop | Type | Default |
|---|---|---|
buttonVariant | ButtonProps["variant"] | "plain" |
size | CalendarSize | "default" |
captionLayout | CaptionLayout | "label" |
showWeekNumber | boolean | false |
Also accepts the props of React.ComponentProps<typeof CalendarPrimitive.Root>.
Pass mode (single, multiple or range), selected and onSelect to control the selection; selected is a Date, a Date[] or a { from, to } range depending on the mode. Use month, defaultMonth and onMonthChange to control the visible month, and numberOfMonths to show several months. Limit navigation with startMonth and endMonth; with a year dropdown they default to the last 100 years. buttonVariant sets the variant of the navigation buttons, and captionLayout is label, dropdown, dropdown-months or dropdown-years. Navigation arrows swap in right-to-left layouts, and colors follow the system appearance.
DateRange
| Parameter | Type | Default |
|---|---|---|
from | Date | - |
to | Date? | nil |
| Property | Type |
|---|---|
from | Date |
to | Date? |
DateRange.adding
| Parameter | Type | Default |
|---|---|---|
_Â day | Date | - |
to | DateRange? | - |
calendar | Foundation.Calendar | - |
Returns DateRange?.
CalendarDayModifiers
| Parameter | Type | Default |
|---|---|---|
today | Bool | false |
selected | Bool | false |
rangeStart | Bool | false |
rangeMiddle | Bool | false |
rangeEnd | Bool | false |
outside | Bool | false |
disabled | Bool | false |
| Property | Type |
|---|---|
today | Bool |
selected | Bool |
rangeStart | Bool |
rangeMiddle | Bool |
rangeEnd | Bool |
outside | Bool |
disabled | Bool |
DateCalendar
| Parameter | Type | Default |
|---|---|---|
selection | Binding<Date?> | - |
month | Binding<Date>? | nil |
size | Size: .sm | .default | .lg | .default |
buttonVariant | VariantButtonStyle.Variant | .plain |
captionLayout | CaptionLayout: .label | .dropdown | .dropdownMonths | .dropdownYears | .label |
numberOfMonths | Int | 1 |
showOutsideDays | Bool | false |
showWeekNumber | Bool | false |
startMonth | Date? | nil |
endMonth | Date? | nil |
today | Date | Date() |
isDisabled | (Date) -> Bool | { _ in false } |
CalendarDayButton
The button rendered for each day, styled by its selection state.
| Parameter | Type | Default |
|---|---|---|
date | Date | - |
modifiers | CalendarDayModifiers | - |
size | DateCalendar.Size: .sm | .default | .lg | .default |
action | () -> Void | - |
CalendarSize
Values: Sm, Default, Lg.
CalendarCaptionLayout
Values: Label, Dropdown, DropdownMonths, DropdownYears.
DateRange
| Parameter | Type | Default |
|---|---|---|
from | Date? | - |
to | Date? | null |
CalendarDayState
| Parameter | Type | Default |
|---|---|---|
selected | Boolean | false |
today | Boolean | false |
rangeStart | Boolean | false |
rangeMiddle | Boolean | false |
rangeEnd | Boolean | false |
outside | Boolean | false |
disabled | Boolean | false |
Calendar
Month grids with caption and navigation.
| Parameter | Type | Default |
|---|---|---|
selected | Date? | - |
onSelect | (Date?) -> Unit | - |
modifier | Modifier | Modifier |
defaultMonth | Date? | null |
numberOfMonths | Int | 1 |
startMonth | Date? | null |
endMonth | Date? | null |
showOutsideDays | Boolean | false |
showWeekNumber | Boolean | false |
weekStartsOn | Int? | null |
disabled | (Date) -> Boolean | { false } |
today | Date | remember { Date() } |
locale | Locale | Locale.getDefault() |
buttonVariant | ButtonVariant | ButtonVariant.Plain |
size | CalendarSize: Sm | Default | Lg | CalendarSize.Default |
captionLayout | CalendarCaptionLayout: Label | Dropdown | DropdownMonths | DropdownYears | CalendarCaptionLayout.Label |
dayButton | CalendarDayButtonSlot? | null |
CalendarDayButton
The button rendered for each day, styled by its selection state.
| Parameter | Type | Default |
|---|---|---|
date | Date | - |
state | CalendarDayState | - |
onClick | () -> Unit | - |
modifier | Modifier | Modifier |
size | CalendarSize: Sm | Default | Lg | CalendarSize.Default |
locale | Locale | Locale.getDefault() |



