- Home
- Design system
- Web components
- Tooltip
Tooltip
DS Tooltip web component for accessible rich and plain text tooltips
Overview
ds-tooltip is a Web Component that renders an accessible tooltip using the Popover API. It supports both icon and text trigger modes, plain text and rich HTML content, customizable positioning, and hover/focus interactions with a minimum visible duration.
Options
Basic usage
By default, the simplest tooltip renders an info icon, with the content of the ds-tooltip displayed on hover as a tooltip.
Alternatively, for plain text tooltips the text attribute can be used instead of child elements.
Text anchor
Set type="ds-text" and provide inline content to use a text as the anchor that triggers instead of an icon. The child text becomes the clickable trigger, and the text attribute provides the popover body.
This works inline within an exising ds-text element as well:
Rich content
If you use the an icon anchor for the tooltip, the popover supports any HTML content, including structured layouts using SDS classes.
Subscriber details
Global multicarrier cellular connectivity built for IoT & M2M. Pay as you go with no commitments.
- Status
- Active
- Plan
- plan-US
Slotted content
Use slot="anchor" and slot="tip" for full control over both the trigger and popover content, including rich HTML with links and formatting.
Subscriber details
Global multicarrier cellular connectivity built for IoT & M2M. Pay as you go with no commitments.
- Status
- Active
- Plan
- plan-US
Size
Use the size attribute to control the trigger size. In icon mode, the default is xsmall.
In text mode, no default size is applied. Use size to explicitly set one.
Icons
Use the icon attribute to change the trigger icon.
Add the icon attribute to display a right-aligned icon alongside the text trigger.
Component colors
Use the color attribute to set the trigger color. Works in both icon and text modes.
Position
The tooltip position defaults to top. Use the position attribute to change placement.
All 12 positions are available:
Drag the table to move it near the frame edges, or resize the frame from its bottom-right corner. Tooltips will automatically reposition to stay visible.
Attributes
| Attribute | Values | Default | Description |
|---|---|---|---|
type | "ds-text", "ds-icon" | ds-icon | Sets the trigger mode. "ds-text" uses inline text as the trigger instead of an icon. |
text | Plain text string | — | Sets the popover content as plain text. Used when no child elements provide popover content. |
anchor-aria-label | String | "Show tooltip" | Sets the aria-label on the anchor/trigger element for accessibility. In text mode, defaults to empty. |
position | See position table | top | Controls the tooltip placement relative to the trigger. |
icon | SDS icon name | info | Sets the trigger icon (e.g. online-solid, help). Only applies in icon mode. |
size | SDS size value | xsmall (icon mode only) | Sets the trigger size (e.g. 2xsmall, small, medium). Applies in both icon and text modes. |
color | SDS color name | — | Sets the trigger color (e.g. celeste, magenta). Applies in both icon and text modes. |
anchor-class | CSS class string | — | Additional CSS classes appended to the trigger element. |
tip-class | CSS class string | — | Additional CSS classes appended to the popover element. |
css | "shadow" | Light DOM | Set to "shadow" to use Shadow DOM with self-loaded SDS stylesheets. |
Slots
| Slot | Description |
|---|---|
anchor | Custom trigger content for text mode. Replaces the default text node as the trigger. |
tip | Custom popover content. Supports rich HTML with links and formatting. |
| (default) | Child content without a slot attribute. Used as popover content in icon mode, or as trigger text in text mode (with text attribute providing the popover). |
Behaviour
Angular usage
ds-tooltip is a standard Web Component and works in Angular templates like any other native element. Two setup steps are needed.
Registering the element
Import the component once at app startup (e.g. in main.ts) so the custom element is defined before any template renders it:
Allowing the tag in templates
Add CUSTOM_ELEMENTS_SCHEMA to every NgModule whose templates use <ds-tooltip> (or to standalone components via schemas):
Without this, Angular errors with NG8001: 'ds-tooltip' is not a known element.
Usage examples
Angular interpolation, attribute bindings, and pipes all work as expected:
Examples
Usage in a table header
| Name | Status |
Plan
|
|---|---|---|
| SIM-001 | Active | plan-US |
| SIM-002 | Inactive | plan-K2 |
Usage in a label
Automatic placement
Subscriber details
Global multicarrier cellular connectivity built for IoT & M2M. Pay as you go with no commitments.
- Status
- Active
- Plan
- plan-US