Tooltip
<dsx-tooltip> — Tooltip
Section titled “<dsx-tooltip> — Tooltip”Inline tooltip wrapper with configurable placement and hover/click/focus trigger modes.
Live Preview
Import
Section titled “Import”import '@bnotk/dsx/components/tooltip.js';<dsx-tooltip content="Helpful context" placement="right"> <button type="button">Hover me</button></dsx-tooltip>Elements
Section titled “Elements”<dsx-tooltip>
Section titled “<dsx-tooltip>”Wraps a trigger element in the default slot and shows a positioned tooltip box inside the shadow root.
Properties
Section titled “Properties”| Property | Type | Default | Description |
|---|---|---|---|
| content | string | ” | Tooltip text content. |
| placement | ’top’ | ‘bottom’ | ‘left’ | ‘right' | 'top’ | Controls which side of the trigger receives the tooltip. |
| trigger | ’hover’ | ‘click’ | ‘focus' | 'hover’ | Selects the interaction mode used to show or hide the tooltip. |
Methods
Section titled “Methods”None.
Events
Section titled “Events”None.
| Slot | Description |
|---|---|
| default | The trigger content rendered inside .trigger. |
CSS Parts
Section titled “CSS Parts”This element does not expose shadow parts.
- Hover mode uses
mouseenterandmouseleaveon the trigger span. - Focus mode uses
focusandblur; click mode toggles visibility on click. - The tooltip box is always in the DOM with
role="tooltip"and switches visibility through opacity plusaria-hidden.
Behavior Notes
Section titled “Behavior Notes”- The host is
inline-blockandposition: relative; placement styles are applied through host attributes. - The tooltip starts hidden (
opacity: 0) and becomes visible when the reflected_visibleattribute is present.
Styling Notes
Section titled “Styling Notes”- Dark tooltip surface uses
--ds2-color-main-darkand white text. - Padding is 0.375rem × 0.625rem with a max width of 20rem and normal wrapping.