InstallTabs
Introduction
The InstallTabs component displays installation commands for common package managers (npm, pnpm, yarn, etc.), supporting tab switching and one-click copy. Just provide the package name to automatically generate installation commands for each manager. Ideal for documentation, tutorials, and component libraries.
Features:
- Supports npm, pnpm, yarn and other mainstream package managers
- One-click copy command
- Supports dev dependency (-D) option
- Customizable manager list
- Responsive design for all screen sizes
Basic Usage
The simplest installation tab usage:
<InstallTabs packageName="react" />Rendered result:
npm install reactpnpm add reactyarn add reactDev Dependency Usage
Show dev dependency install command:
<InstallTabs packageName="vite" dev />Rendered result:
npm install -D vitepnpm add -D viteyarn add -D viteCustom Managers
Show only npm and yarn:
<InstallTabs packageName="eslint" managers={["npm", "yarn"]} />Rendered result:
npm install eslintyarn add eslintProps
| Prop | Description | Type | Default |
|---|---|---|---|
| packageName | The package name to install | string | - |
| managers | Supported package managers | string[] | [‘npm’,‘pnpm’,‘yarn’] |
| dev | Install as dev dependency | boolean | false |
