shadcn.io is not affiliated with official shadcn/ui
Framework
UI library
Installation
bunx --bun shadcn@latest add https://kit.dev/r/radix/segment-group.jsonUsage
import {
SegmentGroup,
SegmentGroupItem,
SegmentGroupItemText,
} from "@/components/ui/segment-group";const SegmentGroupDemo = () => (
<SegmentGroup className="rounded-lg" defaultValue="Profile">
{items.map((item) => (
<SegmentGroupItem className="px-2 py-1.5 text-sm" key={item} value={item}>
<SegmentGroupItemText>{item}</SegmentGroupItemText>
</SegmentGroupItem>
))}
</SegmentGroup>
);
const items = ["Profile", "Account", "Security", "Notifications"];Demos
Controlled
Custom Indicator
Disabled
Disabled Item
Indicator On Hover
Orientation Horizontal
Orientation Vertical
Variant Underline
Variant Underline Orientation Vertical
API Reference
SegmentGroup
PropType
defaultValue?stringchildren?ReactNodeSegmentGroupItem
PropType
valuestringdefaultValue?stringchildren?ReactNodeAttributeType
data-orientation?stringSegmentGroupItemText
PropType
defaultValue?stringchildren?ReactNodedisabled?booleanorientation?OrientationAttributeType
SegmentGroupIndicator
PropType
defaultValue?stringchildren?ReactNodedisabled?booleanorientation?OrientationAttributeType
CSS variableType
--heightstring--leftstring--topstring--widthstring