Skip to content

CSS variables

Every value in Iris CSS comes from a --i- custom property. Change one and everything that reads it follows.

Classes have no prefix, but custom properties are global and inherited. The --i- prefix keeps them clear of your own variables and of other libraries.

Change a value everywhere

Set the variable on :root in your own stylesheet. It wins over Iris without !important, see cascade layers.

:root {
  --i-border-radius: 0.5rem;
  --i-spacing: 1.25rem;
  --i-font-family: "Inter", var(--i-font-sans);
}

Change a value in one place

Set it on any element. Only that element and its children see the new value.

Theme colors

Colors that change with the theme are light-dark() pairs. Override them with a pair of your own, or with one value to use it in both themes. See themes for the full list.

:root {
  --i-color-primary: light-dark(#6d28d9, #a78bfa);
}

Naming

Owner first
--i-{owner}-{part}-{state}-{property}, for example --i-navbar-brand-font-size or --i-table-row-hover-color-background. Part and state are optional.
Colors end in a role
color-text, color-background, color-border or color-outline, for example --i-input-color-border.
Global tokens start with a category
--i-color-primary, --i-font-family, --i-spacing, --i-border-radius. Many elements read them.
Private variables
Names that start with --_ switch values inside one element. They are not part of the API and can change at any time.

Global variables

The tokens below are read across the framework. Each element and component page ends with a table of its own variables.

Typography

VariableDefault
--i-font-emojiFont stacks: each platform's system font, then generic fallbacks"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Twemoji Mozilla", "Noto Color Emoji"
--i-font-sanssystem-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", sans-serif, var(--i-font-emoji)
--i-font-monoui-monospace, "Cascadia Mono", SFMono-Regular, Menlo, Consolas, "Roboto Mono", "Liberation Mono", "Courier New", monospace, var(--i-font-emoji)
--i-font-familyvar(--i-font-sans)
--i-line-heightBase text. The root size starts at the size the user set in the browser and grows to 112.5% between a 576px and a 1280px wide viewport.1.5
--i-font-weight400
--i-font-sizeclamp(100%, 89.75% + 0.285svw, 112.5%)
--i-text-underline-offset0.125em

Spacing

VariableDefault
--i-spacing1rem
--i-typography-spacing1rem
--i-section-spacing-blockvar(--i-spacing)
--i-section-spacing-inlinevar(--i-spacing)

Borders

VariableDefault
--i-border-radius-smallBorder radius scale0.125rem
--i-border-radius0.25rem
--i-border-radius-medium0.375rem
--i-border-radius-large0.5rem
--i-border-radius-xlarge0.75rem
--i-border-radius-pill9999px
--i-border-widthBorder widths0.0625rem
--i-focus-ring-width0.125rem

Motion

VariableDefault
--i-durationTransitions0.2s
--i-easingease-in-out

Icons

SVG data URIs with the color baked in. Replace the whole value to change an icon or its color.

VariableDefault
--i-svg-checkmarkurl("data:image/svg+xml,…")
--i-svg-chevron-downurl("data:image/svg+xml,…")
--i-svg-closeurl("data:image/svg+xml,…")
--i-svg-dashurl("data:image/svg+xml,…")
--i-svg-dateurl("data:image/svg+xml,…")
--i-svg-invalidurl("data:image/svg+xml,…")
--i-svg-loadingurl("data:image/svg+xml,…")
--i-svg-menuurl("data:image/svg+xml,…")
--i-svg-searchurl("data:image/svg+xml,…")
--i-svg-timeurl("data:image/svg+xml,…")
--i-svg-validurl("data:image/svg+xml,…")