SwitchGroup
Related switches as one panel. A row tints while on, the header counts how many are on and flips every switch at once. Inputs.
Open playgroundNotifications1 of 3 on
EmailUpdates in your inbox
PushAlerts on this device
Text messageOnly for urgent issues
About
SwitchGroup is a React component in the Inputs category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { SwitchGroup } from "@ashutoshswamy/smoui" and set items[].icon, items, label among its 5 props.
Install
npm i @ashutoshswamy/smouiUsage
import { SwitchGroup } from "@ashutoshswamy/smoui";
<SwitchGroup label="Notifications" items={[{ value: "email", label: "Email" }, { value: "push", label: "Push" }]} onChange={setChannels} />Props 5
- items[].icon
A leading icon on the row.
IconName- items
Switches in the group.
{ value: string; label: string; description?: string }[]- label
Visible group name.
string- value / defaultValue
Controlled or initial enabled values.
string[]- onChange
Called when any switch changes.
(value: string[]) => void
More inputs components
- AddressAutocompleteType a street and pick from live suggestions. Lookups wait for a pause, show a spinner and drop stale answers. Picking confirms the full address underneath.
- AvatarPickerPick an avatar from a grid. One accent ring glides to your choice, the big preview swaps on a spring, arrow keys move across the grid and Shuffle rolls a random one.
- AvatarUploadDrop or choose a photo, then frame it under a crop circle. The stage shows the whole photo, the circle shows what you keep, and three live previews follow every move. Drag, zoom or use the arrow keys.
- CheckboxBox squashes on press, fills with the accent and draws its tick in.
- ChipA selectable pill. Selecting it tints it and slides a tick in at the front while the pill grows; an optional close button removes it.
- ColorPickerSaturation field and hue strip with jelly thumbs on springs. Edit the hex, pick a swatch, or use arrow keys.