BetaPublic beta — Read the release notes
Documentation

Switch

Basic switch example demonstrating core behavior.

Package
@solidiom/switch
Version
0.0.1-next.0
Status
stable

Examples

import * as Switch from "@solidiom/switch"

;<Switch.Root>Switch content</Switch.Root>
View source
        export function SwitchExample(props: SwitchExampleProps) {
  const copy = () => COPY[props.locale]
  const [on, setOn] = createSignal(false)

  return (
    <div ref={(el) => el.setAttribute("data-hydrated", "true")} class="switch-example">
      <Switch.Root checked={on} onCheckedChange={setOn}>
        {copy().label}
        <Switch.Thumb />
      </Switch.Root>
    </div>
  )
}