|
9 | 9 | <span> ❖ </span> |
10 | 10 | <a href="#-getting-started">Getting Started</a> |
11 | 11 | <span> ❖ </span> |
| 12 | +<a href="#-utilities">Utilities</a> |
| 13 | +<span> ❖ </span> |
12 | 14 | <a href="#-license">License</a> |
13 | 15 | <span> ❖ </span> |
14 | 16 | <a href="#-contribute">Contribute</a> |
15 | 17 | <span> ❖ </span> |
16 | 18 | <a href="https://marketplace.visualstudio.com/items?itemName=miguelsolorio.symbols">VSCode Theme</a> |
17 | 19 |
|
18 | | - |
19 | | - |
| 20 | + |
| 21 | + |
20 | 22 | [](https://actions-badge.atrox.dev/pheralb/react-symbols/goto?ref=main) |
21 | 23 |  |
22 | 24 |  |
@@ -57,15 +59,50 @@ bun add @react-symbols/icons |
57 | 59 |
|
58 | 60 | ### - Usage |
59 | 61 |
|
| 62 | +**Using file and folder icons:** |
| 63 | + |
| 64 | +```jsx |
| 65 | +import { Astro, FolderBlue } from "@react-symbols/icons"; |
| 66 | + |
| 67 | +const MyComponent = () => { |
| 68 | + return ( |
| 69 | + <> |
| 70 | + <Angular width={128} height={128} /> |
| 71 | + <FolderBlue width={128} height={128} /> |
| 72 | + </> |
| 73 | + ); |
| 74 | +}; |
| 75 | + |
| 76 | +export default MyComponent; |
| 77 | +``` |
| 78 | + |
| 79 | +**Only file icons:** |
| 80 | + |
60 | 81 | ```jsx |
61 | | -import { Angular, Astro, Document } from "@react-symbols/icons"; |
| 82 | +import { Astro, Docker } from "@react-symbols/icons/files"; |
62 | 83 |
|
63 | 84 | const MyComponent = () => { |
64 | 85 | return ( |
65 | 86 | <> |
66 | 87 | <Angular width={128} height={128} /> |
67 | | - <Astro width={128} height={128} /> |
68 | | - <Document width={128} height={128} /> |
| 88 | + <Docker width={128} height={128} /> |
| 89 | + </> |
| 90 | + ); |
| 91 | +}; |
| 92 | + |
| 93 | +export default MyComponent; |
| 94 | +``` |
| 95 | + |
| 96 | +**Only folder icons:** |
| 97 | + |
| 98 | +```jsx |
| 99 | +import { FolderConfig, FolderApp } from "@react-symbols/icons/folders"; |
| 100 | + |
| 101 | +const MyComponent = () => { |
| 102 | + return ( |
| 103 | + <> |
| 104 | + <FolderConfig width={128} height={128} /> |
| 105 | + <FolderApp width={128} height={128} /> |
69 | 106 | </> |
70 | 107 | ); |
71 | 108 | }; |
@@ -100,6 +137,76 @@ const MyComponent = () => { |
100 | 137 | export default MyComponent; |
101 | 138 | ``` |
102 | 139 |
|
| 140 | +## ⚙️ Utilities |
| 141 | + |
| 142 | +### `FileIcon` |
| 143 | + |
| 144 | +Get the [file icon](https://react-symbols.pheralb.dev) component for a given file name or extension. |
| 145 | + |
| 146 | +- `getIconForFile` function: |
| 147 | + |
| 148 | +```tsx |
| 149 | +import { getIconForFile } from "@react-symbols/icons/utils"; |
| 150 | + |
| 151 | +const Page = () => { |
| 152 | + return ( |
| 153 | + <main> |
| 154 | + {getIconForFile({ |
| 155 | + fileName: "example.ts", |
| 156 | + })} |
| 157 | + </main> |
| 158 | + ); |
| 159 | +}; |
| 160 | +``` |
| 161 | + |
| 162 | +- `FileIcon` component: |
| 163 | + |
| 164 | +```tsx |
| 165 | +import { FileIcon } from "@react-symbols/icons/utils"; |
| 166 | + |
| 167 | +const Page = () => { |
| 168 | + return ( |
| 169 | + <main> |
| 170 | + <FileIcon fileName="example.ts" /> |
| 171 | + </main> |
| 172 | + ); |
| 173 | +}; |
| 174 | +``` |
| 175 | + |
| 176 | +### `FolderIcon` |
| 177 | + |
| 178 | +Get the [folder icon](https://react-symbols.pheralb.dev/folders) component for a given folder name. |
| 179 | + |
| 180 | +- `getIconForFolder` function: |
| 181 | + |
| 182 | +```tsx |
| 183 | +import { getIconForFolder } from "@react-symbols/icons/utils"; |
| 184 | + |
| 185 | +const Page = () => { |
| 186 | + return ( |
| 187 | + <main> |
| 188 | + {getIconForFolder({ |
| 189 | + folderName: "github", |
| 190 | + })} |
| 191 | + </main> |
| 192 | + ); |
| 193 | +}; |
| 194 | +``` |
| 195 | + |
| 196 | +- `FolderIcon` component: |
| 197 | + |
| 198 | +```tsx |
| 199 | +import { FolderIcon } from "@react-symbols/icons/utils"; |
| 200 | + |
| 201 | +const Page = () => { |
| 202 | + return ( |
| 203 | + <main> |
| 204 | + <FolderIcon folderName="github" /> |
| 205 | + </main> |
| 206 | + ); |
| 207 | +}; |
| 208 | +``` |
| 209 | + |
103 | 210 | ## 📦 Stack |
104 | 211 |
|
105 | 212 | This is a monorepo project created with: |
|
0 commit comments