Skip to content

Commit 232a2ba

Browse files
docs: document custom icon functionality for docs.yml and navigation
- Add documentation for custom icons using file: prefix for local files - Document inline SVG icon support using < > wrapper - Update navbar-links section with icon format examples - Update sidebar icons section with comprehensive examples for all three formats - Update products section with detailed icon format documentation - Add examples showing Font Awesome, custom image files, and inline SVG usage Co-Authored-By: Catherine Deskur <[email protected]>
1 parent 6e5d7bc commit 232a2ba

File tree

3 files changed

+104
-15
lines changed

3 files changed

+104
-15
lines changed

fern/products/docs/pages/customization/what-is-docs-yml.mdx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,12 @@ navbar-links:
236236
- type: minimal
237237
text: Contact support
238238
href: https://example.com/support
239+
icon: fa-solid fa-headset
239240
- type: filled
240241
text: Login
241242
href: https://example.com/login
242243
rounded: false
244+
icon: file:assets/icons/login-icon.svg
243245
- type: github
244246
value: https://github.com/example-company/fern
245247
```
@@ -265,11 +267,19 @@ navbar-links:
265267
</ParamField>
266268

267269
<ParamField path="icon" type="string" required={false} toc={true}>
268-
The [Font Awesome icon](https://fontawesome.com/icons) to be used in the button. This icon will appear to the **left** of the text content. Pro and Brand Icons from Font Awesome are supported.
270+
The icon to be used in the button. This icon will appear to the **left** of the text content. Supports three formats:
271+
272+
- **Font Awesome icons**: Use icon names like `fa-solid fa-rocket`. Pro and Brand Icons from Font Awesome are supported.
273+
- **Custom image files**: Use `file:` prefix followed by the file ID (e.g., `file:my-icon`). The file must be uploaded to your docs assets.
274+
- **Inline SVG**: Provide an SVG string wrapped in `< >` (e.g., `<svg>...</svg>`).
269275
</ParamField>
270276

271277
<ParamField path="rightIcon" type="string" required={false} toc={true}>
272-
The [Font Awesome icon](https://fontawesome.com/icons) to be used in the button. This icon will appear to the **right** of the text content. Pro and Brand Icons from Font Awesome are supported.
278+
The icon to be used in the button. This icon will appear to the **right** of the text content. Supports three formats:
279+
280+
- **Font Awesome icons**: Use icon names like `fa-solid fa-arrow-right`. Pro and Brand Icons from Font Awesome are supported.
281+
- **Custom image files**: Use `file:` prefix followed by the file ID (e.g., `file:my-icon`). The file must be uploaded to your docs assets.
282+
- **Inline SVG**: Provide an SVG string wrapped in `< >` (e.g., `<svg>...</svg>`).
273283

274284
By default, the `rightIcon` for a `filled` button is set to `arrow-right`.
275285
</ParamField>

fern/products/docs/pages/navigation/overview.mdx

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,16 @@ navigation:
199199

200200
## Sidebar icons
201201

202-
For icons to appear next to sections and pages, add the `icon` key. The value should be a valid [Font Awesome icon](https://fontawesome.com/icons) name. Pro and Brand Icons from Font Awesome are supported.
202+
Add icons next to sections and pages using the `icon` key. Icons support three formats:
203+
204+
- **Font Awesome icons**: Use icon names like `fa-regular fa-home`. Pro and Brand Icons from Font Awesome are supported.
205+
- **Custom image files**: Use `file:` prefix followed by the file ID (e.g., `file:my-icon`). The file must be uploaded to your docs assets.
206+
- **Inline SVG**: Provide an SVG string wrapped in `< >` (e.g., `<svg>...</svg>`).
207+
208+
### Font Awesome icons
203209

204210
{/* <!-- vale off --> */}
205-
```yaml Example navigation config with icons
211+
```yaml Example navigation config with Font Awesome icons
206212
navigation:
207213
- section: Home
208214
icon: fa-regular fa-home
@@ -215,6 +221,40 @@ navigation:
215221
```
216222
{/* <!-- vale on --> */}
217223

224+
### Custom image files
225+
226+
To use custom image files as icons, upload your image files to your docs assets folder, then reference them using the `file:` prefix followed by the relative path to the file.
227+
228+
{/* <!-- vale off --> */}
229+
```yaml Example navigation config with custom image icons
230+
navigation:
231+
- section: Products
232+
icon: file:assets/icons/products-icon.svg
233+
contents:
234+
- page: Product A
235+
icon: file:assets/icons/product-a.png
236+
path: ./pages/product-a.mdx
237+
- page: Product B
238+
icon: file:assets/icons/product-b.png
239+
path: ./pages/product-b.mdx
240+
```
241+
{/* <!-- vale on --> */}
242+
243+
### Inline SVG icons
244+
245+
You can also provide inline SVG strings directly in your configuration by wrapping them in `< >`.
246+
247+
{/* <!-- vale off --> */}
248+
```yaml Example navigation config with inline SVG icons
249+
navigation:
250+
- section: Custom Section
251+
icon: <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2L2 7v10c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V7l-10-5z"/></svg>
252+
contents:
253+
- page: Custom Page
254+
path: ./pages/custom-page.mdx
255+
```
256+
{/* <!-- vale on --> */}
257+
218258
## Links
219259

