Skip to content

Commit 830ad7a

Browse files
authored
Document tooltip custom styling (Docs) (#601)
1 parent e7298fd commit 830ad7a

File tree

1 file changed

+28
-1
lines changed
  • fern/products/docs/pages/component-library/default-components

1 file changed

+28
-1
lines changed

fern/products/docs/pages/component-library/default-components/tooltips.mdx

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,17 @@ const api = axios.create({
140140
Key-value pairs where the values are displayed in the tooltips. The Key for `tooltips` must match the Key for `data`.
141141
</ParamField>
142142

143+
### Style a code tooltip
144+
145+
To customize code tooltips, target the `.fern-mdx-tooltip-content` selector. You can override CSS variables or add any custom styles:
146+
147+
```css
148+
.fern-mdx-tooltip-content {
149+
--tooltip-padding-x: 1.5rem; /* Horizontal padding inside tooltip */
150+
/* Add custom styles here */
151+
}
152+
```
153+
143154
## Tooltips for text
144155

145156
The text tooltip component allows you to provide contextual information for any text element in your documentation. When users hover over them, they can see definitions or additional context without leaving the current page.
@@ -178,4 +189,20 @@ You can include <Tooltip
178189

179190
<ParamField path="sideOffset" type="number" required={false} default={4}>
180191
The distance in pixels between the tooltip and the trigger element.
181-
</ParamField>
192+
</ParamField>
193+
194+
195+
### Style a text tooltip
196+
197+
To customize text tooltips, target the `.fern-mdx-tooltip-trigger` selector. You can override CSS variables for common customizations or add any custom styles:
198+
199+
```css
200+
.fern-mdx-tooltip-trigger {
201+
--tooltip-underline-color: blue; /* Color of the underline in default state */
202+
--tooltip-underline-hover-color: green; /* Color of the underline on hover */
203+
--tooltip-underline-thickness: 2px; /* Thickness of the underline */
204+
--tooltip-underline-offset: 2px; /* Distance between text and underline */
205+
--tooltip-transition-duration: 0.10s; /* Hover transition speed */
206+
/* Add custom styles here */
207+
}
208+
```

0 commit comments

Comments
 (0)