Skip to content
Calm motion: animations on this site only fade, with no movement

Code tabs ​

One command in tabs for each package manager

Shows a command for pnpm, npm, yarn, and bun in tabs, with a copy button. If the reader picks a tab once, every block of the same group on the page follows. The choice also stays for the next visit. It is a code block with the tabs filled in.

Basic

1. Add the library:

sh
pnpm add blessing-ui vue

2. Start the dev server. This block follows the choice above.

sh
pnpm dev

Your own tabs, in their own group:

sh
brew install ffmpeg
  • install adds packages, such as install="blessing-ui vue". With dev, they go in as dev dependencies.
  • run runs a script of package.json, such as run="dev". exec runs a package once, with pnpm dlx, npx, yarn dlx, or bunx.
  • managers sets the tabs and their order (default pnpm, npm, yarn, and bun).
  • tabs puts your own tabs in place of the package managers, each with a name and the code.
  • All the blocks with the same group (default package-manager) show the same tab. The browser keeps the choice for the next visit. The stored choice comes back after the page loads, and the first tab shows until then.
  • The tabs, the keys, and the copy button are the ones of the code block.

Usage ​

ts
import { BlessCodeTabs } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
installstring—packages to add, for example `blessing-ui vue`
devboolean—add them as dev dependencies
runstring—a script of package.json to run, for example `dev`
execstring—a package to run once, for example `nuxi init app`
tabsBlessCodeFile[]—your own tabs in place of the package managers
managersBlessPackageManager[]["pnpm", "npm", "yarn", "bun"]
groupstring"package-manager"tabs with the same group keep the same choice on the page and on the next visit
labelstring"Command"

Released under the MIT License. Character names and artwork belong to their owners.