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
+65-96Lines changed: 65 additions & 96 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,65 +13,6 @@ 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:
17
-
18
-
<CodeBlocktitle="styles.css">
19
-
```css maxLines=10
20
-
21
-
.petstore-table {
22
-
background-color: white;
23
-
border: 1pxsolid#DEDEE1;
24
-
border-radius: 4px;
25
-
}
26
-
27
-
.dark.petstore-table {
28
-
background-color: #1e1e1e;
29
-
border: 1pxsolid#2e2e2e;
30
-
}
31
-
32
-
.petstore-tablethead {
33
-
position: sticky;
34
-
top: 0;
35
-
}
36
-
37
-
.petstore-tabletheadtr {
38
-
background-color: #edecee;
39
-
border: 1pxsolid#DEDEE1;
40
-
border-radius: 4px4px0px0px;
41
-
}
42
-
43
-
.dark.petstore-tabletheadtr {
44
-
background-color: #2e2e2e;
45
-
border: 1pxsolid#2e2e2e;
46
-
}
47
-
48
-
.petstore-tableth {
49
-
padding: 6px;
50
-
}
51
-
52
-
.petstore-tabletbodytd {
53
-
padding: 6px;
54
-
}
55
-
56
-
.petstore-tabletbodytr:nth-child(odd) {
57
-
border: 1pxsolid#DEDEE1;
58
-
}
59
-
.petstore-tabletbodytr:nth-child(even) {
60
-
border: 1pxsolid#DEDEE1;
61
-
background-color: #f7f6f8;
62
-
}
63
-
64
-
.dark.petstore-tabletbodytr:nth-child(odd) {
65
-
border: 1pxsolid#2e2e2e;
66
-
}
67
-
68
-
.dark.petstore-tabletbodytr:nth-child(even) {
69
-
border: 1pxsolid#2e2e2e;
70
-
background-color: #2e2e2e;
71
-
}
72
-
```
73
-
</CodeBlock>
74
-
75
16
<Steps>
76
17
### Create `styles.css`
77
18
@@ -118,60 +59,88 @@ For customizing the background, logo, font, and layout of your Docs via Fern's b
118
59
check out the [Global Configuration](/learn/docs/getting-started/global-configuration).
119
60
</Note>
120
61
121
-
## Hiding docs components
122
-
123
-
You can use custom CSS to hide specific Fern docs components that you don't want to display. This is useful for removing UI elements that aren't relevant to your documentation or user experience.
Hide the "Open in ChatGPT" and "Open in Claude" buttons that appear on documentation pages:
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.
130
69
70
+
<CodeBlock title="styles.css">
131
71
```css
132
72
.fern-page-actions {
133
73
display: none !important;
134
74
}
135
75
```
76
+
</CodeBlock>
136
77
137
-
<Note>
138
-
This is particularly useful for authenticated content where these external AI tools shouldn't have access.
139
-
</Note>
140
-
</Accordion>
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">
141
83
142
-
<Accordiontitle="Other UI elements">
143
-
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.
84
+
You can use custom CSS to create brand-specific styling for tables, components, and other elements in your documentation.
144
85
145
-
Common patterns include:
146
-
- `.fern-*` - Fern-specific components
147
-
- Use `!important` to ensure your styles override default styles
148
-
- Consider both light and dark mode styling if needed
149
-
</Accordion>
150
-
</AccordionGroup>
86
+
<CodeBlocktitle="styles.css">
87
+
```css maxLines=10
151
88
152
-
### Finding component selectors
89
+
.petstore-table {
90
+
background-color: white;
91
+
border: 1pxsolid#DEDEE1;
92
+
border-radius: 4px;
93
+
}
153
94
154
-
To hide other components:
95
+
.dark.petstore-table {
96
+
background-color: #1e1e1e;
97
+
border: 1pxsolid#2e2e2e;
98
+
}
155
99
156
-
<Steps>
157
-
<Steptitle="Inspect the element">
158
-
Right-click on the component you want to hide and select "Inspect Element" in your browser's developer tools.
159
-
</Step>
100
+
.petstore-tablethead {
101
+
position: sticky;
102
+
top: 0;
103
+
}
160
104
161
-
<Steptitle="Find the CSS class">
162
-
Look for CSS classes that start with `fern-` or other identifying class names in the HTML structure.
163
-
</Step>
105
+
.petstore-tabletheadtr {
106
+
background-color: #edecee;
107
+
border: 1pxsolid#DEDEE1;
108
+
border-radius: 4px4px0px0px;
109
+
}
164
110
165
-
<Steptitle="Add CSS rule">
166
-
Add a CSS rule to your `styles.css` file using the class name:
0 commit comments