Skip to Content
Skip to content

Toggle Group

Neumorphic toggle group on the Radix primitive. A carved well that follows the theme radius; in single mode one raised knob slides to the pressed item.

Installation

bunx --bun shadcn@latest add https://neu.beyondtheinnovation.com/r/neu-toggle-group.json

Usage

import { ToggleGroup, ToggleGroupItem } from "@/components/ui/neu/toggle-group"
<ToggleGroup type="single" defaultValue="center">
  <ToggleGroupItem value="left">Left</ToggleGroupItem>
  <ToggleGroupItem value="center">Center</ToggleGroupItem>
  <ToggleGroupItem value="right">Right</ToggleGroupItem>
</ToggleGroup>

Spacing

spacing sets the gap between items inside the well, in Tailwind spacing units.

<ToggleGroup type="multiple" spacing={2}>
  <ToggleGroupItem value="bold">Bold</ToggleGroupItem>
  <ToggleGroupItem value="italic">Italic</ToggleGroupItem>
</ToggleGroup>

Vertical

Use orientation="vertical" to stack the items; the knob follows.

<ToggleGroup type="single" orientation="vertical" defaultValue="top">
  <ToggleGroupItem value="top">Top</ToggleGroupItem>
  <ToggleGroupItem value="bottom">Bottom</ToggleGroupItem>
</ToggleGroup>

On this page