Skip to content

Commit b57fe8e

Browse files
devin-ai-integration[bot]chdeskurdevalog
authored
docs: document custom icon functionality for docs.yml and navigation (#1703)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Catherine Deskur <[email protected]> Co-authored-by: Devin Logan <[email protected]>
1 parent 67ad044 commit b57fe8e

File tree

5 files changed

+59
-35
lines changed

5 files changed

+59
-35
lines changed

.vale/styles/FernStyles/Headings.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,4 @@ exceptions:
114114
- RBAC
115115
- YAML
116116
- fern.config.json
117+
- Font Awesome

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

Lines changed: 8 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: ./assets/icons/login-icon.svg
243245
- type: github
244246
value: https://github.com/example-company/fern
245247
- type: dropdown
@@ -278,11 +280,15 @@ navbar-links:
278280
</ParamField>
279281

280282
<ParamField path="icon" type="string" required={false} toc={true}>
281-
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.
283+
The icon to be used in the button. This icon will appear to the **left** of the text content.
284+
285+
<Markdown src="/snippets/icons.mdx" />
282286
</ParamField>
283287

284288
<ParamField path="rightIcon" type="string" required={false} toc={true}>
285-
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.
289+
The icon to be used in the button. This icon will appear to the **right** of the text content.
290+
291+
<Markdown src="/snippets/icons.mdx" />
286292

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

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

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -199,17 +199,22 @@ 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.
203+
204+
<Markdown src="/snippets/icons.mdx" />
203205

204206
{/* <!-- vale off --> */}
205-
```yaml Example navigation config with icons
207+
```yaml Example config with different icon files {3, 6, 9}
206208
navigation:
207209
- section: Home
208-
icon: fa-regular fa-home
210+
icon: fa-regular fa-home # Font Awesome icon
209211
contents:
210-
- page: My page
211-
icon: fa-regular fa-file
212-
path: ./pages/my-page.mdx
212+
- page: Introduction
213+
icon: ./assets/icons/intro-icon.svg # Custom image file
214+
path: ./pages/intro.mdx
215+
- page: Custom Features
216+
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>" # Inline SVG
217+
path: ./pages/custom.mdx
213218
- api: API Reference
214219
icon: fa-regular fa-puzzle
215220
```
@@ -237,7 +242,9 @@ navigation:
237242

238243
## Tabs
239244

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.
245+
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`.
246+
247+
<Markdown src="/snippets/icons.mdx" />
241248

242249
<CodeBlock title="docs.yml">
243250
{/* <!-- vale off --> */}
@@ -246,13 +253,13 @@ Within the navigation, you can add `tabs`. Tabs are used to group sections toget
246253
tabs:
247254
api:
248255
display-name: API Reference
249-
icon: puzzle
256+
icon: puzzle # Font Awesome icon
250257
help:
251258
display-name: Help center
252-
icon: home
259+
icon: ./assets/icons/help-icon.svg # Custom image file
253260
github:
254261
display-name: GitHub
255-
icon: brands github
262+
icon: brands github # Font Awesome icon
256263
href: https://github.com/fern-api/fern
257264
258265
navigation:

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

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ navigation:
5757
```
5858
</CodeBlock>
5959
<CodeBlock title="products/product-b.yml">
60+
6061
```yaml
6162
tabs:
6263
api:
@@ -90,28 +91,33 @@ tabs:
9091
9192
To define a product, add an item to the `products` list in `docs.yml`, specifying the `display-name` and `path`.
9293

93-
The optional parameters are: `image`, `icon`, `subtitle`, `slug`, and `versions`.
94-
95-
<Note>If you provide both an `image` and an `icon`, the `image` will take precedence.</Note>
96-
97-
The below example is a `docs.yml` configuration for a site with two products, Product A and Product B.
98-
99-
<CodeBlock title="docs.yml">
100-
```yaml {2-3, 8-9}
101-
products:
102-
- display-name: Product A
103-
path: ./products/product-a.yml
104-
icon: fa-solid fa-leaf # optional
105-
slug: product-a # optional
106-
subtitle: Product A subtitle # optional
107-
108-
- 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
113-
```
114-
</CodeBlock>
94+
The optional parameters are: `image`, `icon`, `subtitle`, `slug`, and `versions`. If you provide both an `image` and an `icon`, the `image` will take precedence.
95+
96+
<Note title="Product icons">
97+
98+
<Markdown src="/snippets/icons.mdx" />
99+
100+
<CodeBlock title="docs.yml">
101+
```yaml maxLines=5
102+
products:
103+
- display-name: Product A
104+
path: ./products/product-a.yml
105+
icon: fa-solid fa-leaf # Font Awesome icon
106+
slug: product-a
107+
subtitle: Product A subtitle
108+
- display-name: Product B
109+
path: ./products/product-b.yml
110+
icon: ./assets/icons/product-b-icon.svg # Custom image file
111+
slug: product-b
112+
subtitle: Product B subtitle
113+
- display-name: Product C
114+
path: ./products/product-c.yml
115+
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>" # Inline SVG
116+
slug: product-c
117+
subtitle: Product C subtitle
118+
```
119+
</CodeBlock>
120+
</Note>
115121
</Step>
116122
<Step title="Remove extra navigation from docs.yml">
117123

@@ -324,4 +330,4 @@ The dropdown menus for product and version selectors can be customized using the
324330
<img src="webflow-version-selector.avif" alt="Example of a styled version selector" />
325331
</Frame>
326332
</Tab>
327-
</Tabs>
333+
</Tabs>

fern/snippets/icons.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Icons support three formats:
2+
- **Font Awesome icons**: Use icon names like `fa-solid fa-rocket`. Pro and Brand Icons from Font Awesome are supported.
3+
- **Custom image files**: Use relative paths to image files (e.g., `./assets/icons/my-icon.svg` or `../assets/icons/my-icon.png`). Paths are relative to the `docs.yml` file.
4+
- **Inline SVG**: Provide an SVG string wrapped in quotes (e.g., `"<svg>...</svg>"`).

0 commit comments

Comments
 (0)