Skip to content

PackageManagers

Tabbed code block — one tab per package manager (npm, yarn, pnpm, bun). Tabs sync across instances on the page.

Installation

Included in the starter. Every new site has it in src/components/ui/package-managers/. Import it where you need it, or register it in src/components.ts to use it on every page. If your site predates it, install it:

npx @cloudflare/nimbus-docs add package-managers

Preview

npm i @cloudflare/nimbus-docs
<PackageManagers pkg="@cloudflare/nimbus-docs" type="add" />

Examples

exec: the project’s installed CLI

Use type=“exec” for a command that runs inside a project. pnpm and Yarn run the installed bin, so they get the bin name; npm and bun keep the scoped package name, which uses the local install.

npx @cloudflare/nimbus-docs list
<PackageManagers
pkg="@cloudflare/nimbus-docs"
type="exec"
args="list"
/>

dlx with args

Use type=“dlx” to invoke a CLI without installing — useful for scaffolders. Yarn’s dlx runs in an isolated workspace, so it can’t run a CLI that needs the project’s own packages.

# Scaffold a new project
npx create-astro@latest
<PackageManagers
pkg="create-astro@latest"
type="dlx"
comment="Scaffold a new project"
/>

API reference

Every prop the component accepts, sourced from a single declaration.

PropType
pkg
string
type
"add" | "create" | "dlx" | "exec" | "install" | "remove" | "run"
args
string
dev
boolean
comment
string

Type to search…

↑↓ navigate↵ selectEsc close