Components
- Accordion
- Action BarUpdated
- Alert Dialog
- Alert
- Announcement
- Aspect Ratio
- Autocomplete
- Avatar
- BadgeUpdated
- Bottom Navigation
- Breadcrumb
- Button Group
- Button
- CalendarUpdated
- CardUpdated
- Carousel
- Chart
- Checkbox
- Circular Progress
- Circular Slider
- Clipboard
- Collapsible
- Color Picker
- Combobox
- Command
- Context MenuUpdated
- Data List
- Date Picker
- DialogUpdated
- DrawerUpdated
- Editable
- FieldUpdated
- File Upload
- Float
- Floating Panel
- Frame
- Hint
- Hover Card
- Image Cropper
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Link Overlay
- Listbox
- MarqueeUpdated
- Menu
- Native Select
- Number InputUpdated
- 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
- TableUpdated
- Tabs
- Textarea
- TimerUpdated
- ToastUpdated
- Toggle Group
- Toggle Tooltip
- Toggle
- Tooltip
- Tour
- Tree View
Hooks
Installation#
pnpm dlx shadcn@latest add @shark/segment-group
Anatomy#
SegmentGroup └── SegmentGroupItem └── SegmentGroupItemText
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.
States#
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#
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 *:data-[slot=segment-group-indicator]: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.