suiss/uim · React Native Component

Calendar

A month grid for picking a single date, several dates or a date range.

Calendar is an open-source mobile component from suiss/uim for React Native and Expo, with SwiftUI and Jetpack Compose versions built from the same design tokens. The @esuiss/uim CLI copies its source into your project, so you own the code.

iOS
Calendar on iOS in light mode

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

$ pnpm dlx @esuiss/uim@latest add calendar

The CLI also adds what it builds on: Button, Icon, Select, Text.

Manual

  1. Install the dependencies:
npx expo install cn phosphor-react-native react-native-svg
  1. Add the pieces it builds on: Button, Icon, Select, Text, and the primitives components/primitives/calendar.tsx, components/primitives/use-render.tsx.

  2. Copy the source into components/ui/calendar.tsx:

uniwind/components/ui/calendar.tsx
import { cn } from "cn"
import { CaretLeftIcon, CaretRightIcon } from "phosphor-react-native"
import * as React from "react"
import { I18nManager, ScrollView, View } from "react-native"
import * as CalendarPrimitive from "@/components/primitives/calendar"
import { resolveClassName } from "@/components/primitives/use-render"
import { Button, type ButtonProps } from "@/components/ui/button"
import { Icon } from "@/components/ui/icon"
import {
  Select,
  SelectContent,
  SelectItem,
  SelectTrigger,
  SelectValue,
} from "@/components/ui/select"
import { Text, TextClassContext } from "@/components/ui/text"
  1. Update the import paths to match your project.

Usage

import { CalendarDayButton, Calendar } from "@/components/ui/calendar"
<SingleCalendar />

Pass mode, 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.

Use disabled with date matchers, such as { dayOfWeek: [0, 6] }, to block days. Limit navigation with startMonth and endMonth; with a year dropdown they default to the last 100 years.

Set locale for month and weekday names, and weekStartsOn to change the first day of the week. CalendarDayButton is exported for custom day rendering.

Examples

Sizes

The sm, default and lg sizes.

iOS
Calendar (sizes) on iOS in light mode

Range

Range selection across two months.

iOS
Calendar (range) on iOS in light mode

Multiple

Several separate dates selected with mode="multiple".

iOS
Calendar (multiple) on iOS in light mode

Month and year dropdowns in the caption.

iOS
Calendar (dropdown caption) on iOS in light mode

Week numbers

Week numbers in a leading column.

iOS
Calendar (week numbers) on iOS in light mode

Disabled days

Weekends disabled with a dayOfWeek matcher.

iOS
Calendar (disabled days) on iOS in light mode

Outside days

Days from adjacent months shown with showOutsideDays.

iOS
Calendar (outside days) on iOS in light mode

Button variants

Navigation buttons in the ghost, secondary and tinted variants.

iOS
Calendar (button variants) on iOS in light mode

Locale

Turkish month and weekday names with locale="tr-TR".

iOS
Calendar (locale) on iOS in light mode

API Reference

CalendarDayButton

Pressable day cell styled for each selection state.

ExtendsReact.ComponentProps<typeof CalendarPrimitive.DayButton>

Calendar

Month grids with caption and navigation.

ExtendsReact.ComponentProps<typeof CalendarPrimitive.Root>
PropType
About
Button variant for the navigation buttons. Defaults to plain.
Type
ButtonProps["variant"]
Default
"plain"
About
sm, default or lg.
Type
CalendarSize
Default
"default"
About
label, dropdown, dropdown-months or dropdown-years.
Type
CaptionLayout
Default
"label"
About
Shows week numbers.
Type
boolean
Default
false

Accessibility

  • Each month is a grid labelled with its caption.
  • Day cells have the button role, a full date label, and selected and disabled state.
  • The previous and next buttons are labelled "Go to the Previous Month" and "Go to the Next Month".
  • Caption dropdowns are labelled "Choose the Month" and "Choose the Year".

Notes

  • Navigation arrows swap in right-to-left layouts.
  • Uses bg-accent, bg-accent-surface, bg-surface-secondary and text-link tokens; light and dark follow the system appearance.