A toggle switch styled as a settings cell with label and description, ideal for preference panels.
import {CellSwitch} from "@heroui-pro/react";
<CellSwitch>
<CellSwitch.Trigger>
<CellSwitch.Label />
<CellSwitch.Control />
</CellSwitch.Trigger>
</CellSwitch>;A single cell with a label and a switch control.
HeroUI follows the BEM methodology to ensure component variants and states are reusable and easy to customize.
The Cell Switch component uses these CSS classes:
.cell-switch: Root wrapper (renders as a label via HeroUI Switch).cell-switch__trigger: The visible cell row container.cell-switch__label: Leading text label.cell-switch__control: Switch control wrapper.cell-switch--secondary: Secondary variant on the root.cell-switch__trigger--default: Default variant trigger styling.cell-switch__trigger--secondary: Secondary variant trigger styling.cell-switch__control--secondary: Secondary variant control stylingThe root component. Wraps HeroUI Switch with cell-style layout. Clicking anywhere in the cell toggles the switch.
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'default' | 'secondary' | 'default' | Visual style variant |
Also supports all HeroUI Switch props except variant.
The visible cell row containing the label and switch control. Renders HeroUI Switch.Content (a <label> element from React Aria's SwitchButton), so clicking anywhere in the row toggles the switch.
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | - | Label and control elements |
Also supports all HeroUI Switch.Content props.
Leading text label rendered as a span.
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | - | Label text |
Also supports all native span HTML attributes.
Switch control. Renders the default HeroUI Switch.Thumb when no children are provided.
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | - | Custom control content |
Also supports all HeroUI Switch.Control props.
Resources