Garden’s theming system is built on styled-components. A singleDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/zendeskgarden/website/llms.txt
Use this file to discover all available pages before exploring further.
ThemeProvider injects a theme object into the React context that every Garden component reads from. You can pass the built-in DEFAULT_THEME unchanged, override specific values for branding, or extend it with entirely new tokens.
ThemeProvider
ThemeProvider is exported from @zendeskgarden/react-theming. Wrap it around the root of your application (or any subtree that needs Garden styling).
ThemeProvider without a theme prop defaults to DEFAULT_THEME, so the explicit prop is optional when you are not customising anything.Branding overrides
Pass a partial theme object to change visual properties across all components at once. The example below replaces the primary accent color and sets square corners:Theme extension
Extend the palette with a custom hue and wire it to a semantic role:Nested ThemeProvider
Nest a secondThemeProvider to apply a scoped override to one subtree without affecting the rest of the application:
ThemeProvider receives the parent theme as a function argument, letting you read and modify it.
ColorSchemeProvider
ColorSchemeProvider wraps your application to track and persist the user’s preferred color scheme. It works in concert with ThemeProvider’s colors.base value ('light' or 'dark').
Theme object structure
TheDEFAULT_THEME object contains the following top-level keys:
| Key | Description |
|---|---|
colors | Semantic color variables and hue assignments (primaryHue, dangerHue, etc.) |
palette | Full color palette — all hues and shades |
shadows | Shadow functions (xs, sm, md, lg) |
fonts | Font stacks: system and mono |
fontSizes | Type scale values |
fontWeights | Weight names mapped to numeric values |
lineHeights | Line height scale values |
space | Spacing scale (xxs → xxl) with a base unit |
borders | Combined border shorthand values |
borderRadii | Corner radius values (sm, md) |
borderStyles | Border style (solid) |
borderWidths | Border width values (sm, md) |
breakpoints | Responsive breakpoint values |
iconSizes | Icon size values (sm, md, lg) |
opacity | Opacity scale values |
rtl | boolean — enables right-to-left layout |
components | Targeted component overrides keyed by COMPONENT_ID |
document | DOM document reference for portal-based components |
window | DOM window reference for portal-based components |
Color hues
| Hue | Default | Purpose |
|---|---|---|
primaryHue | 'blue' | Primary accent |
dangerHue | 'red' | Danger and error states |
warningHue | 'yellow' | Caution and warning states |
successHue | 'green' | Success states |
neutralHue | 'grey' | Neutral and disabled states |
chromeHue | 'kale' | Chrome navigation and drop shadows |
Color variables
Garden uses semantic variable keys that resolve differently for'light' and 'dark' bases. Key groups include:
- Background —
background.default,background.raised,background.recessed,background.subtle,background.emphasis, and state-specific variants - Border —
border.default,border.emphasis,border.subtle, and state-specific variants - Foreground —
foreground.default,foreground.subtle,foreground.onEmphasis, and state-specific variants - Shadow —
shadow.small,shadow.medium,shadow.large
Targeted component overrides
Thecomponents key accepts CSS template strings keyed by Garden’s internal COMPONENT_ID values. Use the Garden Inspect Chrome extension to find component IDs.
getColor utility
getColor resolves a semantic color variable or palette hue to a CSS color string. It respects the current color scheme automatically: