Skip to content
WingoUI
ComponentsTemplatesDocsPricingAI agentsBlogChangelogContact
Components
Buttons & Actions
ButtonButton GroupCopy ButtonDelete ButtonTheme ToggleToggleToggle Group
Inputs
Avatar UploadCalendarCheckboxColor PickerComboboxCountry SelectCron PickerCurrency InputDate PickerDate Range PickerDate Time PickerDuration PickerEmail InputEmoji PickerFile UploadFilter BuilderInputInput GroupListboxMasked InputMention InputMonth PickerMulti SelectNumber InputOTP InputPassword InputPhone InputRadio GroupRatingSearch InputSegmented ControlSelectSignature PadSliderSwitchTag InputTextareaTime PickerTimezone SelectTree Select
Forms
Address InputBooking WidgetCSV ImportFieldForm WizardInline EditInvoice line itemsRich Text EditorSchema Builder
Navigation
Back To TopBounce SidebarBreadcrumbCommand MenuGlobal SearchGooey NavHook SidebarNav MenuNav TabsPaginationProximity SidebarScroll ProgressSidebarStepsTable Of ContentsTabsTopbarUser MenuWorkspace Switcher
Overlays
Alert DialogContext MenuDialogDrawerDropdown MenuFamily DrawerHover CardPopoverShare DialogSheetShortcuts DialogTooltipTour
Feedback
AlertBannerCookie ConsentEmoji ReactionEmpty StateNotification BellNotification CenterProgressRoute ProgressSetup ChecklistSkeletonSpinnerToast
Data Display
Approval FlowAvatarBadgeCalendar ViewCode BlockComment ThreadContact cardCountdownDescription ListDiff ViewerFile ListFile managerFolderGanttJSON ViewerKbdLog ViewerMarkdownPresenceSchedulerTagTimelineTree View
Tables & Lists
Audit LogData TableDeal PipelineEditable GridKanbanListMembers tablePermissions MatrixTableTask ListVirtual List
Charts & Stats
Animated CounterArea chartBar chartDonut chartFunnel chartGaugeGitHub ActivityHeatmap calendarLeaderboardLine chartRadar chartRadial barSparklineStat CardTrackerTrend badge
Layout
AccordionApp ShellCardCollapsibleDetail LayoutEntity HeaderPage HeaderScroll AreaSeparatorSettings LayoutSplit ViewToolbar
Media
Audio PlayerCarouselCSV ViewerDOCX EditorDOCX ViewerExcel ViewerFile SystemImage compareImage CropperImage GalleryImage LightboxLocation MapPDF ViewerPowerPoint ViewerQR CodeStep PlayerVideo Player
AI Kit
Agent Status CardChat MessageChat ThreadChat WidgetConversation ListFluid OrbGrid RevealMatrix OrbModel PickerPrompt InputReasoning IndicatorRule BuilderSuggestion ChipsTool Call TimelineUsage MeterVoice InputWorkflow Canvas
Text & Effects
Background PatternGravity LettersMarqueeTerminalText AnimateText Rotate
Mobile
Action SheetBottom Tab BarFABHaptic ButtonHero HeaderInstall PromptLarge Title HeaderNotification BannerOnboarding CarouselPicker WheelPull To RefreshSlide To ConfirmSticky CTA BarSwipe DeckSwipeable Tabs
Commerce
Cart drawerCategory pickerCheckout stepsCoupon inputFavorite buttonFilter panelListing cardListing gridOrder trackerPricePrice rangePricing tableProduct galleryQuantity stepperReviewsSeller card
Marketing Sections
App Download SectionBlog Cards SectionCTA SectionFAQ SectionFeature GridFeature ShowcaseHero SectionIntegrations SectionLogo CloudMarketing FooterMarketing HeaderMarketing SectionNewsletter SectionPricing SectionStats SectionSteps SectionTeam SectionTestimonials SectionTimeline SectionVideo Section
Blocks
Admin Dashboard PageAdmin ShellAI Chat PageAPI Keys PageAutomation Builder PageCheckout PageCRM Contact PageCRM Pipeline PageError PagesInbox PageInvoice PageKPI DashboardListing Detail PageLogin PageMarketplace Home PageMarketplace Search PageMarketplace ShellMobile App HomeOnboarding FlowOrder History PagePost Listing WizardPricing PageProfile PageRegister PageSettings PageUsers Admin Page
Templates
About PageAcademy PageAccessibility PageAffiliate PageAgency PageAI Product PageAppointment Booking PageBlog PageBlog Post PageBug Bounty PageCareers PageChangelog PageCommunity PageCompare PageContact PageCustomer Story PageCustomers PageDemo Booking PageDevelopers PageDocs Home PageDownload PageEnterprise PageEvents PageExperts PageFAQ PageFeature PageGlossary PageHelp Article PageHelp Center PageHome Services PageImpact PageIntegration Detail PageIntegrations PageJob Detail PageLanding PageLaunch PageLegal PageManifesto PagePortfolio PagePress PageProduct Tour PagePromo PageReal Estate PageReferral PageResearch Report PageRestaurant PageRoadmap PageROI Calculator PageSecurity PageSolutions PageStartups PageStatus PageStorefront PageSwitch PageTemplate Gallery PageTravel PageWaitlist PageYear in Review Page
Hooks & Utilities
AI ChatChart kitCommerceDate utilsFile exportFile typesFiltersForm validationHapticsInvoicingMotion presetsNavigationNumber formatRelative timeRomanian locationsSpreadsheetText matchTonesUIProvideruseClipboarduseConsentuseControllableStateuseCooldownuseDebounceuseKeyboardInsetuseLocaleuseLongPressuseMediaControlsuseMediaQueryuseOverflowItemsusePersistedStateuseScrollEdgesuseScrollStateuseSelectionuseShortcutuseStickToBottom
GalleryTheme

