You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: fern/products/docs/pages/component-library/custom-components/custom-css-js.mdx
+71-47Lines changed: 71 additions & 47 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,75 @@ Adding Custom Components is available on the Pro plan.
13
13
14
14
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.
15
15
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
+
<CodeBlocktitle="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
+
<CodeBlocktitle="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
+
<Accordiontitle="Adding custom styling">
83
+
84
+
You can use custom CSS to create brand-specific styling for tables, components, and other elements in your documentation.
17
85
18
86
<CodeBlocktitle="styles.css">
19
87
```css maxLines=10
@@ -71,52 +139,8 @@ Here's an example of what you can do with custom CSS:
71
139
}
72
140
```
73
141
</CodeBlock>
74
-
75
-
<Steps>
76
-
### Create `styles.css`
77
-
78
-
Add a `styles.css` file and include it in your `fern/` project:
79
-
80
-
<CodeBlocktitle="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
-
<CodeBlocktitle="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).
0 commit comments