Calendar
A month grid for picking one day, several, or a span โ and for showing which days cannot be picked before anyone clicks.
Calendar
One send date, with the weekend closed by policy. The four states a day grid has to tell apart each carry a mark as well as a colour โ a solid fill for selected, a bold numeral for today, a faded rank for last month, a strike-through for a day nobody can pick.
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
Wednesday 9 December
Weekends are struck through: the sending policy holds outbound mail until Monday.
Usage
import { Calendar, CalendarDayButton } from '@oceanic-hub/brand-system'Composition
Use the following composition to build a Calendar:
Calendar
โโโ CalendarDayButtonReach for it when the shape of the month is part of the decision: which days are still free, where the weekend falls, how long a span turns out to be. When the reader already knows the date โ copying it off an invoice, typing a birthday โ a field is faster and a grid is a detour.
Leave the mode off entirely and it is a legal, read-only month grid: nothing is selectable, which is how you render a schedule you do not want clicked. Upstream's docs never mention it.
Almost every shadcn date-picker snippet on the internet is written against an older engine, and
this one is deliberately pinned to react-day-picker 10. The names that moved: navigation bounds
are startMonth / endMonth, and fromYear / toYear are gone with no replacement;
initialFocus is autoFocus; the caption's old buttons layout is what label does now,
because navigation left the caption; the two icon slots are one Chevron that takes an
orientation; and the classNames keys are the engine's own enum โ button_previous,
month_caption, range_middle โ not the old day_selected family. Each of those is pinned
as a compile error in the contract test rather than quietly ignored, because a date picker that
opens unfocused is not a mistake a keyboard user can work around. The one that costs nothing to
get wrong: a dropdown caption with no bounds offers a hundred years, since the engine defaults
startMonth to a century ago.
Four states have to be told apart at a glance and without colour vision โ selected, today, outside the month, unavailable โ so each carries a mark as well as a tint: a solid fill, a bold numeral, a faded rank, a strike-through. Remove one of those marks and two pairs of states are separated by a pale wash alone.
A date picker is this inside a Popover, and it is not shown here on purpose: a portalled
panel covers the page documenting it, so the composition is on Popover's page, in its Date
picker section, rather than this one. Upstream's date-and-time example is the same shape โ this beside an Input of type
time โ and teaches nothing about the grid. Its time-zone example is really an SSR recipe: sample
the zone in an effect, never while rendering, or the server and the client disagree and the whole
grid remounts. The engine's timeZone prop does pass through, and it is marked experimental
upstream; treat it that way.
The Persian / Hijri / Jalali calendar is not available. Upstream imports it from a
react-day-picker/persian entry point that version 10 does not ship โ what it has is a Persian
locale (Persian words over a Gregorian month) and a numeral system (Persian digits over Gregorian
dates), and neither of those is the Jalali calendar. It would also be this package's first
right-to-left surface, and RTL is not supported: the refusal is recorded in pairings.json
under direction, and upstream's two chevron-flipping selectors went with it.
The day cell is 36px, not upstream's 32px --cell-size: it is Button's own icon square
โ one of three, against icon-sm's 32px and icon-lg's 48px โ so a day and an icon button
agree by construction instead of by coincidence.
Range
Two ends and everything between them, across as many months as the span needs. The band lives on the CELL rather than the day button, so it runs unbroken through the zero-gap grid while the two ends stay filled buttons โ reach for it whenever the answer is a period rather than a day.
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
14 days of agent runs will be aggregated.
Multiple days
A set rather than a span, capped with max. Reach for it when the days are independent choices โ three maintenance windows, the days of the week a report should run โ and not the two ends of one period, which is what the range above is for.
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
2 of 3 chosen. The grid stops accepting a fourth.
Month and year
Turn the caption into two dropdowns when the date is far from today โ an invoice from two years ago, a start date next spring โ so nobody clicks the arrow eighteen times. Always bound the navigation: unbounded, the year list runs back a full century, which is the engine's default and almost never what the surface means.
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
Three years of invoices are on file, so the dropdowns offer three years and no more.
Unavailable days
One vocabulary covers every way of saying "not this one": a list of dates, an open-ended interval, a day of the week. An unavailable day is struck through as well as faded, so the state survives a reader who cannot see the fade โ and it stays on screen rather than disappearing, because a day that vanishes reads as a rendering bug.
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
Three days are booked, the past is closed and weekends are out of hours โ three matchers, one prop.
Presets
Put the common answers beside the grid when most choices are relative to today. A preset has to move the month on show as well as the selection โ otherwise "in 3 months" quietly selects a day the reader is not looking at, and the grid appears to have ignored the click.
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
Week numbers
Add the week column when the work is planned in weeks rather than dates โ a release train, a payroll run, a sprint. The numbering follows the locale's week index by default, so a surface that means the ISO week has to say so rather than assume it.
| Mo | Tu | We | Th | Fr | Sa | Su | |
|---|---|---|---|---|---|---|---|
49 | |||||||
50 | |||||||
51 | |||||||
52 | |||||||
53 |
ISO weeks, so the column agrees with the release calendar the team already reads.
A mark on a day
Replace the day button and give it a second line โ a count, a price, a load โ when the grid has to answer "how busy is that day?" as well as "which day?". CalendarDayButton is exported for exactly this, so the decoration inherits the focus handling and the state marks instead of re-implementing them, and the second line is ranked by SIZE rather than by another colour. This one takes no selection mode at all, which is the read-only month grid: a picture of the month, with nothing to click.
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
| 29 | 30 | 1 | 2 | 3 | 4 | 5 |
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 | 31 | 1 | 2 |
The second line is agent runs that day. Weekends read zero, which is the point of putting it in the grid at all.
API Reference
See the Calendar API page for every prop of every part, with types, defaults and the contract that pins them.