Rebar UI

1.0

opinion

ThemeToggle

A visitor-facing theme switch; the Theme button at the top right of this site is this component.

Theme switchStyle, light or dark, and bionic reading in one popover
Mode only

Light Mode

Style only
Bionic only
Style and bionic
Small

In context

SettingsOne row in a preferences card
PreferencesTideline, for Maya Chen

Dark mode

Light Mode

Appearance

Props

PropTypeRequiredDefault
labelstring | undefinedNoTheme
size"sm" | "md" | "lg" | undefinedNosm
sectionsThemeToggleSection[] | undefinedNo["style", "mode", "bionic"]
stylesThemeStyle[] | undefinedNo[]
hideLabelboolean | undefinedNofalse
classNamestring | undefinedNo—

Sections

sections ("style", "mode", "bionic"; default all three) picks the controls. Naming exactly one drops the popover and renders that control directly; naming two keeps the popover with just those two.

data-rebar-* attributes

data-rebar-variant="mode-only"|"style-only"|"bionic-only" on the root when sections names one control. It reads and writes data-rebar-theme, data-theme and data-rebar-bionic on the document root, the same attributes RebarDevTools uses.

Migrating to Ant Design

Not codemod-covered. AntD has no theme-switch component; its theming runs through ConfigProvider tokens.