Skip to content
Focsd homeFocsd homeFocsd
Forms

Tooltip

A short description shown on hover and focus.

  • Tag: focsd-tooltip
  • Pattern: Tooltip (hover + focus, Esc)
  • Category: Overlays

Example

HTML
<focsd-tooltip text="Copies a link anyone in the workspace can open">
<focsd-icon-button icon="copy" label="Copy link"></focsd-icon-button>
</focsd-tooltip>

Usage

Import the module once, then use the tag like any HTML element. Every framework below renders the same element; see Frameworks for setup.

<script type="module">
import '@focsd-dev/components/focsd-tooltip.js';
</script>
<focsd-tooltip text="Copies a link anyone in the workspace can open">…</focsd-tooltip>

API

Attributes

AttributePropertyTypeDefault
texttextstring—
placementplacement'top' | 'bottom'top
delaydelaynumber400

Methods

MethodDescription
show()Show the tooltip now, skipping delay.
hide()Hide the tooltip.

Slots

SlotDescription
(default)The element the tooltip describes.

CSS parts

Style the inside of the component with ::part(), for example focsd-tooltip::part(tooltip).

PartDescription
tooltipThe tooltip element.

Accessibility

  • The trigger gets the text as aria-description, so it is read with the control; the visual tooltip is aria-hidden to avoid double reading.
  • Stays open while hovered and dismisses on Escape (WCAG 1.4.13).
  • Never put essential information or interactive content in a tooltip.

Keyboard

KeyAction
Tab (to the trigger)Show
EscapeHide