# Install Switcher

Package manager install command with a gliding segmented switch inside the pill: pick pnpm, npm, yarn or bun and the command rewrites, and the copy button copies the one showing. Add the dark class over art.

Component · Code · https://01orbital.dev/docs/components/install-switcher

## Installation

```bash
npx shadcn@latest add @01orbital/install-switcher
```

## Usage

```tsx
import { InstallSwitcher } from "@/components/code/install-switcher"

const COPY = {
  command: "shadcn add @01orbital/moon-sphere",
} as const

export default function InstallSwitcherDemo() {
  return (
    <div className="grid min-h-full w-full max-w-2xl flex-1 content-center">
      <InstallSwitcher command={COPY.command} />
    </div>
  )
}
```

This example installs with everything it uses:

```bash
npx shadcn@latest add @01orbital/install-switcher-demo
```

## API reference

An install command with a package manager switch in the same pill, for a hero or docs page. Picking pnpm, npm, yarn or bun rewrites the command's runner, and the copy button copies the command as it shows.

When the component is narrower than 32rem, the switch takes its own row above the command. After a copy, the button shows a check for two seconds; if copying fails, the command is selected and a message below asks the reader to press ⌘C or Ctrl+C. Over artwork, add `className="dark"`. `className` lands on the outer `div`.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `command` | `string` |  | Everything after the runner, such as `shadcn add |
| `defaultManager?` | `"pnpm" \| "npm" \| "yarn" \| "bun"` | `"pnpm"` | The package manager shown first: `pnpm`, `npm`, `yarn` or `bun`. |

## Dependencies

Requires these pieces. The CLI adds each one that is missing and won't replace a file you already have unless you choose to:

- `font-geist-mono`
- [Input Group](https://01orbital.dev/docs/components/input-group)
- [Segmented Control](https://01orbital.dev/docs/components/segmented-control)
- [Use Copy To Clipboard](https://01orbital.dev/docs/components/use-copy-to-clipboard)

The shadcn parts here are their Base UI versions, and this piece uses Base UI's API. A Radix version you already have won't work with it.

npm: `@phosphor-icons/react`, `cn`
