- Inicio
- Primitivas
- Switch
- Ejemplos
Switch
Ejemplo básico de switch demostrando el comportamiento principal.
Ejemplos
import * as Switch from "@solidiom/switch"
;<Switch.Root>Contenido de Switch</Switch.Root>Ver código fuente
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>
)
}