Sections
Getting Started
Components
- DocTabs
- Callout
- ComponentPreview
- CommandMenu
- CopyButton
- DocsSidebar
- DocsTableOfContents
- PageHeader
- SiteHeader
- CopyCodeButton
- DocsCopyPage
- CodeBlockCommand
- CommandMenuItem
- CommandMenuKbd
- GitHubLink
- LucideIcon
- MainNav
- MobileNav
- ModeSwitcher
- PageHeaderDescription
- PageHeaderHeading
- SiteBody
- SiteConfig
- SiteFooter
- OgImage (Custom)
The CodeBlockCommand component automatically converts installation commands to different package managers and displays them in tabs.
Usage
<script setup lang="ts">
import { CodeBlockCommand } from '@/components/CodeBlockCommand'
</script>
<template>
<CodeBlockCommand code="npm install shadcn-vue" />
</template>Features
Automatic Conversion
The component automatically converts commands:
npm install→yarn add,pnpm add,bun addnpx create-*→yarn create,pnpm create,bun createnpx→yarn dlx,pnpm dlx,bunxnpm run→yarn,pnpm,bun
Package Manager Selection
Users can switch between package managers using tabs, and their selection is saved in useConfig().
API Reference
CodeBlockCommand
| Prop | Type | Description |
|---|---|---|
code | string | The command code to display and convert |
Supported Commands
npm install <package>npx create-<template>npm create <template>npx <command>npm run <script>
Styling
The component includes:
- Terminal icon indicator
- Syntax highlighting for bash
- Copy button overlay
- Responsive tab layout