Inputs

Segmented Control

Inputs

Segmented Control React component for Tailwind CSS v4

Search InputSelect
Live props
State
defaultValue
disabled
Appearance
size
radius
tone
color
dividers
Content
iconOnly
aria-label
Layout
fullWidth
dir
Behavior
draggable
loop
name
Code
import { SegmentedControl } from "@/components/ui/segmented-control"

<SegmentedControl />
  1. Home
  2. Components
  3. Inputs
  4. Segmented Control
Free

Segmented Control React component for Tailwind CSS v4

v1.0.0·Added in 1.0.0

A React iOS-style segmented control with a raised thumb that slides and follows your finger.

Click or tap an option and the raised thumb glides over to it on a quick spring; the hairlines next to it fade away. Press the thumb and it dips a little; keep holding and slide sideways to drag it across the options, the value follows the finger and settles where you let go. A vertical swipe still scrolls the page. With the keyboard the control is one tab stop: Left and Right (Up and Down too) move and select, Home and End jump to the ends, and disabled options are skipped. Icon-only options show their name in a tooltip on hover and focus, or on a long press on touch. On a phone the medium size is 44px tall and fullWidth shares the width between options. With dir set to rtl the arrows and the drag mirror.

Segmented Control is a free React component in the React input components category, written in TypeScript for React 19 and Tailwind CSS v4. It installs as source with npx wingo-ui@latest add segmented-control, together with Badge, Tooltip, Motion presets, Tones, useControllableState and 1 more and the npm packages @radix-ui/react-radio-group and motion.

Add to a project

Requirements: React 19 and Tailwind CSS v4, in Next.js (App Router or Pages), Vite or React Router. Installation guide · Next.js setup · Vite setup

npx wingo-ui@latest add segmented-control

Usage

Import SegmentedControl from @/components/ui/segmented-control.

import { useState } from "react"
import { SegmentedControl, type SegmentedControlOption } from "@/components/ui/segmented-control"

const periods: SegmentedControlOption[] = [
  { value: "day", label: "Day" },
  { value: "week", label: "Week" },
  { value: "month", label: "Month" },
  { value: "year", label: "Year" },
]

export function SalesPeriod() {
  const [period, setPeriod] = useState("week")
  return (
    <SegmentedControl
      aria-label="Period"
      options={periods}
      value={period}
      onValueChange={setPeriod}
      fullWidth
    />
  )
}

