- 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>Activar notificaciones
Ver código fuente
export function SwitchExample(props: SwitchExampleProps) {
const copy = () => COPY[props.locale]
const [on, setOn] = createSignal(true)
return (
<div ref={(el) => el.setAttribute("data-hydrated", "true")} class="switch-example">
<Switch.Root checked={on} onCheckedChange={setOn} aria-label={copy().label}>
<Switch.Thumb />
</Switch.Root>
<span class="switch-example__label">{copy().label}</span>
</div>
)
}