Command
Renders a terminal command with a variant for each package manager.
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.
API Reference
Type
"install" | "install-dev" | "run" | "exec" | "create"Properties
| Property | Type | Modifiers |
|---|---|---|
| variant? | CommandVariant | — |
The type of command to render across package managers. | ||
| children | React.ReactNode | — |
Content used as the subject: packages (install), script (run), binary (exec), or template (create). | ||
| shouldValidate? | boolean | — |
Whether the command should validate the npm package before rendering. | ||
| css? | { container?: CSSObject; tabs?: CSSObject; tabButton?: CSSObject; tabPanel?: CSSObject; copyButton?: CSSObject; code?: CSSObject; } | — |
Override styles for each part of the component. | ||
| className? | { container?: string; tabs?: string; tabButton?: string; tabPanel?: string; copyButton?: string; code?: string; } | — |
Override class names for each part of the component. | ||
| style? | { container?: React.CSSProperties; tabs?: React.CSSProperties; tabButton?: React.CSSProperties; tabPanel?: React.CSSProperties; copyButton?: React.CSSProperties; code?: React.CSSProperties; } | — |
Inline style overrides for each part of the component. | ||
Renders a terminal command with a variant for each package manager.
Properties
CommandPropsReturns
React.JSX.Element