Scheme dropdown
>
Since v4.2.0
On this page
Overview
Provides a color scheme picker for switching between light, dark,
and system defaults. Accessible by default with a screen-reader
label (WCAG 4.1.2), keyboard navigation, and focus management.
Authors should set accessible-label for localization.
Edit element properties
import '@rhds/elements/rh-scheme-dropdown/rh-scheme-dropdown.js';
body {
color-scheme: light dark;
background-color: var(--rh-color-surface);
color: var(--rh-color-text-primary);
}
rh-scheme-dropdown {
padding: var(--rh-space-md, 8px);
}
<rh-scheme-dropdown></rh-scheme-dropdown>
import { SchemeDropdown } from "@rhds/elements/react/rh-scheme-dropdown/rh-scheme-dropdown.js";
// NOTE: React 19+ does not require these wrapper imports.
// You can use the custom elements directly as-is.
export const Demo = () => (
<SchemeDropdown />
);
Current color scheme setting. Reflects to the scheme attribute and
initializes from localStorage.rhdsColorScheme when available.
When set, applies the value to document.body.style.colorScheme
and persists it to localStorage.
Visually hidden accessible label for the scheme dropdown. Authors should keep this text short (under 20 characters).
Accessible label for the light mode option.
Accessible label for the dark mode option.
Accessible label for the system default option.
Status
- Figma library:
-
Ready - RH Elements:
-
Ready - RH Shared Libs:
-
Planned
When to use
- Allow users to select from a list of predefined color schemes
Status checklist
| Property | Status | Meaning |
|---|---|---|
| Figma library |
|
Component is available in the Figma library |
| RH Elements |
|
Component is available in RH Elements |
| RH Shared Libs |
|
Component will be added to RH Shared Libs |
Other libraries
To learn more about our other libraries, visit this page.
Feedback
To give feedback about anything on this page, contact us.