Code Block Command
Tabbed CLI command block with package manager switching, bundled SVG icons, copy button, and localStorage persistence.
lucide-react
Loading...
Installation
$ shadcn add @jalco/code-block-commandUsage
import { CodeBlockCommand } from "@/components/code-block-command"<CodeBlockCommand {...convertNpmCommand("npm install zod")} />Examples
Command types
shadcn add
$ shadcn add buttonnpm install
$ pnpm add zodnpx create
$ pnpm create next-app@latestManual commands
Provide commands manually if the automatic conversion isn't suitable.
Custom mapping
$ pnpm devAPI Reference
CodeBlockCommand
PropType
Notes
- convertNpmCommand helper. Pass a single npm/npx command and get all 5 package manager equivalents automatically. Handles shadcn, create, install, run, and generic npx commands.
- Bundled icons. Package manager icons are bundled directly in the component — no API calls or setup required. Use the
iconsprop to override any icon with a custom ReactNode. - Icon library. Uses Lucide icons by default. Since this is copy-paste code, you can swap the imports if your project uses a different icon library.