docs/components/segment-group
Sections
Components
Utilities
Forms
Hooks
Copy Markdown
Follows the selected item.
PreviewCode
Profile
Account
Security
Notifications
CLIManual
pnpmbunnpmyarn
pnpm dlx shadcn@latest add @shark/segment-group
SegmentGroup
└── SegmentGroupItem
└── SegmentGroupItemText
import {
SegmentGroup,
SegmentGroupIndicator,
SegmentGroupItem,
SegmentGroupItemText,
} from "@/components/ui/segment-group";
<SegmentGroup>
<SegmentGroupIndicator />
<SegmentGroupItem value="profile">
<SegmentGroupItemText />
</SegmentGroupItem>
<SegmentGroupItem value="account">
<SegmentGroupItemText />
</SegmentGroupItem>
</SegmentGroup>
Control the selected value programmatically with value and onValueChange props.
PreviewCode
Profile
Account
Security
Notifications
Use the disabled prop to disable the entire segment group.
PreviewCode
Profile
Account
Security
Notifications
Use the disabled prop on individual items to disable specific options.
PreviewCode
Profile
Account
Security
Notifications
PreviewCode
Profile
Account
Security
Notifications
PreviewCode
Profile
Account
Security
Notifications
Use orientation to change the direction of the items.
PreviewCode
Profile
Account
Security
Notifications
PreviewCode
Profile
Account
Security
Notifications
PreviewCode
Profile
Account
Security
Notifications
The indicator follows the mouse and returns to the selected item when not hovering.
PreviewCode
Profile
Account
Security
Notifications
Use *:data-[slot=segment-group-indicator]:bg-* classes to change the color of the indicator.
PreviewCode
Profile
Account
Security
Notifications
Root component. Manages segmented control state (single or multi-select).
| Prop | Type | Default |
|---|---|---|
defaultValue | string | - |
value | string | - |
onValueChange | (details: ValueChangeDetails) => void | - |
orientation | `"horizontal" | "vertical"` |
variant | `"default" | "underline"` |
disabled | boolean | - |
className | string | - |
asChild | boolean | - |
Visual indicator that moves to the selected segment(s).
| Prop | Type | Default |
|---|---|---|
asChild | boolean | - |
className | string | - |
Single segment option. Use value for selection.
| Prop | Type | Default |
|---|---|---|
value | string | - |
disabled | boolean | - |
className | string | - |
asChild | boolean | - |
Text label for a segment. Often wraps icon + text.
| Prop | Type | Default |
|---|---|---|
className | string | - |
asChild | boolean | - |
For a complete list of props, see the Ark UI documentation.
[
Previous page
Scroll Area ](/docs/components/scroll-area)[
Next page
Select ](/docs/components/select)
On This Page
InstallationAnatomyUsageControlledStatesDisabledDisabled ItemVariantDefaultUnderlineOrientationHorizontalVerticalVertical with UnderlineExamplesIndicator on HoverCustom IndicatorAPI ReferenceSegmentGroupSegmentGroupIndicatorSegmentGroupItemSegmentGroupItemText