Tooltips
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.
Tooltips in code
The code tooltip component allows you to provide contextual information for variables and values within your code examples. When users hover over highlighted code, they can see explanations, documentation links, or additional context without leaving the code example.
Basic Tooltip
Markdown
Multiple Tooltips
Markdown
Properties
Key-value pairs where the values are displayed in your code blocks.
Key-value pairs where the values are displayed in the tooltips. The Key for tooltips
must match the Key for data
.
Style a code tooltip
To customize code tooltips, target the .fern-mdx-tooltip-content
selector. You can override CSS variables or add any custom styles:
Tooltips for text
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.
Text tooltips
Markdown
Documentation becomes more interactive when you add tooltips to key terms. You can include rich content with custom positioning for more detailed explanations.
Properties
The content to display in the tooltip. Can be a simple string or React component for more complex content.
Controls which side of the element the tooltip appears on.
The distance in pixels between the tooltip and the trigger element.
Style a text tooltip
To customize text tooltips, target the .fern-mdx-tooltip-trigger
selector. You can override CSS variables for common customizations or add any custom styles: