The DlTooltip inline component displays contextual information when hovering or focusing an element. It wraps content (or inline text) and shows a tooltip using the Nuxt UI Tooltip component.
Features
- š¬ quick, declarative tooltip composition
- š configurable position
- š§© theme-friendly visual adjustments
- āæ keyboard support
Usage
Use :dl-tooltip[...] as an inline component with the trigger content as the default slot, and pass the tooltip text as the tooltip prop.
Result: Read more
With a label
Use label to render trigger instead of slot. It will be ignored if default slot will be defined.
Result: Read more
With a different position
You can set the tooltip position using the side prop.
Result: Read more
With code as a trigger
DlTooltip can also display code as the trigger. Since the slot parser may escape special characters, use the label prop with Markdown syntax to render code formatting.
Result: readMore
Props
Here are the properties you can use with the DlTooltip component. Each property should be set on an individual component instance; they do not affect the global configuration. More about defining properties in MDC components you can read here.
| name | type | default | description |
|---|---|---|---|
label | string | undefined | Inline content to render as the trigger. Ignored when |
tooltip | string | undefined | Tooltip text to display. |
side |
| 'top' | Position of the tooltip. |
lockWidth | boolean | false | Whether to lock the tooltip width to the trigger width. |
iui | Record<string, string> | undefined | Special property dedicated to inline components, can be used to add TW classes for certain component markup elements. |
Slots
| name | description |
|---|---|
default | Tooltip label to display. |
Styling
Styling from Markdown
Every DocLayer component can be styled directly within your Markdown file using dedicated slot/property configuration. This allows you to customize the appearance of the component's markup elements without modifying global styles. More about components styling you can read here.
Below you'll find the default set of Tailwind classes for the component's dedicated markup elements.
CSS Variables
Here is a set of CSS variables you can use to customize the appearance of the DlTooltip component globally. More about theming and styling with CSS variables, you can read here.
CSS Utilities
Below are the CSS utility classes used by the DlTooltip component. They make use of the CSS variables described above and define the default styling for the component's markup elements.
