Command Box

Multi-package-manager command snippet box with fluid tab transitions, blur reveal, and one-click copy feedback.

$
bunx --bun shadcn@latest add @ashutoshdm1/command-box
1import { CommandBox } from "@/components/command-box";
2 
3export default function CommandBoxDemo() {
4 return (
5 <div className="w-full max-w-xl mx-auto py-6">
6 <CommandBox
7 baseCommand="shadcn@latest add @ashutoshdm1/command-box"
8 showPrompt={true}
9 />
10 </div>
11 );
12}

Installation

bunx --bun shadcn@latest add https://ashutoshtiwari.me/r/command-box.json

Usage

1import { CommandBox } from "@/components/command-box"
1<CommandBox baseCommand="shadcn@latest add @ashutoshdm1/command-box" />

API Reference

PropTypeDefaultDescription
baseCommandstringundefinedStandard command suffix appended to package manager runners (e.g. 'shadcn@latest add ...').
commandsCommandConfigMapundefinedExplicit map of command configurations keyed by package manager ('bun', 'pnpm', 'yarn', 'npm').
commandGenerator(pm: PackageManager) => CommandItemundefinedFunction to dynamically generate command items per package manager.
packageManagersPackageManager[]["bun", "pnpm", "yarn", "npm"]List of package managers to show in the switcher tabs.
defaultPackageManagerPackageManager"bun"Initially active package manager tab.
showPromptbooleanfalseWhether to display a terminal dollar sign ($) before the command text.
copySuccessMessagestring"Command copied to clipboard"Toast notification message displayed when the command is copied.
titleReact.ReactNodeundefinedHeader title displayed above the command box.
descriptionReact.ReactNodeundefinedHeader description text displayed above the command box.
showHeaderbooleantrueControls whether the title and description header is displayed.
classNamestring""Additional CSS classes applied to the container element.