Segmented Control
figui/segmented-controlFreeComponent
A segmented control component
Live preview
live · rendered by the registry
Rendered by figui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://figui.dev/r/segmented-control.jsonSource
1import * as React from "react";2import { Radio } from "@base-ui/react/radio";3import { RadioGroup } from "@base-ui/react/radio-group";4import { cn } from "@/lib/utils";56function SegmentedControl({ className, ...props }: RadioGroup.Props) {7 return (8 <RadioGroup9 className={cn("flex w-fit rounded-md bg-grey-100 dark:bg-grey-700", className)}10 {...props}11 >12 {props.children}13 </RadioGroup>14 );15}1617function SegmentedControlItem({ className, children, ...props }: Radio.Root.Props) {18 return (19 <Radio.Root20 className={cn(21 "typography-body-medium flex h-6 cursor-default items-center justify-center rounded-md px-2 text-center text-black-500 outline-none select-none focus-visible:inset-ring focus-visible:inset-ring-blue-500 data-checked:border-grey-200 data-checked:bg-white-1000 data-checked:text-black-1000 data-checked:inset-ring data-checked:inset-ring-grey-200 focus-visible:data-checked:inset-ring-blue-500 data-disabled:text-black-400 dark:text-white-500 dark:data-checked:bg-grey-800 dark:data-checked:text-white-1000 dark:data-checked:inset-ring-grey-600 dark:data-disabled:text-white-400",22 className,23 )}24 {...props}25 >26 {children}27 </Radio.Root>28 );29}3031export { SegmentedControl, SegmentedControlItem };
What it pulls in
npm packages
Files it writes
More from figui
All 12 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Buttonbutton | figui | Components | Free | no deps | |
| Checkboxcheckbox | figui | Components | Free | no deps | |
| Inputinput | figui | Components | Free | 2 deps · 6 files | |
| Menumenu | figui | Components | Free | 1 dep | |
| Radioradio | figui | Components | Free | no deps | |
| Selectselect | figui | Components | Free | no deps | |
| Separatorseparator | figui | Components | Free | no deps | |
| Sliderslider | figui | Components | Free | 2 deps |
