Skip to main content Home About the Design SystemRoadmap OverviewDesignersDevelopers OverviewColorGridIconographyInteractionsSpacingTypography Overview Global colorBox shadowTypographyBorderOpacitySpaceLengthIconBreakpointsMedia queries All elements Accordion Alert Announcement Audio player Avatar Back to top Badge Blockquote Breadcrumb Button Card Chip Code block Call to action Dialog Disclosure Footer Health index Icon Jump links Menu dropdown Navigation link Navigation (primary) Navigation (secondary) Navigation (vertical) Pagination PopoverPlanned Progress stepper Scheme toggle Site status Skeleton Skip link Spinner Statistic Subnavigation Surface Switch Table Tabs Tag Tile Timestamp Tooltip Video embed OverviewColor PalettesCustomizingDevelopers All PatternsAccordionCall to ActionCardFilterFormLink with iconLogo wallSearch barSticky bannerSticky cardTabsTagTile All Personalization PatternsAnnouncement FundamentalsAccessibility toolsAssistive technologiesCI/CDContentContributorsDesignDevelopmentManual testingResourcesScreen readers Design/code status Release notes Get support

Scheme toggle

OverviewStyleGuidelinesCodeAccessibilityDemos
ImportingUsagerh-scheme-toggleImportingUsagerh-scheme-toggle

Importing

Add rh-scheme-toggle to your page with this import statement:

<script type="module">
  import '@rhds/elements/rh-scheme-toggle/rh-scheme-toggle.js';
</script>
Copy to Clipboard Wrap lines

To learn more about installing RHDS elements on your site using an import map read our getting started docs.

Usage

<rh-scheme-toggle></rh-scheme-toggle>

<script type="module">
  import '@rhds/elements/rh-scheme-toggle/rh-scheme-toggle.js';
</script>

<style>
  body {
    color-scheme: light dark;
    background-color: light-dark(var(--rh-color-surface-lightest, #ffffff),
        var(--rh-color-surface-darkest, #151515));
    color: light-dark(var(--rh-color-text-primary-default-on-light, #151515),
        var(--rh-color-text-primary-default-on-dark, #ffffff));
  }
</style>
Copy to Clipboard Wrap lines

rh-scheme-toggle

A scheme toggle switches between light, dark, and system default color schemes.

Slots 0
None
Attributes 5
Attribute DOM Property Description Type Default
scheme scheme

Current color scheme setting

Scheme
globalThis.localStorage\n ?.rhdsColorScheme as Scheme
legend-text legendText

Legend text for the color scheme toggle group

string
'Color scheme'
light-text lightText

Label text for the light mode option

string
'Light'
dark-text darkText

Label text for the dark mode option

string
'Dark'
system-text systemText

Label text for the system default option

string
'System'
Methods 0
None
Events 0
None
CSS Shadow Parts 0
None
CSS Custom Properties 0
None
Design Tokens 13
Token Summary Copy
--rh-space-lg
Full CSS Variable Permalink to this token
--rh-size-icon-01
Full CSS Variable Permalink to this token
--rh-color-border-subtle
Full CSS Variable Permalink to this token
--rh-space-2xl
Full CSS Variable Permalink to this token
--rh-space-3xl
Full CSS Variable Permalink to this token
--rh-border-radius-default
Full CSS Variable Permalink to this token
--rh-color-interactive-secondary-focus
Full CSS Variable Permalink to this token
--rh-color-interactive-primary-active
Full CSS Variable Permalink to this token
--rh-color-border-interactive
Full CSS Variable Permalink to this token
--rh-color-text-primary-on-dark
Full CSS Variable Permalink to this token
--rh-color-text-primary-on-light
Full CSS Variable Permalink to this token
--rh-border-width-sm
Full CSS Variable Permalink to this token
--rh-color-interactive-primary-focus
Full CSS Variable Permalink to this token
© 2025 Red Hat Deploys by Netlify