UILab

Toggle Group

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

"use client"

import { ToggleGroup, ToggleGroupItem } from "uilab-core"
import { Bold, Italic, Underline } from "lucide-react"

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>

Examples

Outline

Use variant="outline" for an outline style.

"use client"

import { ToggleGroup, ToggleGroupItem } from "uilab-core"

export function ToggleGroupOutlineExample() {

Sizes

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

"use client"

import { ToggleGroup, ToggleGroupItem } from "uilab-core"

export function ToggleGroupSizesExample() {

Spacing

Use spacing to add spacing between toggle group items.

"use client"

import { ToggleGroup, ToggleGroupItem } from "uilab-core"

export function ToggleGroupSpacingExample() {

Vertical

Use orientation="vertical" for vertical toggle groups.

"use client"

import { ToggleGroup, ToggleGroupItem } from "uilab-core"
import { BoldIcon, ItalicIcon, UnderlineIcon } from "lucide-react"

Disabled

"use client"

import { ToggleGroup, ToggleGroupItem } from "uilab-core"
import { Bold, Italic, Underline } from "lucide-react"

On this page