Switch

The e-switch component captures boolean or mapped binary state with the shared field contract, including helper details, async loading feedback, validation, and accessible labeling.

Use this page to validate toggle behavior, side effects, and value mapping before wiring preference panels, release gates, or environment settings into production flows.

Usage

Use this baseline playground to tune switch behavior in context: color, outlined, disabled, readonly, loading, and retain-color for stronger state continuity.

Controls whether the release can proceed automatically.
primary

Visual variants

Compare default, outlined, tonal, retain-color, loading, disabled, and readonly states to keep binary decisions clear in dense configuration panels.

Custom values

Map the switch state to domain values with true-value and false-value when the backing model is not strictly boolean.

Maps switch state to deployment status values.

Current model value

draft

Loading and async flows

Use loading to block interaction while persisting the new value and to make side effects explicit during async preference updates.

Toggle the switch to simulate an async save.
Persist the preference before enabling session tracking.

Named slots

Use the label slot to render richer inline labels with links or policy context while preserving switch semantics.

Validation

Validate consent or environment requirements with explicit submit-state feedback before allowing a critical transition.

Submit to validate the switch rule.

Props

Use the API table as the source of truth for accepted types, defaults, and inherited field behavior.

PropertyTypeDefault
modelValueboolean | string | numberundefined

Current switch value. Active state is resolved by strict equality against trueValue.

trueValueboolean | string | numbertrue

Value emitted when the switch becomes active.

falseValueboolean | string | numberfalse

Value emitted when the switch becomes inactive.

loadingbooleanfalse

Makes the control non-interactive and shows an inline loading indicator in the thumb.

tonalbooleanfalse

Shows field overlay styling inside the switch control without changing binary behavior.

hideOverlaybooleanfalse

Hides the shared field overlay visual without changing switch behavior.

clearablebooleanfalse

Shows clear action when a value exists.

colorstring"primary"

Base theme color applied to field state and interactions.

outlinedbooleanfalse

Uses outlined visual variant for the field container.

disabledbooleanfalse

Disables interaction and prevents value updates.

readonlybooleanfalse

Prevents editing while preserving focus behavior.

densebooleanfalse

Applies denser vertical spacing inherited from Field.

retainColorbooleanfalse

Keeps active color styling after focus/interaction.

labelstring | numberundefined

Field label text.

labelMinWidthstring | numberundefined

Minimum width reserved for label region.

labelBehavior"static""static"

Label behavior is static for switch controls.

inputAlignleft | right | center | start | end"start"

Horizontal text alignment inside input/selection area.

prependIconstring | IconPath | IconPath[]undefined

Icon rendered in outer-left affix region.

prependInnerIconstring | IconPath | IconPath[]undefined

Icon rendered before content inside input frame.

appendInnerIconstring | IconPath | IconPath[]undefined

Icon rendered after content inside input frame.

appendIconstring | IconPath | IconPath[]undefined

Icon rendered in outer-right affix region.

detailstringundefined

Helper text shown in details area when no errors are present.

detailsOnMessageOnlybooleanfalse

Shows details area only when messages/errors exist.

rulesFieldRule[]undefined

Validation rules evaluated against modelValue.

detailErrorsstring[]undefined

Explicit error messages rendered in details area.