GooseUI

Components

Install Command

New

Shows a shadcn add command with tabs for npm, pnpm, yarn and bun. You pass the package once, and each manager gets its own runner: npx, pnpm dlx, yarn dlx, bunx. Built on Tabs, so the pill glides to the chosen tab and the command cross-fades without moving the layout. With storageKey the choice is remembered and every block on the page, and in other browser tabs, follows it.

Browser Support

:has()

Anchor positioning moves the pill; the visible command is picked with :has(:checked).

Your browser:

Preview

Use the arrow keys to switch managers. The focus ring shows only for keyboard focus.

npx shadcn@latest add @gooseui/button
pnpm dlx shadcn@latest add @gooseui/button
yarn dlx shadcn@latest add @gooseui/button
bunx --bun shadcn@latest add @gooseui/button

Installation

npx shadcn@latest add @gooseui/install-command
pnpm dlx shadcn@latest add @gooseui/install-command
yarn dlx shadcn@latest add @gooseui/install-command
bunx --bun shadcn@latest add @gooseui/install-command

Usage

import { InstallCommand } from "@/components/ui/install-command"

export function GettingStarted() {
  return <InstallCommand packageName="@gooseui/button" storageKey="package-manager" />
}

Examples

Custom commands

commands replaces the generated command for any manager. Use it for packages that are not added with shadcn.

npm install motion
pnpm add motion
yarn add motion
bun add motion
<InstallCommand
  packageName="motion"
  commands={{
    npm: "npm install motion",
    pnpm: "pnpm add motion",
    yarn: "yarn add motion",
    bun: "bun add motion",
  }}
/>

Commands and sync

Blocks with the same storageKey switch together. Pick a tab in one and the other follows.

Step 1. Add the dependency

npm install motion
pnpm add motion
yarn add motion
bun add motion

Step 2. Add the component

npx shadcn@latest add @gooseui/timeline
pnpm dlx shadcn@latest add @gooseui/timeline
yarn dlx shadcn@latest add @gooseui/timeline
bunx --bun shadcn@latest add @gooseui/timeline
<InstallCommand packageName="@gooseui/tabs" storageKey="pm" />
<InstallCommand packageName="@gooseui/timeline" storageKey="pm" />
// pnpm dlx shadcn@latest add @gooseui/timeline
// yarn dlx shadcn@latest add @gooseui/timeline

Props

PropTypeDefaultDescription
packageNamestring-Package or registry URL to add, e.g. @gooseui/tabs
defaultPmPackageManager"npm"Tab shown before the user picks one
storageKeystring-localStorage key. When set, the choice is remembered and blocks with the same key stay in sync
commandsPartial<Record<PackageManager, string>>-Exact commands that replace the generated ones
labels{ tabs?, copy?, copied? }-Texts for the tab list and the copy button
onCopy(command, manager) => void-Called after the command is copied
onCopyError(error: Error) => void-Called when the browser refuses to copy
classNamestring-Additional CSS classes

Features

  • One description. npx, pnpm dlx, yarn dlx and bunx shadcn@latest add for the package you pass.
  • Shared choice. the choice goes to localStorage and a custom event, so blocks and other open browser tabs stay in step.
  • Keyboard. native radios: Tab enters the group once, the arrow keys switch the manager. The focus ring shows for keyboard only.
  • Exports. getInstallCommand is exported too, if you need the same strings elsewhere.