Skip to main content

Calendar

A month grid for picking a date or a range.

In Multi-brand

See it live​

Start Storybook to see it live: npm run storybook

When to use it​

In Multi-brand: A date near today or a range, shown at once, where the day of the week matters. Not a birth date; type it.

  • 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​

  • Shared structure: object, state, next step.
  • Brand tone lives in headlines and marketing copy, not in errors.
  • Errors and confirmations read the same in every brand.
  • Use: Get started, Plan, Order. Avoid: Brand-specific words in errors, Jargon.

The labels components use, from the voice tokens:

  • content.action.commit: Save
  • content.action.cancel: Cancel
  • content.action.destroy: Remove
  • content.action.retry: Try again
  • content.action.empty-action: Get started

See Voice and tone for the whole voice.

Accessibility and keyboard​

KeyboardWhat happensNot
undefinedArrow 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.

Changes with theme

Multi-brand decides what changes when you switch theme. Here a switch changes colors, type and shape, so the marked rows differ between its brands and between light and dark; everything else holds steady.

PartIts token and the semantic it aliasesValue
Calendar
Fill
Changes with theme
component.calendar.backgroundcolor.surface.canvasvar(--calendar-background)Aster Lightslate-deep.light.50:#F8FAFCAster Darkslate-deep.dark.0:#020617Birch Lightslate-deep.light.50:#F8FAFCBirch Darkslate-deep.dark.0:#020617Coral Lightslate-deep.light.50:#F8FAFCCoral Darkslate-deep.dark.0:#020617
Paddingcomponent.calendar.paddingcomponent-spacing-map.x3var(--calendar-padding)space.20:1.25rem
Gapcomponent.calendar.gapspace.gap.groupvar(--calendar-gap)space.24:1.5rem
Gap 2component.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 3component.calendar.gap-3component-spacing-map.x2var(--calendar-gap-3)space.8:0.5rem
Text sizecomponent.calendar.font-sizetype.body.font-sizevar(--calendar-font-size)font.size.16:1rem
Weightcomponent.calendar.font-weighttype.label.font-weightvar(--calendar-font-weight)font.weight.600:600
Corner
Changes with theme
component.calendar.radiusradius.controlvar(--calendar-radius)Aster Lightradius.4:0.25remAster Darkradius.4:0.25remBirch Lightradius.12:0.75remBirch Darkradius.12:0.75remCoral Lightradius.999:9999pxCoral Darkradius.999:9999px
Border
Changes with theme
component.calendar.bordercolor.border.strongvar(--calendar-border)Aster Lightslate-deep.light.500:#64748BAster Darkslate-deep.dark.400:#96A3B5Birch Lightslate-deep.light.500:#64748BBirch Darkslate-deep.dark.400:#96A3B5Coral Lightslate-deep.light.500:#64748BCoral Darkslate-deep.dark.400:#96A3B5
Shadow
Changes with theme
component.calendar.shadowelevation.cardvar(--calendar-shadow)Aster Lightshadow.cardAster Darkshadow.card-darkBirch Lightshadow.cardBirch Darkshadow.card-darkCoral Lightshadow.cardCoral Darkshadow.card-dark
Border 2
Changes with theme
component.calendar.border-2color.border.focusvar(--calendar-border-2)Aster Lightteal.light.600:#0F766EAster Darkteal.dark.600:#7FCFC6Birch Lightpurple.light.600:#6D28D9Birch Darkpurple.dark.600:#B79DF7Coral Lightorange.light.600:#C2410CCoral Darkorange.dark.600:#F7A67F
Focuscomponent.calendar.focusborder-width.focusvar(--calendar-focus)border-width.2:2px
Focus ring
Changes with theme
component.calendar.focus-ringcolor.border.focusvar(--calendar-focus-ring)Aster Lightteal.light.600:#0F766EAster Darkteal.dark.600:#7FCFC6Birch Lightpurple.light.600:#6D28D9Birch Darkpurple.dark.600:#B79DF7Coral Lightorange.light.600:#C2410CCoral Darkorange.dark.600:#F7A67F
Focus ring offset
Changes with theme
component.calendar.focus-ring-offsetcolor.surface.canvasvar(--calendar-focus-ring-offset)Aster Lightslate-deep.light.50:#F8FAFCAster Darkslate-deep.dark.0:#020617Birch Lightslate-deep.light.50:#F8FAFCBirch Darkslate-deep.dark.0:#020617Coral Lightslate-deep.light.50:#F8FAFCCoral Darkslate-deep.dark.0:#020617
Background 2
Changes with theme
component.calendar.background-2color.surface.raisedvar(--calendar-background-2)Aster Lightslate-deep.light.0:#FFFFFFAster Darkslate-deep.dark.100:#1E293BBirch Lightslate-deep.light.0:#FFFFFFBirch Darkslate-deep.dark.100:#1E293BCoral Lightslate-deep.light.0:#FFFFFFCoral Darkslate-deep.dark.100:#1E293B
Heightcomponent.calendar.heightsize.control.defaultvar(--calendar-height)size.44:2.75rem
Padding rightcomponent.calendar.padding-rightcomponent-spacing-map.x1var(--calendar-padding-right)space.4:0.25rem
Padding leftcomponent.calendar.padding-leftcomponent-spacing-map.x2var(--calendar-padding-left)space.8:0.5rem
Text
Changes with theme
component.calendar.labelcolor.text.mutedvar(--calendar-label)Aster Lightslate-deep.light.600:#4B5A6FAster Darkslate-deep.dark.400:#96A3B5Birch Lightslate-deep.light.600:#4B5A6FBirch Darkslate-deep.dark.400:#96A3B5Coral Lightslate-deep.light.600:#4B5A6FCoral Darkslate-deep.dark.400:#96A3B5
Font weight 2component.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)Aster Lightslate-deep.light.100:#F1F5F9Aster Darkslate-deep.dark.100:#1E293BBirch Lightslate-deep.light.100:#F1F5F9Birch Darkslate-deep.dark.100:#1E293BCoral Lightslate-deep.light.100:#F1F5F9Coral Darkslate-deep.dark.100:#1E293B
Label 2
Changes with theme
component.calendar.label-2color.text.primaryvar(--calendar-label-2)Aster Lightslate-deep.light.900:#0F172AAster Darkslate-deep.dark.900:#F8FAFCBirch Lightslate-deep.light.900:#0F172ABirch Darkslate-deep.dark.900:#F8FAFCCoral Lightslate-deep.light.900:#0F172ACoral Darkslate-deep.dark.900:#F8FAFC
Label selected
Changes with theme
when selected
component.calendar.label-selectedcolor.text.mutedvar(--calendar-label-selected)Aster Lightslate-deep.light.600:#4B5A6FAster Darkslate-deep.dark.400:#96A3B5Birch Lightslate-deep.light.600:#4B5A6FBirch Darkslate-deep.dark.400:#96A3B5Coral Lightslate-deep.light.600:#4B5A6FCoral Darkslate-deep.dark.400:#96A3B5
Disabled opacitycomponent.calendar.disabled-opacityopacity.disabledvar(--calendar-disabled-opacity)opacity.40:0.4
Icon sizecomponent.calendar.icon-sizesize.iconvar(--calendar-icon-size)size.16:1rem
Background 4
Changes with theme
component.calendar.background-4color.action.primaryvar(--calendar-background-4)Aster Lightteal.light.600:#0F766EAster Darkteal.dark.600:#7FCFC6Birch Lightpurple.light.600:#6D28D9Birch Darkpurple.dark.600:#B79DF7Coral Lightorange.light.600:#C2410CCoral Darkorange.dark.600:#F7A67F
Label 3
Changes with theme
component.calendar.label-3color.text.on-actionvar(--calendar-label-3)Aster Lightslate-deep.light.0:#FFFFFFAster Darkslate-deep.light.900:#0F172ABirch Lightslate-deep.light.0:#FFFFFFBirch Darkslate-deep.light.900:#0F172ACoral Lightslate-deep.light.0:#FFFFFFCoral Darkslate-deep.light.900:#0F172A
Background selected
Changes with theme
when selected
component.calendar.background-selectedcolor.action.primaryvar(--calendar-background-selected)Aster Lightteal.light.600:#0F766EAster Darkteal.dark.600:#7FCFC6Birch Lightpurple.light.600:#6D28D9Birch Darkpurple.dark.600:#B79DF7Coral Lightorange.light.600:#C2410CCoral Darkorange.dark.600:#F7A67F
Label selected 2
Changes with theme
when selected
component.calendar.label-selected-2color.text.on-actionvar(--calendar-label-selected-2)Aster Lightslate-deep.light.0:#FFFFFFAster Darkslate-deep.light.900:#0F172ABirch Lightslate-deep.light.0:#FFFFFFBirch Darkslate-deep.light.900:#0F172ACoral Lightslate-deep.light.0:#FFFFFFCoral Darkslate-deep.light.900:#0F172A
Font size 2component.calendar.font-size-2type.caption.font-sizevar(--calendar-font-size-2)font.size.13:0.8125rem
From the system
Edge
Changes with theme
color.border.default
straight from the system, through --border
Aster Lightslate-deep.light.200 · #E2E8F0Aster Darkslate-deep.dark.100 · #1E293BBirch Lightslate-deep.light.200 · #E2E8F0Birch Darkslate-deep.dark.100 · #1E293BCoral Lightslate-deep.light.200 · #E2E8F0Coral Darkslate-deep.dark.100 · #1E293B
Corner
Changes with theme
radius.control
straight from the system, through --radius-md
Aster Lightradius.4 · 0.25rem (4px)Aster Darkradius.4 · 0.25rem (4px)Birch Lightradius.12 · 0.75rem (12px)Birch Darkradius.12 · 0.75rem (12px)Coral Lightradius.999 · 9999pxCoral Darkradius.999 · 9999px