Back to catalog
Component detail entry
Utilities
@vean/ui
SThemeModeToggle

ThemeModeToggle

ThemeModeToggle belongs to the Utilities category. Start with demos and usage, then use the API tables to finish integration and styling decisions.

Use the quick jump panel to reach overview, usage, demos, and API first, then continue through the full page.

Quick jump

Related components

If you are composing interactions in the same family, these components usually pair well together.

ThemeModeToggle

Overview

SThemeModeToggle is a context-bound cycling button bound to the active SConfigProvider theme. Each click advances the preference through auto → light → dark → auto, and the icon always shows the current preference (monitor / sun / moon). Use it as a one-button scheme control in a header or toolbar when a dropdown is too heavy and a binary switch cannot express auto.

Usage

Features

  • 🔁 Cycles auto → light → dark → auto in one click each
  • 🖼 Icon reflects the current preference, so all three states are distinguishable
  • 🎚 Writes the preference through the shared theme context — no modelValue
  • ♿ Accessible name is the localized Scheme: <current> text (overridable via ariaLabel), and it doubles as the tooltip
  • 🎨 Inherits size / color / variant / shape from SButtonIcon

Demos

Basic

Click to cycle auto → light → dark

API

Aria Layer

1

ThemeModeToggle

5 Props
Props
PropTypeDefaultDescription
size
ThemeSize
'md'
Visual size of the button.
color
ThemeColor
'accent'
Theme color of the button.
variant
ButtonVariant
'ghost'
Visual variant of the button.
shape
ButtonShape
'square'
Shape of the button.
ariaLabel
string
—
Accessible label of the button. Defaults to the localized `Scheme: <current preference>` text, which also drives the `title` tooltip.

Notes

Scope

Like SThemeModeSelect, SThemeModeSwitch, and SThemeModeSegment, SThemeModeToggle is a theme-layer component that operates on the theme context from a parent SConfigProvider. It does not accept a modelValue; the preference is owned by the provider and shared across all theme components. It is the single-button counterpart of SThemeModeSegment: same three preferences, no dropdown and no visible option list.

Cautions

  • The component must be rendered inside a SConfigProvider, otherwise useTheme throws.
  • Unlike SThemeModeSwitch, it tracks the preference, not the effective scheme: with auto the icon stays a monitor even though the resolved scheme is light or dark.
  • Cycling always moves forward, so reaching a specific preference takes up to two clicks; use SThemeModeSelect or SThemeModeSegment for direct selection.

Changelog

Version history is grouped by release so you can quickly see what changed for this component across published versions.

v0.51.4

2026-10-30

Compare release

Feature

add a cycling theme mode button

Scope: theme-mode-toggleAuthors: soybeanjsView commitca020