Behive Tech Registry

Toggle

v0.4.0

A bare toggle/switch control (built on Radix's `Switch`) — the Radix switch button is this component's own root element. It has no built-in label/hint/error; wrap it in `FormField` for that chrome.

pnpm add @behivetech/atoms.toggle

A bare toggle/switch control (built on Radix's Switch) — the Radix switch button is this component's own root element. It has no built-in label/hint/error; wrap it in FormField for that chrome.

Usage

Pass aria-invalid="true" to visually mark the toggle as invalid (pair with FormField's error prop for the message).

Props

Extends Radix's own SwitchProps (checked, defaultChecked, onCheckedChange, disabled, required, name, value, id, plus any standard button/ARIA attribute) with:

PropTypeDefaultDescription
classNamestring—Additional class names

Compositions

Open all 4 →

Properties

Toggle props

PropTypeDefaultDescription
asChildboolean——
classNamestring—Additional class names to merge with the component root element

Also accepts the native attributes of its root element (className, aria-*, event handlers, …).