vijayksingh

Switcher

Component

About

A segmented pill control for switching between a few mutually exclusive views or modes, with a thumb that glides to the selected option.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Switcher to your project and fits it to your theme.

Code

How Switcher is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import * as React from "react";
import Switcher from "@/components/ui/switcher";

export default function SwitcherDemo() {
  const [mode, setMode] = React.useState("place");
  return (
    <Switcher
      aria-label="View"
      size="compact"
      value={mode}
      onValueChange={setMode}
      options={[
        { value: "place", label: "place" },
        { value: "list", label: "list" },
        { value: "table", label: "table" },
      ]}
    />
  );
}

Dependencies

More by vijayksingh

View all
  • Weather Widget

    Weather Widget

    74
  • Meter

    Meter

    10
  • Skeleton Loader

    Skeleton Loader

    9
  • Textarea

    Textarea

    2
  • Well

    Well

    1
  • Soft Hardware Spinner

    Soft Hardware Spinner

    1
  • Settings List

    Settings List

  • Perfect Preview

    Perfect Preview