EXEPERTAI LAB

Research alpha

Time Machine
EXEPERTAI LAB
GALLERY / COLLECTION
← Browse Astryx gallery
Calendar·component·@astryxdesign/core

Calendar

Calendar lets the user pick a date or date range from a month grid. Use it in booking flows, scheduling UIs, date filters, or anywhere the user needs to see surrounding dates for context.

Open in Playground @astryxdesign/core/Calendar

Showcases and examples

5 documented examples

Calendar

An interactive single-date calendar with a selected date. Click any day to change the selection.

Preview loads on approachPreview loads on approach
Exact source · calendar-showcase
// Copyright (c) Meta Platforms, Inc. and affiliates.

'use client';

import {useState} from 'react';
import {Calendar} from '@astryxdesign/core/Calendar';
import type {ISODateString} from '@astryxdesign/core/Calendar';

export default function CalendarShowcase() {
  const [value, setValue] = useState<ISODateString | undefined>('2026-04-15');

  return <Calendar mode="single" value={value} onChange={setValue} />;
}

Usage

Calendar lets the user pick a date or date range from a month grid. Use it in booking flows, scheduling UIs, date filters, or anywhere the user needs to see surrounding dates for context.

  • Set min and max dates to limit selection to a valid window, like only future dates for a booking or the current quarter for a report.
  • Use range mode when the user needs to pick a start and end date, like a trip or a time-off request.
  • Use dateConstraints to disable specific dates like weekends or holidays, and explain why they are unavailable.
  • Show two months side by side when the user frequently selects dates that span a month boundary.
  • Use a calendar for dates far in the past or future like a birth date. A text input is faster for open-ended entry.
  • Disable large blocks of dates without context. The user should understand why dates are unavailable.

Typed props

PropType and behavior
mode'single' | 'range' · default 'single'
Selection mode.
valueISODateString | DateRange
Controlled selected value.
defaultValueISODateString | DateRange
Uncontrolled default value.
onChangeFunction
Selection callback.
numberOfMonths1 | 2 · default 1
Number of months to display.
minISODateString
Minimum selectable date.
maxISODateString
Maximum selectable date.
dateConstraintsArray<(date: Date) => boolean>
Custom constraint functions.
maxRangeSpannumber
Range mode: max days a range may span, both endpoints counted (7 = a 7-day window). Caps the window from the picked start; before a start is picked every day stays selectable.
minRangeSpannumber
Range mode: min days a range must span, both endpoints counted (2 forbids a single-day range). Clicking the start again commits a one-day range when allowed, or cancels the in-progress selection when the minimum is longer. Default 1.
focusDateISODateString
Controlled visible month. Unset, the calendar opens on the selected date, else on today clamped into the min/max window.
onFocusDateChange(focusDate: ISODateString) => void
Navigation callback.
handleRefReact.Ref<CalendarHandle>
Imperative handle for calendar navigation, including navigateTo().
hasOutsideDaysboolean · default true
Show days from adjacent months.
hasWeekNumbersboolean · default false
Show ISO week numbers.
hasVariableRowCountboolean · default false
Variable vs fixed 6-row grid.
weekStartsOn0 | 1 | 2 | 3 | 4 | 5 | 6 | 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat' · default 0
First day of week. Accepts a number (0=Sunday) or a three-letter day name (e.g. "mon").

Anatomy

Month header · required

The month name and year with navigation arrows to move between months. The arrows mirror automatically under dir="rtl".

Day grid · required

A 7-column grid of days with column headers for the day names.

Selected day · optional

The currently selected date, highlighted. In range mode, the start and end dates plus the days between them.

Today marker · optional

A subtle indicator on the current date for orientation.

Theming

Targets

astryx-calendar

Visual props: mode

astryx-calendar-nav

Visual props: nav

States: disabled

astryx-calendar-day

States: selected, today, disabled, in-range, marker