Ballmac UI home

Install Tabs

Package-manager tabs for a CLI command (pnpm, npm, yarn, bun) with a copy button. Remembers the reader's choice and keeps every instance on the page in sync.

pnpm dlx shadcn@latest add @ballmac/button

Installation

$ pnpm dlx shadcn@latest add @ballmac/install-tabs

Usage

import { InstallTabs, packageManagerRunners } from "@/components/ballmac/install-tabs"

The full example is in the Code tab above.

API reference

PropTypeDefault
command

Command to run through each manager's runner, e.g. "shadcn@latest add

string—
commands

Explicit command per manager; overrides `command`. Only the managers listed get a tab.

Partial<Record<PackageManager, string>>—
defaultValue

Tab selected before any stored preference is read.

PackageManager"pnpm"
value

Controlled selected manager.

PackageManager—
onValueChange

Called when the reader picks another manager.

(manager: PackageManager) => void—
storageKey

Remember the choice in localStorage under this key and sync every instance using it.

string—

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
← / →Moves between package-manager tabs and selects them
Home / EndJumps to the first or last tab
TabMoves to the copy button and the command panel

Use with AI

<InstallTabs command='shadcn@latest add @ballmac/button' storageKey='pm' /> renders pnpm dlx / npx / yarn dlx / bunx --bun variants. Use commands={{ npm: 'npm i x', pnpm: 'pnpm add x' }} for install (not run) commands. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Install Tabs (@ballmac/install-tabs) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Install or 'run this CLI' instructions in docs and READMEs
  • Any page with several install snippets where the reader's package manager should stick

Not for

  • A command with its output (use terminal)
  • Multi-line source code (use code-block)

Registry JSON: https://ui.ballmac.com/r/install-tabs.json

Credits

Free to use in personal and commercial projects.