- Accordion
- Action Bar
- Alert Dialog
- Alert
- Announcement
- Aspect Ratio
- Autocomplete
- Avatar
- Badge
- Bottom Navigation
- Breadcrumb
- Button Group
- Button
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Circular Progress
- Circular Slider
- Clipboard
- Collapsible
- Color Picker
- Combobox
- Command
- Context Menu
- Data List
- Date Picker
- Dialog
- Drawer
- Editable
- Field
- File Upload
- Float
- Floating Panel
- Frame
- Hint
- Hover Card
- Image Cropper
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Link Overlay
- Listbox
- Marquee
- Menu
- Native Select
- Number Input
- Pagination
- Popover
- Progress
- Prose
- QR Code
- Radio Group
- Rating
- Resizable
- Scroll Area
- Segment Group
- Select
- Separator
- Sheet
- Sidebar
- Signature Pad
- Skeleton
- Skip Nav
- Slider
- Spinner
- Status
- Steps
- Switch
- Table
- Tabs
- Textarea
- Timer
- Toast
- Toggle Group
- Toggle Tooltip
- Toggle
- Tooltip
- Tour
- Tree View
Installation
pnpm dlx shadcn@latest add https://shark.vini.one/r/segment-group.json
Usage
import { SegmentGroup, SegmentGroupIndicator, SegmentGroupItem, SegmentGroupItemText, } from "@/components/ui/segment-group";
<SegmentGroup> <SegmentGroupIndicator /> <SegmentGroupItem value="profile"> <SegmentGroupItemText /> </SegmentGroupItem> <SegmentGroupItem value="account"> <SegmentGroupItemText /> </SegmentGroupItem> </SegmentGroup>
Controlled
Control the selected value programmatically with value and onValueChange props.
State
Disabled
Use the disabled prop to disable the entire segment group.
Disabled Item
Use the disabled prop on individual items to disable specific options.
Variant
Use the variant prop to change the visual variant of the segment group.
Default
Underline
Orientation
Use orientation to change the direction of the items.
Horizontal
Vertical
Vertical with Underline
Examples
Indicator on Hover
The indicator follows the mouse and returns to the selected item when not hovering.
Custom Indicator
Use bg-* classes to change the color of the indicator.
API Reference
SegmentGroup
Root component. Manages segmented control state (single or multi-select).
| Prop | Type | Default |
|---|---|---|
defaultValue | string | - |
value | string | - |
onValueChange | (details: ValueChangeDetails) => void | - |
orientation | "horizontal" | "vertical" | "horizontal" |
variant | "default" | "underline" | "default" |
disabled | boolean | - |
className | string | - |
asChild | boolean | - |
SegmentGroupIndicator
Visual indicator that moves to the selected segment(s).
| Prop | Type | Default |
|---|---|---|
asChild | boolean | - |
className | string | - |
SegmentGroupItem
Single segment option. Use value for selection.
| Prop | Type | Default |
|---|---|---|
value | string | - |
disabled | boolean | - |
className | string | - |
asChild | boolean | - |
SegmentGroupItemText
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.