A flexible calendar grid component for displaying months. Fully customizable through render callbacks for both header cells (weekday names) and day cells.
| Prop | Type | Default | Description |
|---|---|---|---|
| date | Date | Required | The month to display (uses year and month from this date) |
| header | (props) => JSX.Element | Required | Render function for weekday header cells |
| cell | (props) => JSX.Element | Required | Render function for day cells |
| jss | JSS | - | Custom styles for the calendar grid |
| Property | Type | Description |
|---|---|---|
| weekday | string | Localized weekday abbreviation (Mon, Tue, etc.) |
| Property | Type | Description |
|---|---|---|
| date | Date | The date for this cell |
| today | boolean | Whether this date is today |
| outOfMonth | boolean | Whether this date is outside the current month |
| top | boolean | Whether this cell is in the top row |
| bottom | boolean | Whether this cell is in the bottom row |
| left | boolean | Whether this cell is in the leftmost column |
| right | boolean | Whether this cell is in the rightmost column |
<Calendar
date={new Date()}
header={({ weekday }) => (
<Box padding="small" jss={{ textAlign: "center" }}>
<Span bold color="secondary" size="small">
{weekday}
</Span>
</Box>
)}
cell={({ today, date, outOfMonth }) => (
<Box padding="small" jss={{ opacity: outOfMonth ? 0.3 : 1 }}>
{today && <Badge color="highlight" />}
<Span>{date.getDate()}</Span>
</Box>
)}
/>
<Calendar
date={new Date()}
header={({ weekday }) => (
<Box>
<H3>{weekday}</H3>
</Box>
)}
cell={({ today, date, outOfMonth }) => (
<Box relative={true} jss={{ opacity: outOfMonth ? 0.2 : 1 }}>
{today && (
<Badge
jss={{
position: "absolute",
top: "50%",
transform: "translateY(-50%) translateX(-75%)",
right: "50%",
}}
/>
)}
<Span>{date.getDate()}</Span>
</Box>
)}
/>
The cell render props include position information for styling borders and corners:
<Calendar
date={new Date()}
header={({ weekday }) => <Span>{weekday}</Span>}
cell={({ date, outOfMonth, top, bottom, left, right }) => (
<Box
jss={{
opacity: outOfMonth ? 0.3 : 1,
borderTop: top ? "1px solid var(--divider)" : "none",
borderBottom: bottom ? "1px solid var(--divider)" : "none",
borderLeft: left ? "1px solid var(--divider)" : "none",
borderRight: right ? "1px solid var(--divider)" : "none",
borderTopLeftRadius: top && left ? 8 : 0,
borderTopRightRadius: top && right ? 8 : 0,
borderBottomLeftRadius: bottom && left ? 8 : 0,
borderBottomRightRadius: bottom && right ? 8 : 0,
}}
>
<Span>{date.getDate()}</Span>
</Box>
)}
/>
Calendar remains a low-level rendering primitive for schedules and custom month views. Use DateInput for form entry and date selection; it adds locale-aware segments, constraints, a calendar popover, keyboard navigation, and focus management.
The Calendar uses CSS Grid with 7 columns (Mon-Sun). The header row and day cells flow naturally into the grid:
// Custom grid styling
<Calendar
date={new Date()}
jss={{
gap: 4,
padding: 16,
backgroundColor: "var(--secondary-background)",
borderRadius: 12,
}}
header={...}
cell={...}
/>
Weekday names are automatically localized using Intl.DateTimeFormat with UK English locale (week starts Monday). The calendar always displays Monday through Sunday.