Theme builder
Change the calendar's tokens in light and dark, see them live, and copy the CSS or a StyleX theme.
Pick a preset or change a token, and the calendar follows. Light and dark have their own values: the preview starts in the docs' theme, and Light and Dark above it switch the theme you see and edit. Your changes stay in the preview, and nothing is saved.
Calendar colors, light
Events, light
Events without a palette color use these, such as the standups in the week. A palette color derives its own from a hue and a chroma, below.
Event palette
Availability, light
Density
Base colors, light
The shadcn/ui tokens. Calendar tokens such as grid lines and event fills derive from them until you set those.
CSS
/* No changes: the theme is calendar-theme.css as it ships. */
Paste the CSS into your app
The CSS has the shape of calendar-theme.css: tokens inside @layer base, light values on
:root and dark ones on .dark. Paste it at the end of your global CSS, after the calendar's own
rules (the @layer base rules shadcn add wrote there, or the line that imports
calendar-theme.css), so it comes later in the same layer and wins. A shading recipe comes after
the tokens, outside the layer, as on Availability.
- Changed tokens copies what differs from the theme as it ships. A token you changed only in
light mode is restated in
.darktoo, so the dark theme keeps its own value. - All tokens copies the whole theme, so your CSS restates every token.
Rules your app writes outside a layer win over the pasted ones: its own shadcn theme, or overrides like those in Changing tokens. Change those tokens there instead.
Use the StyleX theme
Below the preview, Tailwind + shadcn gives the CSS above and StyleX gives a theme for the StyleX flavour. The preview is the Tailwind-rendered calendar either way: the views read the same tokens, so it shows your theme, and compiling StyleX inside these docs isn't worth it. The Monochrome preset sets every base color, as an app does that maps its design system's colors onto the calendar's.
Paste the code into a file of your own, then apply the theme on a wrapper around the calendar. The calendar's popovers, tooltips and toasts open inside it, in the browser's top layer, so the theme reaches them too:
import * as stylex from "@stylexjs/stylex";
import { calendarTheme } from "./calendar-theme";
<div {...stylex.props(calendarTheme)}>
<TeamCalendar meetings={meetings} />
</div>;- Changed tokens copies what differs from the theme as it ships, in either mode, with one value
for both through
light-dark(). It adds the tokens that read one you changed: on a wrapper they'd keep the value they got on:root. So changing--primaryalso restates--calendar-event-border. - All tokens copies the whole theme. It pins the base colors too, so they stop following a mapping of your design system's colors.
- A palette color you changed, or any change to what the colors derive, comes as each color's three
tokens, such as
--calendar-event-blue, with the hue and chroma filled in. - A shading recipe comes last, in a comment: StyleX can't select the closed-time band, so it goes in your global CSS.
What you can change
- Colors. The tokens in Theming, and the shadcn tokens under Base
colors. Many calendar tokens derive from those: grid lines are
var(--border), and the default event fill mixes--primaryinto--background. A derived token follows its source until you set it.--calendar-surfaceisn't here: it's unset, and you set it on a container, as Theming shows. - Density. The hour height and the event padding in time grids, and
--radius, which rounds events, buttons and badges. - Availability. The tints for closed time and closed days, a shading recipe for closed time in time grids, the busy and free dots, and the outlines of changes the policies reject or flag. The recipes are the ones on Availability, but the tint stays the Closed time token's.
- Event palette. Each color's hue and chroma, and how every color derives its fill, text and edge from them, per theme. To add a color, see Adding a color.
Contrast checks, as the preview paints them, the pairs the theme's own test holds to WCAG AA on the background, plus body text and the hour labels: 4.5:1 for text, 3:1 for the now line, the focus ring and the status marks. When event text falls short, it names the palette color with the lowest contrast.
Menus, tooltips and popovers open outside the preview, in the docs' own theme. A light preview on
a dark page also keeps a few dark-mode touches of the shadcn controls, such as the Today
button's fill, since the page's dark class reaches them.