Back to components
ElementFormFree

Segmented Control React component

A compact radio-style switch between a few options with a sliding animated thumb, solid or soft styles, icons, icon-only mode, vertical orientation and arrow-key navigation.

About the Segmented Control component

Segmented Control is a compact radio-style switch between a few options with a thumb that slides to the selection. It comes in solid and soft styles, takes an icon per option, can show icons only, stretch to full width or stand vertically.

It is a radiogroup with arrow-key, Home and End navigation and aria-checked on the selected option, in three sizes and dark and light themes.

When to use it

Use Segmented Control to switch between two to five views or modes that apply immediately: list or grid view, monthly or yearly billing, day, week or month in a calendar, light or dark.

For choices that are submitted with a form or have longer labels, use Radio Button; for switching between content panels, use Tabs.

Installation

Add the Segmented Control component to your project with the shadcn CLI. It lands in components/segmented-control.tsx as plain React + Tailwind CSS source you own and can edit.

Install
Copied!
npx shadcn@latest add @reactframe/segmented-control

Or copy the source by hand and install its dependencies:

Install
Copied!
npm install motion clsx tailwind-merge

More Form components

Color Picker
Free
Checkbox Group
Free
File Upload
Free
Password Input
Free
Button
Free
Number Input
Free