CSS Variables
We use several CSS variables that you can override to customize your site.
You can create multiple classes that set these variables and switch between them to create multiple themes.
When overriding color variables, be sure to use the light-dark() CSS function in order to preserve the light/dark theme functionality.
This is a reference of all the variables you can set on the :root pseudo-class.
There are a few more that are used with specific components or utility classes;
these are grouped together at the bottom, in addition to being mentioned in the documentation for their respective class or component.
Contents:
§ Colors
--bg- Page background.
--fg- The text color.
--link-fg- The color used for hyperlinks. Defaults to
--accent. --muted-fg- Text color for disabled or de-emphasized elements. It's important that this color is readable against all of the background colors.
--faded-fg- Text for disabled interactive components.
--graphical-fg- Graphical elements like borders. Not text.
--box-bg- Background for blocks: cards, admonitions etc.
--interactive-bg- Background for interactive elements.
--pressed-interactive-bg- Background for interactive elements with
aria-pressed=trueoraria-expanded=true. --accent- Accent color. It's important that this color is readable against all of the background colors.
--muted-accent- Less vivid version of accent color. Will not be used for text.
§ Colorways
--plain-fg- Foreground color for the
.plaincolorway. --info-fg- Foreground color for the
.infocolorway. --ok-fg- Foreground color for the
.okcolorway. --bad-fg- Foreground color for the
.badcolorway. --warn-fg- Foreground color for the
.warncolorway. --plain-graphical-fg- Graphical elements (i.e. borders) color for the
.plaincolorway. --info-graphical-fg- Graphical elements (i.e. borders) color for the
.infocolorway. --ok-graphical-fg- Graphical elements (i.e. borders) color for the
.okcolorway. --bad-graphical-fg- Graphical elements (i.e. borders) color for the
.badcolorway. --warn-graphical-fg- Graphical elements (i.e. borders) color for the
.warncolorway. --plain-bg- Background color for the
.plaincolorway. --info-bg- Background color for the
.infocolorway. --ok-bg- Background color for the
.okcolorway. --bad-bg- Background color for the
.badcolorway. --warn-bg- Background color for the
.warncolorway.
§ Lengths
--rhythmVertical rhythm, line height.Deprecated: Will be removed in version 2.0. Set a value for theline-heightproperty on thehtmlelement instead.--line-length- Maximum line length for prose.
§ Borders
--border-width- Shortcut for uniform border widths on various
.boxrelated components. Defaults tounset. --border-block-start-width- Width of the "top" border.
Defaults to
--border-widthif it is set, otherwise1px. --border-block-end-width- Width of the "bottom" border.
Defaults to
--border-widthif it is set, otherwise1px. --border-inline-start-width- Width of the "left" border.
Defaults to
--border-widthif it is set, otherwise1px. --border-inline-end-width- Width of the "right" border.
Defaults to
--border-widthif it is set, otherwise1px. --border-style- Shortcut for uniform border styles on various
.boxrelated components. Defaults tounset. --border-block-start-style- Style of the "top" border.
Defaults to
--border-styleif it is set, otherwise1px. --border-block-end-style- Style of the "bottom" border.
Defaults to
--border-styleif it is set, otherwise1px. --border-inline-start-style- Style of the "left" border.
Defaults to
--border-styleif it is set, otherwise1px. --border-inline-end-style- Style of the "right" border.
Defaults to
--border-styleif it is set, otherwise1px. --border-radius- Border radius for various
.boxrelated components. Accepts any valid CSS value, e.g.1em 2emor50% 20% / 10% 40%. Defaults to0.2rem. --interactive-border-width- Border width used in buttons, inputs, etc.
Must be a single value; defaults to
1px. --interactive-border-style- Border style used in buttons, inputs, etc.
Must be a single value; defaults to
solid. --interactive-border-radius- Border radius used in buttons, inputs, etc.
Must be a single value; defaults to
0.2rem. --tab-border-radius- Border radius for the ARIA tabs component.
Must be a single value; defaults to
0.4em.
§ Button Shadows
--shadow- The value for the
box-shadowproperty on buttons. --shadow-focus- The value for the
box-shadowproperty on button with:hoveror:focus-visiblestate. --shadow-active- The value for the
box-shadowproperty on button with:activestate. --shadow-disabled- The value for the
box-shadowproperty on button with:disabledstate. --pressed-shadow- The value for the
box-shadowproperty on buttons witharia-pressed=trueoraria-expanded=true. --pressed-shadow-focus- The value for the
box-shadowproperty on buttons witharia-pressed=trueoraria-expanded=truein the:hoveror:focus-visiblestate. --pressed-shadow-active- The value for the
box-shadowproperty on buttons witharia-pressed=trueoraria-expanded=truein the:activestate.
§ Fonts
--main-font-
The main font family for text.
--secondary-font-
A secondary text font. It's a good idea to specify a sans-serif font as it will be used for buttons and captions.
--display-font-
A display font used for headings.
--mono-font-
Monospace font for code, preformatted text, computer input and output.
Tip: Browsers shrink monospace fonts. You can suppress this behavior by specifying
monospacetwice:--mono-font: "Cascadia Code", monospace, monospace
§ Markers
- The default separator for breadcrumbs.
- The separator for breadcrumbs that use
aria-current=step.
§ Density
--density- The amount of space between elements (i.e. gaps between paragraphs, padding of boxes), as a multiplier of the root line height. See Utilities / Density.
§ Component-specific variables
--flex-switch-threshold- Sets the threshold at which
.flex-switchswitches from row to column. Default is15ch. --col-width- Sets the width of a column for
.textcolumns. Default is30ch. --grid-row-width- Sets the width of a row in a
.grid. Default is1fr. --grid-col-width- Sets the width of a column in a
.grid. Default is1fr.