Skip to content

Commit 636e2a3

Browse files
committed
docs: (library) update library documentation + add utilities section
1 parent 83ca088 commit 636e2a3

1 file changed

Lines changed: 112 additions & 5 deletions

File tree

library/README.md

Lines changed: 112 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@
99
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
1010
<a href="#-getting-started">Getting Started</a>
1111
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
12+
<a href="#-utilities">Utilities</a>
13+
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
1214
<a href="#-license">License</a>
1315
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
1416
<a href="#-contribute">Contribute</a>
1517
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
1618
<a href="https://marketplace.visualstudio.com/items?itemName=miguelsolorio.symbols">VSCode Theme</a>
1719

18-
![React Badge](https://img.shields.io/badge/React-61DAFB?logo=react&logoColor=000&style=flat)
19-
![SWC Badge](https://img.shields.io/badge/SWC-F8C457?logo=swc&logoColor=000&style=flat)
20+
![React Badge](https://img.shields.io/badge/Library-61DAFB?logo=react&logoColor=000&style=flat)
21+
![React Router Badge](https://img.shields.io/badge/Website-CA4245?logo=reactrouter&logoColor=fff&style=flat)
2022
[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fpheralb%2Freact-symbols%2Fbadge%3Fref%3Dmain&style=flat)](https://actions-badge.atrox.dev/pheralb/react-symbols/goto?ref=main)
2123
![GitHub releases](https://img.shields.io/github/release/pheralb/react-symbols)
2224
![GitHub stars](https://img.shields.io/github/stars/pheralb/react-symbols)
@@ -57,15 +59,50 @@ bun add @react-symbols/icons
5759

5860
### - Usage
5961

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+
6081
```jsx
61-
import { Angular, Astro, Document } from "@react-symbols/icons";
82+
import { Astro, Docker } from "@react-symbols/icons/files";
6283

6384
const MyComponent = () => {
6485
return (
6586
<>
6687
<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} />
69106
</>
70107
);
71108
};
@@ -100,6 +137,76 @@ const MyComponent = () => {
100137
export default MyComponent;
101138
```
102139

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+
103210
## 📦 Stack
104211

105212
This is a monorepo project created with:

0 commit comments

Comments
 (0)