Faber UI
Components

ToggleGroup

A group of mutually exclusive or independent toggles.

ToggleGroup is built on the Base UI ToggleGroup primitive. It renders a set of toggle buttons that can be single or multi-select.

Installation

Terminal
pnpm dlx shadcn@latest add https://faber-ui.vercel.app/r/toggle-group.json

Usage

typescript
"use client";

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

export default function Example() {
  return (
    <ToggleGroup type="single">
      <ToggleGroupItem value="bold">Bold</ToggleGroupItem>
      <ToggleGroupItem value="italic">Italic</ToggleGroupItem>
    </ToggleGroup>
  );
}

Examples

Single

Multiple

Vertical

API

Each part forwards every prop of what it is built on, including className and render where Base UI supports it. The props column lists only what Faber UI adds on top.

PartBuilt onProps
ToggleGroupdata-slot="toggle-group"ToggleGroupBase UI
  • spacing? = 2number
  • orientation? = "horizontal""horizontal" | "vertical"
ToggleGroupItemdata-slot="toggle-group-item"ToggleBase UI—

Changelog

  1. v0.3.0Tabs and ToggleGroup pass orientation to Base UI, so vertical layouts get aria-orientation and Up/Down arrow navigation.patch
Full ToggleGroup history

Last updated on

On this page