Skip to content

Commit d424c6e

Browse files
authored
Document text tooltips (Docs) (#597)
1 parent c882db1 commit d424c6e

File tree

1 file changed

+56
-16
lines changed
  • fern/products/docs/pages/component-library/default-components

1 file changed

+56
-16
lines changed

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

Lines changed: 56 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,16 @@
11
---
2-
title: 'Tooltips'
3-
description: 'Add interactive tooltips to your documentation.'
2+
title: Tooltips
3+
description: Add interactive tooltips to your documentation.
44
---
55

66
The Tooltips component provides a way to display additional information when users hover over an element. This is particularly useful for providing context or explanations without cluttering the interface.
77

8-
## Tooltips in CodeBlocks
8+
## Tooltips in code
99

10-
## Properties
11-
12-
<ParamField path="data" type="object" required={true}>
13-
Key-value pairs where the values are displayed in your code blocks.
14-
</ParamField>
15-
16-
<ParamField path="tooltips" type="object" required={false}>
17-
Key-value pairs where the values are displayed in the tooltips. The Key for `tooltips` must match the Key for `data`.
18-
</ParamField>
19-
20-
21-
## Examples
10+
The code tooltip component allows you to provide contextual information for variables and
11+
values within your code examples. When users hover over highlighted code, they
12+
can see explanations, documentation links, or additional context without leaving
13+
the code example.
2214

2315
<Tabs>
2416
<Tab title="Basic Tooltip">
@@ -138,4 +130,52 @@ const api = axios.create({
138130
</Tab>
139131
</Tabs>
140132

141-
## Tooltips for Text
133+
### Properties
134+
135+
<ParamField path="data" type="object" required={true}>
136+
Key-value pairs where the values are displayed in your code blocks.
137+
</ParamField>
138+
139+
<ParamField path="tooltips" type="object" required={false}>
140+
Key-value pairs where the values are displayed in the tooltips. The Key for `tooltips` must match the Key for `data`.
141+
</ParamField>
142+
143+
## Tooltips for text
144+
145+
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.
146+
147+
<Tabs>
148+
<Tab title="Text tooltips">
149+
Documentation becomes more interactive when you add <Tooltip tip="A simple tooltip for basic explanations">tooltips</Tooltip> to key terms. You can include <Tooltip tip={<div><strong>Rich Content</strong><br /><br />Supports HTML formatting, <a href="https://buildwithfern.com/" target="_blank">external links</a>, and <code>inline code</code></div>} side="right">rich content</Tooltip> with custom positioning for more detailed explanations.
150+
</Tab>
151+
<Tab title="Markdown">
152+
```tsx
153+
Documentation becomes more interactive when you add <Tooltip tip="A simple tooltip for basic explanations">tooltips</Tooltip> to key terms.
154+
155+
You can include <Tooltip
156+
tip={
157+
<div>
158+
<strong>Rich Content</strong>
159+
<br /><br />
160+
Supports HTML formatting, <a href="https://buildwithfern.com/" target="_blank">external links</a>, and <code>inline code</code>
161+
</div>
162+
}
163+
side="right"
164+
>rich content</Tooltip> with custom positioning for more detailed explanations.
165+
```
166+
</Tab>
167+
</Tabs>
168+
169+
### Properties
170+
171+
<ParamField path="tip" type="string | ReactNode" required={true}>
172+
The content to display in the tooltip. Can be a simple string or React component for more complex content.
173+
</ParamField>
174+
175+
<ParamField path="side" type="'top' | 'right' | 'bottom' | 'left'" required={false} default="top">
176+
Controls which side of the element the tooltip appears on.
177+
</ParamField>
178+
179+
<ParamField path="sideOffset" type="number" required={false} default={4}>
180+
The distance in pixels between the tooltip and the trigger element.
181+
</ParamField>

0 commit comments

Comments
 (0)