Components
Toggle Group
A segmented single choice or a toolbar of pressed buttons, with one Tab stop.
Ombelle · light
Toggle Group
Installation
Run in a project initialized with an Ombelle preset (see Get started). The component uses the saved project preset. Run the command from your app folder; it shows the changes and asks before writing.
pnpm dlx @ombelle-ui/cli@1.1.2 add toggle-groupAdds components/ui/toggle-group.tsx and installs react, @radix-ui/react-toggle-group, clsx, tailwind-merge with lifecycle scripts disabled. This is a client component.
In a liquid glass project the plan adds a notice that accessibility is not guaranteed, because text contrast depends on the background behind the glass.
Usage
example.tsx
import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group'
export function Example(){return <ToggleGroup type="single" defaultValue="week" aria-label="Calendar view"><ToggleGroupItem value="day">Day</ToggleGroupItem><ToggleGroupItem value="week">Week</ToggleGroupItem><ToggleGroupItem value="month">Month</ToggleGroupItem></ToggleGroup>}API and states
- API
- ToggleGroup (type, value, defaultValue, variant, orientation), ToggleGroupItem (value)
- Minimum states
- Checked, pressed, disabled, segmented, toolbar, focus
- Native basis
- Reviewed Radix Toggle Group; Base UI Toggle Group in the Base UI edition
- Styles
- Stable in Ombelle, Papier, Organic, Retro futurism, minimalist, neo-brutalism and flat, light and dark. Liquid glass: stable, accessibility not guaranteed.