Props

  • options*
    SegmentedControlOption[]

    The options: { value, label?, icon?, disabled?, badge?, tooltip? }. 2 to 5 read best; more still fit with truncated labels (use tabs then). A number badge renders a small count that hides at 0.

  • value
    string

    The selected option, when you control it. A value that is not in options shows no thumb.

  • defaultValuedefault ""
    string

    The option selected on the first render when uncontrolled. Empty, or a value that is not in options, starts on the first enabled option.

  • onValueChange
    (value: string) => void

    Called with the new value on click, arrow keys, Home / End and while dragging the thumb.

  • sizedefault "md"
    "sm" | "md" | "lg"

    Track height 32 / 40 / 48px with matching type and icon size; options fill it inside a 2px padding. On touch screens md grows to 44px and sm keeps its look with a 44px hit area.

  • radiusdefault "md"
    "none" | "sm" | "md" | "lg" | "full"

    Corner shape of the track, scaled with the size like the button's. The thumb is 2px rounder-in so the gap stays even.

  • tonedefault "neutral"
    "neutral" | "brand" | "success" | "warning" | "danger" | "info"

    The thumb's color. neutral is a raised white surface (a lifted gray in dark mode) like iOS; the other tones fill the thumb and turn its label to the tone's foreground.

  • colordefault ""
    string

    Any CSS color for the thumb. Replaces the tone; the label on it turns black or white by lightness. Leave empty to use the tone.

  • dividersdefault true
    boolean

    Hairlines between unselected neighbours. The ones touching the thumb fade out, like iOS.

  • iconOnlydefault false
    boolean

    Shows only the icons. Each label becomes the option's aria-label and its tooltip, so the control stays readable.

  • fullWidthdefault false
    boolean

    Stretches the track to its container and shares the width between options. The usual layout on a phone.

  • draggabledefault true
    boolean

    Press the thumb and slide sideways to change the value, with touch or a mouse. Vertical swipes still scroll the page.

  • loopdefault true
    boolean

    Arrow keys wrap from the last option to the first and back. Off, they stop at the ends.

  • disableddefault false
    boolean

    Dims the whole control and blocks it. Disable single options with option.disabled.

  • aria-labeldefault ""
    string

    The group's name for screen readers. Required when no visible label names the control.

  • namedefault ""
    string

    Form field name. Inside a <form> the selected value is submitted like a radio group.

  • dirdefault "ltr"
    "ltr" | "rtl"

    Reading direction; rtl mirrors the layout, the arrow keys and the drag. Left out, it follows a Radix DirectionProvider, else ltr.

  • classNames
    Partial<Record<"item" | "thumb" | "icon" | "label" | "badge" | "divider", string>>

    Extra classes for the inner parts.

  • className
    string

    Extra classes for the track, merged last.

Parts

  • SegmentedControlOption

    type

    One option: value, label, icon, disabled, badge (a number renders a count badge, hidden at 0) and tooltip (shown on hover, focus and long press).

Examples

Sizes and radii

32, 40 and 48px tracks; the thumb stays 2px rounder-in at every radius.

Icon-only view switch

Labels move into aria-labels and tooltips (hover, focus or long press).

Full width on a phone

fullWidth shares the width; drag the thumb across with a finger.

Tones and a custom color

neutral is the raised iOS thumb; tones and any CSS color fill it.

With badges

A number renders a count badge that tints with the thumb.

In a form

name="delivery" submits the value like a radio group.

Disabled

A single option locked behind a plan, and a whole disabled group.

Dependencies

@radix-ui/react-radio-groupmotionbadgetooltipmotiontonesuse-controllable-stateui-config

Files

  • components/ui/segmented-control.tsx

FAQ

Is the React Segmented Control component free?

Yes. The source is free and needs no account: copy it from the Code tab or install it with the CLI.

How do I install Segmented Control?

Run npx wingo-ui@latest add segmented-control. It also adds the Wingo UI items it builds on (Badge, Tooltip, Motion presets, Tones, useControllableState and 1 more) and the npm packages @radix-ui/react-radio-group and motion. With shadcn, run npx shadcn@latest add https://wingo-ui.com/r/segmented-control.json.

How does Segmented Control behave on phones?

On a phone the medium size is 44px tall and fullWidth shares the width between options.

See also

TabsRadio GroupToggleTooltipBadge

Used in

Color PickerOnboarding FlowFile managerImage CropperCheckout stepsUser MenuData TableDeal PipelinePricing tableTheme ToggleCron PickerFilter Builder

and 34 more.

More React input components

Date Range PickerCheckboxComboboxCountry SelectCurrency InputDate Picker
All 40 React input components

Articles using this component

  • React Swipeable Tabs: Pages That Follow the Thumb

    Mobile UI in React · Oct 16, 2026 · 10 min read

  • Shadcn Pricing Page: Yearly Toggle, Table, Phone Layout

    Build it: screens and apps · Oct 16, 2026 · 10 min read

  • Framer Motion Spring Presets: Stiffness and Damping

    Component guides · Oct 13, 2026 · 9 min read

  • React Segmented Control: iOS Thumb, Drag and When to Use It

    Mobile UI in React · Oct 9, 2026 · 8 min read

PreviousSearch InputNext Select
Sales+8.4%
$1,240.00
Today, vs the last 11 days

Drag the thumb across, or use the arrow keys