Tessera
GitHub

Forms

Switch

An immediate on/off setting that takes effect without a Save button.

  • Label names the setting, not the state (“Email updates”, not “Turn on email”).

When to use

Turn a setting on or off with immediate effect.

Use something else

Saved with a form → Checkbox. View toggle in a toolbar → ToggleButton.

Do

  • Label the setting, not the state (“Email notifications”).
  • Apply the change right away and confirm it if it matters.

Don't

  • Don't require a Save button after a Switch.
  • Don't use on/off text inside the label.

Props

PropType
checkedboolean
defaultCheckedboolean
onChange(e: any) => void; disabled?: boolean; children?: React.ReactNode; className?: string

Use

const { Switch } = window.Tessera;
const el = React.createElement(Switch, { /* props */ });