Import
import { Calendar } from '@strongtie/design-system/calendar' ;
Usage
< Calendar
mode = "single"
selected = { date }
onSelect = { setDate }
/>
<Calendar> Propsmode
"single" | "multiple" | "range"
default: "\"single\""
The selection mode for the calendar. Single allows one date, multiple allows multiple non-contiguous dates, and range allows selecting a date range.
selected
Date | Date[] | DateRange | undefined
The currently selected date(s). Type depends on the mode prop.
onSelect
(date: Date | Date[] | DateRange | undefined) => void
Callback fired when a date is selected. The parameter type depends on the mode prop.
Object to customize individual element class names within the calendar.
Whether to show days from adjacent months in the calendar grid.
captionLayout
"label" | "dropdown"
default: "\"label\""
Layout mode for the month/year caption. “label” shows static text, “dropdown” shows interactive dropdowns.
Custom formatters for displaying dates and other calendar elements.
Custom components to override default calendar elements.
The month to display by default when the calendar is first rendered.
Number of months to display simultaneously.
disabled
boolean | Date | Date[] | DateRange | ((date: Date) => boolean)
Dates that should be disabled and not selectable.
hidden
boolean | Date | Date[] | DateRange | ((date: Date) => boolean)
Dates that should be hidden from the calendar.
modifiers
Record<string, boolean | Date | Date[] | DateRange | ((date: Date) => boolean)>
Custom modifiers to apply styling or behavior to specific dates.
The earliest date that can be selected.
The latest date that can be selected.
The earliest month that can be navigated to.
The latest month that can be navigated to.
Styling Classes The component applies the following CSS classes:
calendar - Root calendar container
calendar-months - Container for month displays
calendar-month - Individual month container
calendar-nav - Navigation controls container
calendar-button - Navigation buttons
calendar-month-caption - Month/year caption
calendar-table - Calendar grid table
calendar-day - Individual day cells
calendar-day-button - Day selection buttons
calendar-today - Today’s date styling
calendar-selected - Selected date styling
calendar-range-start - Range start date styling
calendar-range-end - Range end date styling
calendar-range-middle - Range middle dates styling
calendar-outside - Outside month days styling
calendar-disabled - Disabled date styling
Usage Examples Basic Single Date
Month & Year
Range
function SingleDateExample () {
const [ date , setDate ] = React . useState < Date | undefined >( new Date ())
return (
< Calendar
mode = "single"
selected = { date }
onSelect = { setDate }
/>
)
}
For more examples, visit the Storybook .