Skip to content

Commit c2aae95

Browse files
docs: Add documentation for hiding docs components using CSS (#385)
Co-authored-by: promptless[bot] <179508745+promptless[bot]@users.noreply.github.com> Co-authored-by: Devin Logan <[email protected]>
1 parent e670d4a commit c2aae95

File tree

1 file changed

+71
-47
lines changed

1 file changed

+71
-47
lines changed

fern/products/docs/pages/component-library/custom-components/custom-css-js.mdx

Lines changed: 71 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,75 @@ Adding Custom Components is available on the Pro plan.
1313

1414
You can add custom CSS to your docs to further customize the look and feel. The defined class names are applied across all MDX files.
1515

16-
Here's an example of what you can do with custom CSS:
16+
<Steps>
17+
### Create `styles.css`
18+
19+
Add a `styles.css` file and include it in your `fern/` project:
20+
21+
<CodeBlock title="Add the styles.css file">
22+
```bash {5}
23+
fern/
24+
├─ openapi/
25+
├─ pages/
26+
├─ images/
27+
├─ styles.css
28+
├─ docs.yml
29+
└─ fern.config.json
30+
```
31+
</CodeBlock>
32+
33+
### Edit `docs.yml`
34+
35+
In `docs.yml`, specify the path to the `styles.css` file:
36+
37+
<CodeBlock title="docs.yml">
38+
```yaml
39+
css: ./styles.css
40+
```
41+
</CodeBlock>
42+
43+
### Add multiple custom CSS files (optional)
44+
45+
You can specify any number of custom CSS files:
46+
47+
<CodeBlock title="docs.yml">
48+
```yaml
49+
css:
50+
- ./css/header-styles.css
51+
- ./css/footer-styles.css
52+
```
53+
</CodeBlock>
54+
55+
</Steps>
56+
57+
<Note>
58+
For customizing the background, logo, font, and layout of your Docs via Fern's built-in styling,
59+
check out the [Global Configuration](/learn/docs/getting-started/global-configuration).
60+
</Note>
61+
62+
### Common use cases
63+
64+
<AccordionGroup>
65+
<Accordion title="Hiding page elements">
66+
67+
You can use custom CSS to hide specific Fern docs components that you don't want
68+
to display.
69+
70+
<CodeBlock title="styles.css">
71+
```css
72+
.fern-page-actions {
73+
display: none !important;
74+
}
75+
```
76+
</CodeBlock>
77+
78+
Commonly hidden components include `.fern-page-actions` (**Open in
79+
ChatGPT**, **Open in Claude**, and **Copy Page** buttons) and `.fern-layout-footer-toolbar`
80+
(Fern feedback widget). You can target other Fern UI components using their CSS class names. Use your browser's developer tools to inspect elements and find their class names.
81+
</Accordion>
82+
<Accordion title="Adding custom styling">
83+
84+
You can use custom CSS to create brand-specific styling for tables, components, and other elements in your documentation.
1785

1886
<CodeBlock title="styles.css">
1987
```css maxLines=10
@@ -71,52 +139,8 @@ Here's an example of what you can do with custom CSS:
71139
}
72140
```
73141
</CodeBlock>
74-
75-
<Steps>
76-
### Create `styles.css`
77-
78-
Add a `styles.css` file and include it in your `fern/` project:
79-
80-
<CodeBlock title="Add the styles.css file">
81-
```bash {5}
82-
fern/
83-
├─ openapi/
84-
├─ pages/
85-
├─ images/
86-
├─ styles.css
87-
├─ docs.yml
88-
└─ fern.config.json
89-
```
90-
</CodeBlock>
91-
92-
### Edit `docs.yml`
93-
94-
In `docs.yml`, specify the path to the `styles.css` file:
95-
96-
<CodeBlock title="docs.yml">
97-
```yaml
98-
css: ./styles.css
99-
```
100-
</CodeBlock>
101-
102-
### Add multiple custom CSS files (optional)
103-
104-
You can specify any number of custom CSS files:
105-
106-
<CodeBlock title="docs.yml">
107-
```yaml
108-
css:
109-
- ./css/header-styles.css
110-
- ./css/footer-styles.css
111-
```
112-
</CodeBlock>
113-
114-
</Steps>
115-
116-
<Note>
117-
For customizing the background, logo, font, and layout of your Docs via Fern's built-in styling,
118-
check out the [Global Configuration](/learn/docs/getting-started/global-configuration).
119-
</Note>
142+
</Accordion>
143+
</AccordionGroup>
120144

121145
## Custom JavaScript
122146

0 commit comments

Comments
 (0)