strata

formsbuilt on ui sdk

Switch

Turns a setting on or off right away.

01 / usage

import { Switch, SwitchThumb } from '@mikestecker/strata/ui'

import { Field, FieldLabel, Switch, SwitchThumb } from '@mikestecker/strata/ui'

export default function SwitchDemo() {
  return (
    <Field style={{ flexDirection: 'row', alignItems: 'center', gap: 12 }}>
      <Switch name="motion" defaultChecked>
        <SwitchThumb />
      </Switch>
      <FieldLabel>Animate the stack</FieldLabel>
    </Field>
  )
}

02 / parts

  • Switch
  • SwitchThumb

03 / keyboard

  • Space turns it on or off.
  • Enter submits its form and never toggles it.

04 / agents

An agent turns it on or off, finding it by its label.