Skip to content

Components

Install

Show an install command for npm, pnpm, yarn, and bun, in the reader's package manager.

Write the package name once and <Install> turns it into the right command for each package manager, as tabs with a copy button. When a reader picks their package manager, every install command on the site switches to it, and the pick is remembered for their next visit.

npm install doccupine

Install usage

Put the package names inside <Install>. Separate several packages with spaces.

html
<Install>doccupine</Install>
<Install>react react-dom</Install>
npm install react react-dom

Pick a tab in one block and the other blocks on the page follow.

Development dependencies

Add dev to install the packages as development dependencies.

html
<Install dev>typescript @types/node</Install>
npm install -D typescript @types/node

Run without installing

Add exec to run a package without installing it, the way npx does. Everything after the package name is passed to it as arguments.

html
<Install exec>doccupine build</Install>
npx doccupine build

yarn dlx needs Yarn 2 or later. Readers on Yarn 1 can use the npm tab.

Commands

Package managerInstallWith devWith exec
npmnpm installnpm install -Dnpx
pnpmpnpm addpnpm add -Dpnpm dlx
yarnyarn addyarn add -Dyarn dlx
bunbun addbun add -dbunx

The page is rendered with npm selected. A reader's own pick replaces it as soon as the page loads. For other commands that differ by tool, use code tabs.

Properties

childrenstringrequired

The packages to install, separated by spaces. With exec, the package to run followed by its arguments.

packagesstring

The packages, when you would rather pass them as a property than as the children.

devboolean

Install the packages as development dependencies. Defaults to false.

execboolean

Run the package without installing it (npx, pnpm dlx, yarn dlx, bunx). Takes precedence over dev. Defaults to false.