Command
Renders a terminal command with a variant for each package manager.
npm install renounpnpm add renounyarn add renounbun add renounimport { Command } from 'renoun' export function InstallExample() { return <Command variant="install">renoun</Command> }
Local Storage
The Command component uses local storage for the package manager preference and will use a small script hoisted to the root of the page to set the package manager on load. This is done to avoid any flashing from state changes when a local storage value is found.
Examples
Install Dev Example
View Sourcenpm install --save-dev @types/react @types/react-dompnpm add --save-dev @types/react @types/react-domyarn add --dev @types/react @types/react-dombun add --dev @types/react @types/react-domimport { Command } from 'renoun' export function InstallDevExample() { return <Command variant="install-dev">@types/react @types/react-dom</Command> }
Run Example
View Sourcenpm run devpnpm devyarn devbun run devimport { Command } from 'renoun' export function RunExample() { return <Command variant="run">dev</Command> }
Exec Example
View Sourcenpx create-renoun --example=docspnpm dlx create-renoun --example=docsyarn dlx create-renoun --example=docsbunx create-renoun --example=docsimport { Command } from 'renoun' export function ExecExample() { return <Command variant="exec">create-renoun --example=docs</Command> }
Create Example
View Sourcenpm create renounpnpm create renounyarn create renounbun create renounimport { Command } from 'renoun' export function CreateExample() { return <Command variant="create">renoun</Command> }
API Reference
Type
"install" | "install-dev" | "run" | "exec" | "create"Properties
| Property | Type | |
|---|---|---|
| variant? | CommandVariant | |
| children | ReactNode | |
| css? | { container?: CSSObject | undefined; tabs?: CSSObject | undefined; tabButton?: CSSObject | undefined; tabPanel?: CSSObject | undefined; copyButton?: CSSObject | undefined; code?: CSSObject | undefined; } | |
| className? | { container?: string | undefined; tabs?: string | undefined; tabButton?: string | undefined; tabPanel?: string | undefined; copyButton?: string | undefined; code?: string | undefined; } | |
| style? | { container?: CSSProperties | undefined; tabs?: CSSProperties | undefined; tabButton?: CSSProperties | undefined; tabPanel?: CSSProperties | undefined; copyButton?: CSSProperties | undefined; code?: CSSProperties | undefined; } | |
Renders a terminal command with a variant for each package manager.
Properties
CommandPropsLast updated