Skip to content
View Markdown

Toggle ​

A control for a Boolean setting.

tsx
import { Toggle } from '@satinhq/kit'

Example ​

Full example
tsx
import { useState } from 'react'
import { List, Screen, Section, Toggle } from '@satinhq/kit'

function Example() {
  const [enabled, setEnabled] = useState(true)

  return (
    <Screen>
      <List id="example">
        <Section>
          <Toggle label="Download over Wi-Fi" isOn={enabled} onChange={setEnabled} />
        </Section>
      </List>
    </Screen>
  )
}

Bind the value ​

Pass a Boolean to isOn and a setter to onChange.

Place it in a row ​

Inside a List or Form, Toggle renders its label and switch as one row. Keep the label descriptive.

API ​

Scroll horizontally to read every column.

PropTypeDescription
labelstringThe setting name.
isOnbooleanThe current value.
onChange(isOn: boolean) => voidReceives the new value.
disabledbooleanPrevents changes.

Related: Quick start, List, Screen.

:::

Satin runs on the Lumen rendering engine and is open source under the MIT License.