Calendar
A month grid for picking a date or a range.
In Brand expressive
See it live
npm run storybookWhen to use it
In Brand expressive: Inside a popover on an event site, when visitors pick a date near today. Not always shown in a section.
- Use it when: Dates near today, ranges, or when the day of the week matters.
- Not when: A date people know by heart, such as a birth date: typed fields are faster.
Instead:
- Date picker: A calendar opened from a field, in a popover.
- Input: A known date typed in.
Words
- Headlines are short and bold. Three to six words.
- Verbs that move: Join, Try, Go.
- Playful in headlines, plain in errors.
- Use: Join, Drop, Go, Love. Avoid: Synergy, Leverage, Kindly.
The labels components use, from the voice tokens:
content.action.commit: Gocontent.action.cancel: Not nowcontent.action.destroy: Removecontent.action.retry: Try againcontent.action.empty-action: Explore the drop
See Voice and tone for the whole voice.
Accessibility and keyboard
| Keyboard | What happens | Not |
|---|---|---|
| undefined | Arrow keys move between days; Page Up and Page Down change month. | undefined |
Test before you ship:
- It is a grid; the selected and today's dates are announced. undefined
Use it in code
npx open-ds add calendar
The component reads only component keys and semantic tokens, so it follows the brand and mode on <html>.
Tokens it reads
Calendar reads 31 tokens of its own, each an alias of a semantic token. Each row is one part: its own token, the semantic it aliases, and the value it ends at. Change a semantic and every component that reads it follows; override one of Calendar's tokens to change Calendar alone.
Brand expressive decides what changes when you switch theme. Here a switch changes colors only, so the marked rows differ between light and dark; everything else holds steady.
| Part | Its token and the semantic it aliases | Value |
|---|---|---|
| Calendar | ||
| Fill Changes with theme | component.calendar.backgroundcolor.surface.canvasvar(--calendar-background) | Lighttaupe.light.50:#FFF8F3Darktaupe.dark.0:#120B09 |
| Padding | component.calendar.paddingcomponent-spacing-map.x3var(--calendar-padding) | space.24:1.5rem |
| Gap | component.calendar.gapspace.gap.groupvar(--calendar-gap) | space.40:2.5rem |
| Gap 2 | component.calendar.gap-2space.gap.tightvar(--calendar-gap-2) | space.8:0.5rem |
| Disabled opacity disabled when disabled | component.calendar.disabled-opacity-disabledopacity.disabledvar(--calendar-disabled-opacity-disabled) | opacity.40:0.4 |
| Gap 3 | component.calendar.gap-3component-spacing-map.x2var(--calendar-gap-3) | space.8:0.5rem |
| Text size | component.calendar.font-sizetype.body.font-sizevar(--calendar-font-size) | font.size.17:1.0625rem |
| Weight | component.calendar.font-weighttype.label.font-weightvar(--calendar-font-weight) | font.weight.700:700 |
| Corner | component.calendar.radiusradius.controlvar(--calendar-radius) | radius.999:9999px |
| Border Changes with theme | component.calendar.bordercolor.border.strongvar(--calendar-border) | Lighttaupe.light.500:#8A6F63Darktaupe.dark.400:#B5988A |
| Shadow Changes with theme | component.calendar.shadowelevation.cardvar(--calendar-shadow) | Lightshadow.cardDarkshadow.card-dark |
| Border 2 Changes with theme | component.calendar.border-2color.border.focusvar(--calendar-border-2) | Lightpink.light.600:#D61F7ADarkpink.dark.600:#F59ACA |
| Focus | component.calendar.focusborder-width.focusvar(--calendar-focus) | border-width.3:3px |
| Focus ring Changes with theme | component.calendar.focus-ringcolor.border.focusvar(--calendar-focus-ring) | Lightpink.light.600:#D61F7ADarkpink.dark.600:#F59ACA |
| Focus ring offset Changes with theme | component.calendar.focus-ring-offsetcolor.surface.canvasvar(--calendar-focus-ring-offset) | Lighttaupe.light.50:#FFF8F3Darktaupe.dark.0:#120B09 |
| Background 2 Changes with theme | component.calendar.background-2color.surface.raisedvar(--calendar-background-2) | Lighttaupe.light.0:#FFFFFFDarktaupe.dark.100:#33241F |
| Height | component.calendar.heightsize.control.defaultvar(--calendar-height) | size.52:3.25rem |
| Padding right | component.calendar.padding-rightcomponent-spacing-map.x1var(--calendar-padding-right) | space.4:0.25rem |
| Padding left | component.calendar.padding-leftcomponent-spacing-map.x2var(--calendar-padding-left) | space.8:0.5rem |
| Text Changes with theme | component.calendar.labelcolor.text.mutedvar(--calendar-label) | Lighttaupe.light.600:#6B544ADarktaupe.dark.400:#B5988A |
| Font weight 2 | component.calendar.font-weight-2type.body.font-weightvar(--calendar-font-weight-2) | font.weight.400:400 |
| Background 3 Changes with theme | component.calendar.background-3color.surface.sunkenvar(--calendar-background-3) | Lighttaupe.light.100:#FCEFE6Darktaupe.dark.100:#33241F |
| Label 2 Changes with theme | component.calendar.label-2color.text.primaryvar(--calendar-label-2) | Lighttaupe.light.900:#1F1411Darktaupe.dark.900:#FFF8F3 |
| Label selected Changes with theme when selected | component.calendar.label-selectedcolor.text.mutedvar(--calendar-label-selected) | Lighttaupe.light.600:#6B544ADarktaupe.dark.400:#B5988A |
| Disabled opacity | component.calendar.disabled-opacityopacity.disabledvar(--calendar-disabled-opacity) | opacity.40:0.4 |
| Icon size | component.calendar.icon-sizesize.iconvar(--calendar-icon-size) | size.20:1.25rem |
| Background 4 Changes with theme | component.calendar.background-4color.action.primaryvar(--calendar-background-4) | Lightpink.light.600:#D61F7ADarkpink.dark.600:#F59ACA |
| Label 3 Changes with theme | component.calendar.label-3color.text.on-actionvar(--calendar-label-3) | Lighttaupe.light.0:#FFFFFFDarktaupe.light.900:#1F1411 |
| Background selected Changes with theme when selected | component.calendar.background-selectedcolor.action.primaryvar(--calendar-background-selected) | Lightpink.light.600:#D61F7ADarkpink.dark.600:#F59ACA |
| Label selected 2 Changes with theme when selected | component.calendar.label-selected-2color.text.on-actionvar(--calendar-label-selected-2) | Lighttaupe.light.0:#FFFFFFDarktaupe.light.900:#1F1411 |
| Font size 2 | component.calendar.font-size-2type.caption.font-sizevar(--calendar-font-size-2) | font.size.14:0.875rem |
| From the system | ||
| Edge Changes with theme | color.border.default straight from the system, through --border | Lighttaupe.light.200 · #F2DCCFDarktaupe.dark.100 · #33241F |
| Corner | radius.control straight from the system, through --radius-md | radius.999 · 9999px |