Select UI framework
Get Started
Radix UI
AlertApp Store ButtonAspect RatioBadgeBannerBreadcrumbButton GroupButtonCheckboxCommand MenuCompactButtonDialogDrawerDropdown MenuEmptyFancy ButtonFile UploadHintInput OTPInputItemKbdLabelLinkButtonLoaderPopoverProgress BarProgress CircleRadio GroupRatingSelectSeparatorSkeletonSliderSocial ButtonSwitchTagTextareaToggle GroupToggleTooltip
Component toggle-group-demo not found in registry.
Usage
import { Bold, Italic, Underline } from "lucide-react"
import * as ToggleGroup from "@/registry/radix-ui/ui/toggle-group"
export function ToggleGroupExample() {
const [format, setFormat] = React.useState("bold")
return (
<ToggleGroup.Root
type="single"
value={format}
onValueChange={(value) => value && setFormat(value)}
variant="primary"
appearance="outline"
>
<ToggleGroup.Item value="bold">
<Bold className="size-4" />
Bold
</ToggleGroup.Item>
<ToggleGroup.Item value="italic">
<Italic className="size-4" />
Italic
</ToggleGroup.Item>
<ToggleGroup.Item value="underline">
<Underline className="size-4" />
Underline
</ToggleGroup.Item>
</ToggleGroup.Root>
)
}Examples
Basic Toggle Group
Component toggle-group-demo not found in registry.
Ghost Appearance
Component toggle-group-ghost not found in registry.
Different Sizes
Component toggle-group-sizes not found in registry.
Props
ToggleGroup.Root
This component is based on the Radix UI Toggle Group primitive.
Prop
Type
Default
type
singlemultiple-
value
string-
defaultValue
string-
onValueChange
(value: string) => void-
appearance
outlineghostoutline
size
xssmmdlgmd
disabled
boolean-
rovingFocus
booleantrue
orientation
horizontalverticalhorizontal
className
string-
children
ReactNode-
ToggleGroup.Item
Prop
Type
Default
value
string-
disabled
boolean-
asChild
booleanfalse
className
string-
children
ReactNode-