|
1
|
import { IconSearch } from "@/components/IconSearch" |
|
2
|
import { ComponentExample } from "@/components/ComponentExample" |
|
3
|
import { Prerequisites } from "docs-ui" |
|
4
|
|
|
5
|
export const metadata = { |
|
6
|
title: `Icons`, |
|
7
|
} |
|
8
|
|
|
9
|
# {metadata.title} |
|
10
|
|
|
11
|
In this guide, you'll learn how to install and use Medusa UI icons. |
|
12
|
|
|
13
|
The Medusa UI icons package is a collection of React icon components from Medusa's design system. You can use these icons either in your Medusa Admin customizations, or in your standalone React projects. |
|
14
|
|
|
15
|
## Installation |
|
16
|
|
|
17
|
The Medusa UI icons package is available by default in your Medusa application, so you can use them in your Medusa Admin customizations without any additional installation steps. |
|
18
|
|
|
19
|
### Installation in Standalone Projects |
|
20
|
|
|
21
|
<Prerequisites |
|
22
|
items={[ |
|
23
|
{ |
|
24
|
text: "React 16.8+ installed in your project.", |
|
25
|
link: "https://react.dev/", |
|
26
|
} |
|
27
|
]} |
|
28
|
/> |
|
29
|
|
|
30
|
To install the Medusa UI icons package in your React-based project, run the following command: |
|
31
|
|
|
32
|
```bash npm2yarn |
|
33
|
npm install @medusajs/icons |
|
34
|
``` |
|
35
|
|
|
36
|
--- |
|
37
|
|
|
38
|
## Usage |
|
39
|
|
|
40
|
You can import and use the icons in your React components: |
|
41
|
|
|
42
|
```tsx |
|
43
|
import { Sun } from "@medusajs/icons" |
|
44
|
|
|
45
|
export default function Component() { |
|
46
|
return ( |
|
47
|
<Sun /> |
|
48
|
) |
|
49
|
} |
|
50
|
``` |
|
51
|
|
|
52
|
--- |
|
53
|
|
|
54
|
## Icons List |
|
55
|
|
|
56
|
Below is a list of all the icons available in the Medusa UI design system. Click on any icon to copy its component name. |
|
57
|
|
|
58
|
<IconSearch /> |
|
59
|
|
|
60
|
--- |
|
61
|
|
|
62
|
## Icon Props |
|
63
|
|
|
64
|
Icons accept all props that an `svg` element accepts. |
|
65
|
|
|
66
|
### Icon Color |
|
67
|
|
|
68
|
By default, outline icons' stroke color and solid icon's fill color are set to `currentColor`. |
|
69
|
|
|
70
|
You can set a different color by passing the `color` prop. |
|
71
|
|
|
72
|
<ComponentExample name="icon-color" /> |
|
73
|
|
|
74
|
You can also use a CSS class by passing the `className` prop. |
|
75
|
|
|
76
|
<ComponentExample name="icon-color-classes" /> |
|
77
|
|
|
78
|
### Icon Size |
|
79
|
|
|
80
|
All icon's width and height are `20px` and it's not possible to change them. |