220260
You can add a link to an external page within your sidebar navigation with the following configuration:
@@ -237,7 +277,11 @@ navigation:
237277

238278
## Tabs
239279

240-
Within the navigation, you can add `tabs`. Tabs are used to group sections together. The example below shows tabs for `Help Center`, `API Reference`, and an external link to `Github`. Each tab has a `title` and `icon`. [Browse the icons available](https://fontawesome.com/icons) from Font Awesome. Pro and Brand Icons are supported.
280+
Within the navigation, you can add `tabs`. Tabs are used to group sections together. The example below shows tabs for `Help Center`, `API Reference`, and an external link to `Github`. Each tab has a `title` and `icon`. Icons support three formats:
281+
282+
- **Font Awesome icons**: Use icon names like `puzzle` or `fa-solid fa-puzzle`. [Browse the icons available](https://fontawesome.com/icons) from Font Awesome. Pro and Brand Icons are supported.
283+
- **Custom image files**: Use `file:` prefix followed by the file ID (e.g., `file:my-icon`). The file must be uploaded to your docs assets.
284+
- **Inline SVG**: Provide an SVG string wrapped in `< >` (e.g., `<svg>...</svg>`).
241285

242286
<CodeBlock title="docs.yml">
243287
{/* <!-- vale off --> */}

fern/products/docs/pages/navigation/products.mdx

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,22 +94,57 @@ The optional parameters are: `image`, `icon`, `subtitle`, `slug`, and `versions`
9494

9595
<Note>If you provide both an `image` and an `icon`, the `image` will take precedence.</Note>
9696

97-
The below example is a `docs.yml` configuration for a site with two products, Product A and Product B.
97+
### Product icons
98+
99+
Product icons support three formats:
100+
101+
- **Font Awesome icons**: Use icon names like `fa-solid fa-leaf`. Pro and Brand Icons from Font Awesome are supported.
102+
- **Custom image files**: Use `file:` prefix followed by the relative path to the file (e.g., `file:assets/icons/my-icon.svg`). The file must be in your docs assets folder.
103+
- **Inline SVG**: Provide an SVG string wrapped in `< >` (e.g., `<svg>...</svg>`).
104+
105+
#### Font Awesome icons
98106

99107
<CodeBlock title="docs.yml">
100-
```yaml {2-3, 8-9}
108+
```yaml
101109
products:
102110
- display-name: Product A
103111
path: ./products/product-a.yml
104-
icon: fa-solid fa-leaf # optional
105-
slug: product-a # optional
106-
subtitle: Product A subtitle # optional
112+
icon: fa-solid fa-leaf
113+
slug: product-a
114+
subtitle: Product A subtitle
115+
```
116+
</CodeBlock>
117+
118+
#### Custom image files
107119

120+
To use custom image files as product icons, upload your image files to your docs assets folder, then reference them using the `file:` prefix followed by the relative path.
121+
122+
<CodeBlock title="docs.yml">
123+
```yaml
124+
products:
125+
- display-name: Product A
126+
path: ./products/product-a.yml
127+
icon: file:assets/icons/product-a-icon.svg
128+
slug: product-a
129+
subtitle: Product A subtitle
108130
- display-name: Product B
109-
path: ./products/product-b/versions/latest/latest.yml # <-- default showing latest
110-
image: ./images/product-b.png # optional
111-
slug: product-b # optional
112-
subtitle: Product B subtitle # optional
131+
path: ./products/product-b.yml
132+
icon: file:assets/icons/product-b-icon.png
133+
slug: product-b
134+
subtitle: Product B subtitle
135+
```
136+
</CodeBlock>
137+
138+
#### Inline SVG icons
139+
140+
<CodeBlock title="docs.yml">
141+
```yaml
142+
products:
143+
- display-name: Product A
144+
path: ./products/product-a.yml
145+
icon: <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2L2 7v10c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V7l-10-5z"/></svg>
146+
slug: product-a
147+
subtitle: Product A subtitle
113148
```
114149
</CodeBlock>
115150
</Step>
@@ -324,4 +359,4 @@ The dropdown menus for product and version selectors can be customized using the
324359
<img src="webflow-version-selector.avif" alt="Example of a styled version selector" />
325360
</Frame>
326361
</Tab>
327-
</Tabs>
362+
</Tabs>

0 commit comments

Comments
 (0)