SShinUI

Segmented Control

The iOS segmented control as a CSS grid, so the thumb width is derived from the number of options and the translate is a whole multiple of it.

segmentediostoggle-groupview-switcher

Usage

Drop the file into your project and import it. There is no package to install.

usage.tsx
import { SegmentedControl } from "@/registry/components/segmented-control";

export function Example() {
  return <SegmentedControl />;
}

Install prerequisites

Every component here relies only on Tailwind and the cn helper from shadcn/ui.

terminal
npm i clsx tailwind-merge

More in Mobile