Toggle Group

Grouped set of toggles for single or multi-select choices. Built on Radix ToggleGroup.

Install

npx shadcn@latest add https://substrate.georgedrury.co.uk/r/toggle-group

Examples

Default

"use client"

import { useState } from "react"

Props

ToggleGroup

Extends all Radix ToggleGroup.Root props.

PropTypeDefaultDescription
type"single" | "multiple"—Single or multi-select behaviour
valuestring | string[]—Controlled selected value(s)
defaultValuestring | string[]—Uncontrolled initial value(s)
onValueChange(value: string) => void | (value: string[]) => void—Called when selection changes
orientation"horizontal" | "vertical""horizontal"Layout direction and arrow-key navigation axis
disabledboolean—Disables all items

ToggleGroupItem

Extends all Radix ToggleGroup.Item props.

PropTypeDefaultDescription
valuestring—Unique value of item
disabledboolean—Disables this item