SuperdindaDocs
Inputs

Switch

An instant on/off setting (Figma "Switch" 2056:47952): the label fills the row, the track sits at the end with the state word ("Ligado"/"Desligado"), and the whole row toggles it.

base-ui Switch (role="switch", Space and Enter toggle, a hidden input submits name). Use it for settings that apply at once; use a Checkbox Field for choices confirmed by a button.

<Switch checked={weekly} onCheckedChange={setWeekly} description="Toda segunda, às 8h.">Resumo semanal por e-mail</Switch>

Playground

Um preset por valor do primeiro eixo do Figma. Mude as props; dsState força hover, foco ou pressionado, como na matriz.

Switch

boolean
string

Variantes, tamanhos e estados

Cada célula é o componente real, marcada com a variante do Figma que reproduz (passe o mouse pra ver o node).

Checked · False

SizeDefaultHoverFocusDisabledError
md

Ative para receber os alertas de risco.

touch

Ative para receber os alertas de risco.

Checked · True

SizeDefaultHoverFocusDisabledError
md
touch

Props

As props que o arquivo do DS declara. O componente também repassa as do primitivo (base-ui), quando ele tem um.

PropTipoPadrãoDescrição
ReactNode—The label (Figma "label"). Without it (Figma showLabel off), pass `aria-label`.
ReactNode—Second line in muted text (Figma "description").
{ on: ReactNode; off: ReactNode; } | null—Figma "showStateLabel": the words drawn beside the track. Decorative: the switch announces its own state.
"md" | "touch"—md = 320 px-style desktop row, touch = phone row (48 px).
ReactNode—Error message under the row; makes the switch invalid (a required opt-in that is still off).
boolean—
string—
string—/__ds forced state (hover, focus).

On this page