Tooltip
The <Tooltip> component displays additional information when users hover over text or code elements. Use tooltips to provide context, definitions, or explanations without cluttering your documentation.
Usage
Documentation becomes more interactive when you add tooltips to key terms.
Variants
Rich content
You can include rich content with custom positioning for more detailed explanations
Code tooltips
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.
Multiple code tooltips
Properties
Text tooltip 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 between the tooltip and the trigger element (px).
Code tooltip 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.
Custom styling
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:
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: