HomeDocsComponentsBlocksChartsThemes
Introduction
  • Introduction
  • Installation
  • Themes
  • llms.txt
Components
  • Accordion
  • Alert
  • Alert Dialog
  • Amount
  • Aspect Ratio
  • Audio Player
  • Avatar
  • Avatar Upload
  • Badge
  • Banner
  • Breadcrumb
  • Button
  • Button Group
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Code Block
  • Collapsible
  • Color Picker
  • Combobox
  • Command
  • Context Menu
  • Copy Button
  • Countdown
  • Data Grid
  • Data Table
  • Date Picker
  • Date Range Picker
  • Description List
  • Device Mockup
  • Dialog
  • Direction
  • Dot Loader
  • Drawer
  • Dropdown Menu
  • Empty
  • Field
  • File Upload
  • Hover Card
  • Input
  • Input Group
  • Input OTP
  • Item
  • Kanban
  • Kbd
  • Label
  • Menubar
  • Meter
  • Multi Select
  • Native Select
  • Navigation Menu
  • Number Field
  • Pagination
  • Password Strength
  • Phone Input
  • Popover
  • Progress
  • Progress Circle
  • Radio Group
  • Rating
  • Resizable
  • Responsive Dialog
  • Rich Text Editor
  • Scroll Area
  • Segmented Control
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Signature
  • Skeleton
  • Slider
  • Sortable
  • Spinner
  • Stat
  • Stepper
  • Switch
  • Table
  • Tabs
  • Tag Input
  • Terminal
  • Textarea
  • Time Field
  • Timeline
  • Toast
  • Toggle
  • Toggle Group
  • Tooltip
  • Tree
  • Typography
  • Video Player
  • Window Mockup
AI
  • Message Scroller
  • Message
  • Bubble
  • Marker
  • Attachment
  • Questionnaire
  • Composer
  • Reasoning
  • Tool Call
  • Approval Card
  • Citations
Blocks
  • Airtable
  • Airtable Kanban
  • ClickUp List
  • ClickUp Kanban
  • Repeatable Group
  • Command Palette
  • Sign In and Sign Up
  • Availability Scheduler
  • AI Chat
  • Action Bar
  • Notion
  • Banking
  • Lineup Builder
  • Sports Score
  • Strava
  • Sheets
  • Notices
  • Settings
  • Billing
Utilities
  • motion
  • sounds
  • scroll-fade
  • shimmer
Another UI. Built on shadcn/ui with Phosphor icons.

Toggle Group

PreviousNext

A set of two-state buttons that can be toggled on or off.

Base UIReact AriaRadix UI
import { TextBIcon, TextItalicIcon, TextUnderlineIcon } from "@phosphor-icons/react"

import {

Installation#

pnpm dlx shadcn@latest add https://anotherui.dev/r/toggle-group.json

Usage#

import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"
<ToggleGroup type="single">
  <ToggleGroupItem value="a">A</ToggleGroupItem>
  <ToggleGroupItem value="b">B</ToggleGroupItem>
  <ToggleGroupItem value="c">C</ToggleGroupItem>
</ToggleGroup>

Composition#

Use the following composition to build a ToggleGroup:

ToggleGroup
├── ToggleGroupItem
└── ToggleGroupItem

Outline#

Use variant="outline" for an outline style.

import {
  ToggleGroup,
  ToggleGroupItem,

Size#

Use the size prop to change the size of the toggle group.

import {
  ToggleGroup,
  ToggleGroupItem,

Spacing#

Use spacing to add spacing between toggle group items.

import {
  ToggleGroup,
  ToggleGroupItem,

Vertical#

Use orientation="vertical" for vertical toggle groups.

import { TextBIcon, TextItalicIcon, TextUnderlineIcon } from "@phosphor-icons/react"

import {

Disabled#

import { TextBIcon, TextItalicIcon, TextUnderlineIcon } from "@phosphor-icons/react"

import {

Custom#

A custom toggle group example.

Use font-normal to set the font weight.

"use client"

import * as React from "react"

RTL#

To enable RTL support, see the RTL configuration guide.

"use client"

import * as React from "react"

API Reference#

See the Base UI Toggle Group documentation.

ToggleTool Call

On This Page

InstallationUsageCompositionOutlineSizeSpacingVerticalDisabledCustomRTLAPI Reference