Skip to content

Early previewhamur is not on npm yet. The components are being built in the open, follow along on GitHub.

UIComponentsReact

Toggle Group

Toggles that work as one control, with one or several pressed.

Built on the headless Toggle Group.See its API in Docs

Rendered by React 19.3.1

toggle-group.tsx

Installation

npx shadcn@4.23.0 add https://hamur.dev/r/react/toggle-group.json

It also adds utils, toggle. The app needs its setup first: Installation.

Usage

Each ToggleGroupItem has a value; the group's variant and size reach every item. Set multiple to let several be pressed. Arrow keys follow orientation.

import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group'

Examples

Default

Three formatting toggles.

Its preview and code are at the top of the page.

API reference

The styled parts pass every prop to the headless part they wrap and add classes. The props, data attributes and keyboard are on Toggle Group's API reference.