HomeDocsComponentsBlocksChartsThemes
Introduction
  • Introduction
  • Installation
  • Themes
  • llms.txt
Components
  • Accordion
  • Alert
  • Alert Dialog
  • Amount
  • Aspect Ratio
  • Audio Player
  • Avatar
  • Avatar Upload
  • Badge
  • Banner
  • Breadcrumb
  • Button
  • Button Group
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Code Block
  • Collapsible
  • Color Picker
  • Combobox
  • Command
  • Context Menu
  • Copy Button
  • Countdown
  • Data Grid
  • Data Table
  • Date Picker
  • Date Range Picker
  • Description List
  • Device Mockup
  • Dialog
  • Direction
  • Dot Loader
  • Drawer
  • Dropdown Menu
  • Empty
  • Field
  • File Upload
  • Hover Card
  • Input
  • Input Group
  • Input OTP
  • Item
  • Kanban
  • Kbd
  • Label
  • Menubar
  • Meter
  • Multi Select
  • Native Select
  • Navigation Menu
  • Number Field
  • Pagination
  • Password Strength
  • Phone Input
  • Popover
  • Progress
  • Progress Circle
  • Radio Group
  • Rating
  • Resizable
  • Responsive Dialog
  • Rich Text Editor
  • Scroll Area
  • Segmented Control
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Signature
  • Skeleton
  • Slider
  • Sonner
  • Sortable
  • Spinner
  • Stat
  • Stepper
  • Switch
  • Table
  • Tabs
  • Tag Input
  • Terminal
  • Textarea
  • Time Field
  • Timeline
  • Toast
  • Toggle
  • Toggle Group
  • Tooltip
  • Tree
  • Typography
  • Video Player
  • Window Mockup
AI
  • Message Scroller
  • Message
  • Bubble
  • Marker
  • Attachment
  • Questionnaire
  • Composer
  • Reasoning
  • Tool Call
  • Approval Card
  • Citations
Blocks
  • Airtable
  • Airtable Kanban
  • ClickUp List
  • ClickUp Kanban
  • Repeatable Group
  • Command Palette
  • Sign In and Sign Up
  • Availability Scheduler
  • AI Chat
  • Action Bar
  • Notion
  • Banking
  • Lineup Builder
  • Sports Score
  • Strava
  • Sheets
  • Notices
  • Settings
  • Billing
Utilities
  • motion
  • sounds
  • scroll-fade
  • shimmer
Another UI. Built on shadcn/ui with Phosphor icons.

Segmented Control

PreviousNext

Pick one of a few options, with a pill that slides to the chosen one.

Base UIReact AriaRadix UI
Radix UI
View

Showing 14 open jobs as a board.

Sizes

Installation#

pnpm dlx shadcn@latest add https://anotherui.dev/r/segmented-control.json

Usage#

import { SegmentedControl, SegmentedControlItem } from "@/components/ui/segmented-control"
<SegmentedControl value={view} onValueChange={setView} aria-label="View">
  <SegmentedControlItem value="list">
    <ListBulletsIcon weight="duotone" />
    List
  </SegmentedControlItem>
  <SegmentedControlItem value="board">
    <KanbanIcon weight="duotone" />
    Board
  </SegmentedControlItem>
</SegmentedControl>

Segmented control, Tabs or Toggle Group#

Use a segmented control to switch a view or a filter in place. Use Tabs when each option has its own panel of content. Use Toggle Group when more than one option can be on, or when none has to be.

One segment is always chosen. Clicking the chosen one again keeps it, so onValueChange always gets a value. Arrow keys move between segments.

Icons and labels#

A segment takes an icon, a label or both. For an icon on its own, give the segment an aria-label. To show labels only when there is room, wrap the label in a span with a container query, like hidden @lg:inline.

Motion and sound#

The pill slides and resizes to the chosen segment on the motion scale, and snaps into place on first paint and on resize. It stays still when reduced motion is on. Each change plays the select cue; turn it off with sounds={false}.

Props#

  • SegmentedControl. value, defaultValue and onValueChange take a string. variant is default (a muted track with a raised pill) or outline (a bordered track for toolbars). size is sm, default or lg. fullWidth shares the width between segments. sounds plays the select cue.
  • SegmentedControlItem. value, disabled and aria-label, like a Toggle Group item.
Scroll AreaSelect

On This Page

InstallationUsageSegmented control, Tabs or Toggle GroupIcons and labelsMotion and soundProps