|
1
|
import { ComponentExample } from "@/components/ComponentExample" |
|
2
|
import { ComponentReference } from "@/components/ComponentReference" |
|
3
|
|
|
4
|
export const metadata = { |
|
5
|
title: `Command`, |
|
6
|
} |
|
7
|
|
|
8
|
# {metadata.title} |
|
9
|
|
|
10
|
A component that renders an unhighlighted code block, useful for one-liners or API routes. |
|
11
|
|
|
12
|
In this guide, you'll learn how to use the Command component. |
|
13
|
|
|
14
|
<ComponentExample name="command-demo" /> |
|
15
|
|
|
16
|
## Usage |
|
17
|
|
|
18
|
```tsx |
|
19
|
import { Command } from "@medusajs/ui" |
|
20
|
``` |
|
21
|
|
|
22
|
```tsx |
|
23
|
<Command> |
|
24
|
<code>yarn add @medusajs/ui</code> |
|
25
|
</Command> |
|
26
|
``` |
|
27
|
|
|
28
|
--- |
|
29
|
|
|
30
|
## API Reference |
|
31
|
|
|
32
|
<ComponentReference mainComponent="Command" /> |
|
33
|
|
|
34
|
--- |
|
35
|
|
|
36
|
## Usage Outside Medusa Admin |
|
37
|
|
|
38
|
If you're using the `Command` component in a project other than the Medusa Admin, make sure to include the `TooltipProvider` somewhere up in your component tree, as the `Command.Copy` component uses a [Tooltip](../tooltip/page.mdx#usage-outside-medusa-admin): |
|
39
|
|
|
40
|
```tsx |
|
41
|
<TooltipProvider> |
|
42
|
<Command> |
|
43
|
<code>yarn add @medusajs/ui</code> |
|
44
|
<Command.Copy |
|
45
|
content="yarn add @medusajs/ui" |
|
46
|
className="ml-auto" |
|
47
|
/> |
|
48
|
</Command> |
|
49
|
</TooltipProvider> |
|
50
|
``` |