Skip to content

Switch

The Switch component provides a toggle control for binary on/off settings, using role="switch" for proper semantics.

Basic Usage

import { Switch } from "@paramanu/forms-react"
export default function App() {
return <Switch>Dark mode</Switch>
}
<label class="pm-switch pm-switch--md pm-switch--label-end">
<input type="checkbox" role="switch" class="pm-switch__input" />
<span class="pm-switch__track"><span class="pm-switch__thumb"></span></span>
<span class="pm-switch__label">Dark mode</span>
</label>

Label Placement

import { Switch } from "@paramanu/forms-react"
export default function App() {
return <Switch labelPlacement="start">Label start</Switch>
}
<label class="pm-switch pm-switch--md pm-switch--label-start">
<input type="checkbox" role="switch" class="pm-switch__input" />
<span class="pm-switch__track"><span class="pm-switch__thumb"></span></span>
<span class="pm-switch__label">Label start</span>
</label>