Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Shadcn Segment Group for React and Tailwind

Follows the selected item.

Installation

bunx --bun shadcn@latest add https://kit.dev/r/segment-group.json

Usage

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

div

PropType
AttributeType

SegmentGroupItem

label

PropType
AttributeType

SegmentGroupItemText

span

PropType
AttributeType

SegmentGroupIndicator

div

PropType
AttributeType
CSS variableType

useSegmentGroup

PropType