Anatomy
aegov-tooltip wraps a trigger element (its default slot) and renders a role="tooltip" panel next to it — positioned on the requested side with a small directional arrow. The panel always stays in the DOM (hidden via visibility), so it can be resolved by assistive technology through aria-describedby at any time, not only while visually shown.

| Item | Name | Description |
|---|---|---|
1 |
Trigger | The default-slot element the user hovers, focuses, or clicks |
2 |
Panel | The role="tooltip" container holding the content text or tooltip-content slot |
3 |
Arrow | Points back at the trigger; repositions itself per position/align |
Basics
Wrap any trigger element in the default slot and supply content as plain text. By default the tooltip shows on hover — and always on keyboard focus, since it must remain reachable without a mouse — above the trigger (position="top").
<aegov-tooltip content="Print the current page">
<aegov-button variant="secondary" aria-label="Print">Print</aegov-button>
</aegov-tooltip>
import { AegovTooltip, AegovButton } from '@aegov/designsystem-react';
export default function TooltipBasics() {
return (
<AegovTooltip content="Print the current page">
<AegovButton variant="secondary" aria-label="Print">Print</AegovButton>
</AegovTooltip>
);
}
<template>
<aegov-tooltip content="Print the current page">
<aegov-button variant="secondary" aria-label="Print">Print</aegov-button>
</aegov-tooltip>
</template>
import { Component } from '@angular/core';
import { AegovTooltip, AegovButton } from '@aegov/designsystem-angular';
@Component({
selector: 'app-tooltip-basics',
imports: [AegovTooltip, AegovButton],
template: `
<aegov-tooltip content="Print the current page">
<aegov-button variant="secondary" aria-label="Print">Print</aegov-button>
</aegov-tooltip>
`,
})
export class TooltipBasicsComponent {}
Position
position sets which side of the trigger the tooltip appears on — top (default), right, bottom, or left. Unlike aegov-popover, the tooltip does not auto-flip to the opposite side; it stays on the requested side and is only nudged inward if it would overflow the viewport edge. position is mirrored automatically in RTL.
<aegov-tooltip content="Tooltip on top" position="top">
<aegov-button variant="secondary">Top</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="Tooltip on right" position="right">
<aegov-button variant="secondary">Right</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="Tooltip on bottom" position="bottom">
<aegov-button variant="secondary">Bottom</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="Tooltip on left" position="left">
<aegov-button variant="secondary">Left</aegov-button>
</aegov-tooltip>
import { AegovTooltip, AegovButton } from '@aegov/designsystem-react';
export default function TooltipPosition() {
return (
<>
<AegovTooltip content="Tooltip on top" position="top">
<AegovButton variant="secondary">Top</AegovButton>
</AegovTooltip>
<AegovTooltip content="Tooltip on right" position="right">
<AegovButton variant="secondary">Right</AegovButton>
</AegovTooltip>
<AegovTooltip content="Tooltip on bottom" position="bottom">
<AegovButton variant="secondary">Bottom</AegovButton>
</AegovTooltip>
<AegovTooltip content="Tooltip on left" position="left">
<AegovButton variant="secondary">Left</AegovButton>
</AegovTooltip>
</>
);
}
<template>
<aegov-tooltip content="Tooltip on top" position="top">
<aegov-button variant="secondary">Top</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="Tooltip on right" position="right">
<aegov-button variant="secondary">Right</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="Tooltip on bottom" position="bottom">
<aegov-button variant="secondary">Bottom</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="Tooltip on left" position="left">
<aegov-button variant="secondary">Left</aegov-button>
</aegov-tooltip>
</template>
import { Component } from '@angular/core';
import { AegovTooltip, AegovButton } from '@aegov/designsystem-angular';
@Component({
selector: 'app-tooltip-position',
imports: [AegovTooltip, AegovButton],
template: `
<aegov-tooltip content="Tooltip on top" position="top">
<aegov-button variant="secondary">Top</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="Tooltip on right" position="right">
<aegov-button variant="secondary">Right</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="Tooltip on bottom" position="bottom">
<aegov-button variant="secondary">Bottom</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="Tooltip on left" position="left">
<aegov-button variant="secondary">Left</aegov-button>
</aegov-tooltip>
`,
})
export class TooltipPositionComponent {}
Alignment
When the tooltip is positioned top or bottom, align shifts it horizontally relative to the trigger. When it's left or right, alignment shifts it vertically. Use start to anchor to the leading edge, center (default), or end to anchor to the trailing edge. align="start"/"end" flip automatically in RTL.
<aegov-tooltip content="Aligned to start" position="bottom" align="start">
<aegov-button variant="secondary">Start</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="Aligned to centre" position="bottom" align="center">
<aegov-button variant="secondary">Centre</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="Aligned to end" position="bottom" align="end">
<aegov-button variant="secondary">End</aegov-button>
</aegov-tooltip>
import { AegovTooltip, AegovButton } from '@aegov/designsystem-react';
export default function TooltipAlignment() {
return (
<>
<AegovTooltip content="Aligned to start" position="bottom" align="start">
<AegovButton variant="secondary">Start</AegovButton>
</AegovTooltip>
<AegovTooltip content="Aligned to centre" position="bottom" align="center">
<AegovButton variant="secondary">Centre</AegovButton>
</AegovTooltip>
<AegovTooltip content="Aligned to end" position="bottom" align="end">
<AegovButton variant="secondary">End</AegovButton>
</AegovTooltip>
</>
);
}
<template>
<aegov-tooltip content="Aligned to start" position="bottom" align="start">
<aegov-button variant="secondary">Start</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="Aligned to centre" position="bottom" align="center">
<aegov-button variant="secondary">Centre</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="Aligned to end" position="bottom" align="end">
<aegov-button variant="secondary">End</aegov-button>
</aegov-tooltip>
</template>
import { Component } from '@angular/core';
import { AegovTooltip, AegovButton } from '@aegov/designsystem-angular';
@Component({
selector: 'app-tooltip-alignment',
imports: [AegovTooltip, AegovButton],
template: `
<aegov-tooltip content="Aligned to start" position="bottom" align="start">
<aegov-button variant="secondary">Start</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="Aligned to centre" position="bottom" align="center">
<aegov-button variant="secondary">Centre</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="Aligned to end" position="bottom" align="end">
<aegov-button variant="secondary">End</aegov-button>
</aegov-tooltip>
`,
})
export class TooltipAlignmentComponent {}
Trigger
By default (trigger="hover") the tooltip shows on mouse hover — and always on keyboard focus, regardless of this setting, so the tooltip is never mouse-only. Set trigger="click" to instead toggle the tooltip on click; it then closes on an outside click or Escape. Click triggers suit touch devices, where hover doesn't exist.
<aegov-tooltip content="Shows on hover or keyboard focus." trigger="hover" position="top">
<aegov-button variant="secondary">Hover (default)</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="Click to toggle. Closes on outside click or Escape." trigger="click" position="top">
<aegov-button variant="secondary">Click to open</aegov-button>
</aegov-tooltip>
import { AegovTooltip, AegovButton } from '@aegov/designsystem-react';
export default function TooltipTrigger() {
return (
<>
<AegovTooltip content="Shows on hover or keyboard focus." trigger="hover" position="top">
<AegovButton variant="secondary">Hover (default)</AegovButton>
</AegovTooltip>
<AegovTooltip content="Click to toggle. Closes on outside click or Escape." trigger="click" position="top">
<AegovButton variant="secondary">Click to open</AegovButton>
</AegovTooltip>
</>
);
}
<template>
<aegov-tooltip content="Shows on hover or keyboard focus." trigger="hover" position="top">
<aegov-button variant="secondary">Hover (default)</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="Click to toggle. Closes on outside click or Escape." trigger="click" position="top">
<aegov-button variant="secondary">Click to open</aegov-button>
</aegov-tooltip>
</template>
import { Component } from '@angular/core';
import { AegovTooltip, AegovButton } from '@aegov/designsystem-angular';
@Component({
selector: 'app-tooltip-trigger',
imports: [AegovTooltip, AegovButton],
template: `
<aegov-tooltip content="Shows on hover or keyboard focus." trigger="hover" position="top">
<aegov-button variant="secondary">Hover (default)</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="Click to toggle. Closes on outside click or Escape." trigger="click" position="top">
<aegov-button variant="secondary">Click to open</aegov-button>
</aegov-tooltip>
`,
})
export class TooltipTriggerComponent {}
Delay
delay-start (default 200ms) controls how long the pointer must hover before the tooltip appears — avoiding a flash of tooltip on every incidental mouse pass. delay-end (default 0ms) adds a brief pause before hiding, giving the pointer time to move onto the tooltip panel itself (the panel stays open while hovered).
<aegov-tooltip content="Default 200ms hover delay." delay-start="200" position="top">
<aegov-button variant="secondary">Default delay</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="Appears after 600ms of sustained hover." delay-start="600" position="top">
<aegov-button variant="secondary">Slow start (600ms)</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="Lingers for 400ms after you leave." delay-end="400" position="top">
<aegov-button variant="secondary">Slow end (400ms)</aegov-button>
</aegov-tooltip>
import { AegovTooltip, AegovButton } from '@aegov/designsystem-react';
export default function TooltipDelay() {
return (
<>
<AegovTooltip content="Default 200ms hover delay." delayStart={200} position="top">
<AegovButton variant="secondary">Default delay</AegovButton>
</AegovTooltip>
<AegovTooltip content="Appears after 600ms of sustained hover." delayStart={600} position="top">
<AegovButton variant="secondary">Slow start (600ms)</AegovButton>
</AegovTooltip>
<AegovTooltip content="Lingers for 400ms after you leave." delayEnd={400} position="top">
<AegovButton variant="secondary">Slow end (400ms)</AegovButton>
</AegovTooltip>
</>
);
}
<template>
<aegov-tooltip content="Default 200ms hover delay." delay-start="200" position="top">
<aegov-button variant="secondary">Default delay</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="Appears after 600ms of sustained hover." delay-start="600" position="top">
<aegov-button variant="secondary">Slow start (600ms)</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="Lingers for 400ms after you leave." delay-end="400" position="top">
<aegov-button variant="secondary">Slow end (400ms)</aegov-button>
</aegov-tooltip>
</template>
import { Component } from '@angular/core';
import { AegovTooltip, AegovButton } from '@aegov/designsystem-angular';
@Component({
selector: 'app-tooltip-delay',
imports: [AegovTooltip, AegovButton],
template: `
<aegov-tooltip content="Default 200ms hover delay." [delayStart]="200" position="top">
<aegov-button variant="secondary">Default delay</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="Appears after 600ms of sustained hover." [delayStart]="600" position="top">
<aegov-button variant="secondary">Slow start (600ms)</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="Lingers for 400ms after you leave." [delayEnd]="400" position="top">
<aegov-button variant="secondary">Slow end (400ms)</aegov-button>
</aegov-tooltip>
`,
})
export class TooltipDelayComponent {}
Gap and offset
gap (pixels, default 8) controls the distance between the trigger and the tooltip. offset (default 0) shifts the tooltip along its alignment axis — useful when the trigger has visual padding the tooltip shouldn't appear to overlap.
<aegov-tooltip content="Snug to the trigger — only 2px gap." gap="2" position="top">
<aegov-button variant="secondary">Tight (gap 2)</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="A larger 20px gap from the trigger." gap="20" position="top">
<aegov-button variant="secondary">Loose (gap 20)</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="Shifted 40px along the alignment axis." gap="10" offset="40" position="top">
<aegov-button variant="secondary">Offset (40)</aegov-button>
</aegov-tooltip>
import { AegovTooltip, AegovButton } from '@aegov/designsystem-react';
export default function TooltipGapOffset() {
return (
<>
<AegovTooltip content="Snug to the trigger — only 2px gap." gap={2} position="top">
<AegovButton variant="secondary">Tight (gap 2)</AegovButton>
</AegovTooltip>
<AegovTooltip content="A larger 20px gap from the trigger." gap={20} position="top">
<AegovButton variant="secondary">Loose (gap 20)</AegovButton>
</AegovTooltip>
<AegovTooltip content="Shifted 40px along the alignment axis." gap={10} offset={40} position="top">
<AegovButton variant="secondary">Offset (40)</AegovButton>
</AegovTooltip>
</>
);
}
<template>
<aegov-tooltip content="Snug to the trigger — only 2px gap." gap="2" position="top">
<aegov-button variant="secondary">Tight (gap 2)</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="A larger 20px gap from the trigger." gap="20" position="top">
<aegov-button variant="secondary">Loose (gap 20)</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="Shifted 40px along the alignment axis." gap="10" offset="40" position="top">
<aegov-button variant="secondary">Offset (40)</aegov-button>
</aegov-tooltip>
</template>
import { Component } from '@angular/core';
import { AegovTooltip, AegovButton } from '@aegov/designsystem-angular';
@Component({
selector: 'app-tooltip-gap-offset',
imports: [AegovTooltip, AegovButton],
template: `
<aegov-tooltip content="Snug to the trigger — only 2px gap." [gap]="2" position="top">
<aegov-button variant="secondary">Tight (gap 2)</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="A larger 20px gap from the trigger." [gap]="20" position="top">
<aegov-button variant="secondary">Loose (gap 20)</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="Shifted 40px along the alignment axis." [gap]="10" [offset]="40" position="top">
<aegov-button variant="secondary">Offset (40)</aegov-button>
</aegov-tooltip>
`,
})
export class TooltipGapOffsetComponent {}
Rich content with the slot
For content beyond plain text — emphasis, inline icons, multiple lines — provide a tooltip-content slot instead of content. The slot takes precedence when both are present. Keep tooltip content short and non-interactive; a tooltip is not focusable, so anything a user needs to click belongs in aegov-popover instead.
<aegov-tooltip position="top">
<aegov-button variant="secondary">Status</aegov-button>
<span slot="tooltip-content">
<strong>Last updated:</strong> 2 minutes ago
</span>
</aegov-tooltip>
import { AegovTooltip, AegovButton } from '@aegov/designsystem-react';
export default function TooltipRichContent() {
return (
<AegovTooltip position="top">
<AegovButton variant="secondary">Status</AegovButton>
<span slot="tooltip-content">
<strong>Last updated:</strong> 2 minutes ago
</span>
</AegovTooltip>
);
}
<template>
<aegov-tooltip position="top">
<aegov-button variant="secondary">Status</aegov-button>
<span slot="tooltip-content">
<strong>Last updated:</strong> 2 minutes ago
</span>
</aegov-tooltip>
</template>
import { Component } from '@angular/core';
import { AegovTooltip, AegovButton } from '@aegov/designsystem-angular';
@Component({
selector: 'app-tooltip-rich-content',
imports: [AegovTooltip, AegovButton],
template: `
<aegov-tooltip position="top">
<aegov-button variant="secondary">Status</aegov-button>
<span slot="tooltip-content">
<strong>Last updated:</strong> 2 minutes ago
</span>
</aegov-tooltip>
`,
})
export class TooltipRichContentComponent {}
Disabled
Set is-disabled="true" to suppress the tooltip without removing the trigger from the DOM or tab order. Useful when the extra context a tooltip provides is conditionally unavailable but the trigger itself should stay interactive.
<aegov-tooltip content="This tooltip opens normally." position="top">
<aegov-button variant="secondary">Enabled</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="You will not see this." is-disabled="true" position="top">
<aegov-button variant="secondary">Tooltip suppressed</aegov-button>
</aegov-tooltip>
import { AegovTooltip, AegovButton } from '@aegov/designsystem-react';
export default function TooltipDisabled() {
return (
<>
<AegovTooltip content="This tooltip opens normally." position="top">
<AegovButton variant="secondary">Enabled</AegovButton>
</AegovTooltip>
<AegovTooltip content="You will not see this." isDisabled position="top">
<AegovButton variant="secondary">Tooltip suppressed</AegovButton>
</AegovTooltip>
</>
);
}
<template>
<aegov-tooltip content="This tooltip opens normally." position="top">
<aegov-button variant="secondary">Enabled</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="You will not see this." is-disabled="true" position="top">
<aegov-button variant="secondary">Tooltip suppressed</aegov-button>
</aegov-tooltip>
</template>
import { Component } from '@angular/core';
import { AegovTooltip, AegovButton } from '@aegov/designsystem-angular';
@Component({
selector: 'app-tooltip-disabled',
imports: [AegovTooltip, AegovButton],
template: `
<aegov-tooltip content="This tooltip opens normally." position="top">
<aegov-button variant="secondary">Enabled</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="You will not see this." [isDisabled]="true" position="top">
<aegov-button variant="secondary">Tooltip suppressed</aegov-button>
</aegov-tooltip>
`,
})
export class TooltipDisabledComponent {}
Composite example — Form helper text
A common pattern: pair an input label with an info icon that reveals additional guidance on hover or focus. A tooltip keeps the form short while still giving the user the detail they need, without the overhead of a focus-trapping popover.
<div class="max-w-md">
<div class="flex items-center gap-2 mb-2">
<label for="trade-licence" class="font-semibold">Trade licence number</label>
<aegov-tooltip content="Your 6- to 8-digit licence number is printed on the top right of your DED licence document." position="top" align="start">
<aegov-button is-icon appearance="soft" size="xs" aria-label="What is this?">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><path d="M12 16v-4M12 8h.01"></path></svg>
</aegov-button>
</aegov-tooltip>
</div>
<aegov-input field-id="trade-licence" placeholder="e.g. 123456"></aegov-input>
</div>
import { AegovTooltip, AegovButton, AegovInput } from '@aegov/designsystem-react';
export default function TooltipFormField() {
return (
<div className="max-w-md">
<div className="flex items-center gap-2 mb-2">
<label htmlFor="trade-licence" className="font-semibold">Trade licence number</label>
<AegovTooltip content="Your 6- to 8-digit licence number is printed on the top right of your DED licence document." position="top" align="start">
<AegovButton isIcon appearance="soft" size="xs" aria-label="What is this?">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><circle cx="12" cy="12" r="10"></circle><path d="M12 16v-4M12 8h.01"></path></svg>
</AegovButton>
</AegovTooltip>
</div>
<AegovInput fieldId="trade-licence" placeholder="e.g. 123456" />
</div>
);
}
<template>
<div class="max-w-md">
<div class="flex items-center gap-2 mb-2">
<label for="trade-licence" class="font-semibold">Trade licence number</label>
<aegov-tooltip content="Your 6- to 8-digit licence number is printed on the top right of your DED licence document." position="top" align="start">
<aegov-button is-icon appearance="soft" size="xs" aria-label="What is this?">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><path d="M12 16v-4M12 8h.01"></path></svg>
</aegov-button>
</aegov-tooltip>
</div>
<aegov-input field-id="trade-licence" placeholder="e.g. 123456"></aegov-input>
</div>
</template>
import { Component } from '@angular/core';
import { AegovTooltip, AegovButton, AegovInput } from '@aegov/designsystem-angular';
@Component({
selector: 'app-tooltip-form-field',
imports: [AegovTooltip, AegovButton, AegovInput],
template: `
<div class="max-w-md">
<div class="flex items-center gap-2 mb-2">
<label for="trade-licence" class="font-semibold">Trade licence number</label>
<aegov-tooltip content="Your 6- to 8-digit licence number is printed on the top right of your DED licence document." position="top" align="start">
<aegov-button is-icon appearance="soft" size="xs" aria-label="What is this?">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><path d="M12 16v-4M12 8h.01"></path></svg>
</aegov-button>
</aegov-tooltip>
</div>
<aegov-input field-id="trade-licence" placeholder="e.g. 123456"></aegov-input>
</div>
`,
})
export class TooltipFormFieldComponent {}
RTL support
The tooltip is direction-aware. Under dir="rtl", position="left"/"right" swap so the visual relationship to the trigger is preserved, and align="start"/"end" flip to follow the reading direction — both confirmed live. position="top"/"bottom" and align="center" are unaffected.
<div dir="rtl">
<aegov-tooltip content="طباعة الصفحة الحالية" position="top">
<aegov-button variant="secondary">طباعة</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="عرض المساعدة" position="left">
<aegov-button variant="secondary">مساعدة</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="تنزيل المستند" position="right">
<aegov-button variant="secondary">تنزيل</aegov-button>
</aegov-tooltip>
</div>
import { AegovTooltip, AegovButton } from '@aegov/designsystem-react';
export default function RtlTooltip() {
return (
<div dir="rtl">
<AegovTooltip content="طباعة الصفحة الحالية" position="top">
<AegovButton variant="secondary">طباعة</AegovButton>
</AegovTooltip>
<AegovTooltip content="عرض المساعدة" position="left">
<AegovButton variant="secondary">مساعدة</AegovButton>
</AegovTooltip>
<AegovTooltip content="تنزيل المستند" position="right">
<AegovButton variant="secondary">تنزيل</AegovButton>
</AegovTooltip>
</div>
);
}
<template>
<div dir="rtl">
<aegov-tooltip content="طباعة الصفحة الحالية" position="top">
<aegov-button variant="secondary">طباعة</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="عرض المساعدة" position="left">
<aegov-button variant="secondary">مساعدة</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="تنزيل المستند" position="right">
<aegov-button variant="secondary">تنزيل</aegov-button>
</aegov-tooltip>
</div>
</template>
import { Component } from '@angular/core';
import { AegovTooltip, AegovButton } from '@aegov/designsystem-angular';
@Component({
selector: 'app-rtl-tooltip',
imports: [AegovTooltip, AegovButton],
template: `
<div dir="rtl">
<aegov-tooltip content="طباعة الصفحة الحالية" position="top">
<aegov-button variant="secondary">طباعة</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="عرض المساعدة" position="left">
<aegov-button variant="secondary">مساعدة</aegov-button>
</aegov-tooltip>
<aegov-tooltip content="تنزيل المستند" position="right">
<aegov-button variant="secondary">تنزيل</aegov-button>
</aegov-tooltip>
</div>
`,
})
export class RtlTooltipComponent {}
Usage
Here is the recommended usage of a tooltip on any website or application. These are recommended usage guides, however the developer must use the best practices of web and application development to accurately use this component.
Give the trigger its own accessible name
A tooltip describes a control — it does not name it. An icon-only button needs a real aria-label; the tooltip then supplements that label, it does not replace it.
Keep tooltip content to one short sentence
A tooltip is meant to be read in a glance. For anything longer, or content the user needs to interact with, use aegov-popover instead.
Provide an alternative on touch devices for essential content
Hover does not exist on touch. If a tooltip's content is essential rather than a bonus hint, pair it with trigger="click", a visible info icon, or persistent helper text.
Don't place interactive controls inside tooltip content
Tooltips are not focusable, so links, buttons, or form fields inside tooltip-content cannot be reached with the keyboard. Use aegov-popover or aegov-dropdown when users need to interact with the content.
Don't set aria-describedby on the trigger yourself
aegov-tooltip manages this automatically, reaching inside a shadow-DOM trigger like aegov-button to find the real focusable element. Setting it yourself risks overwriting the component's own linkage.
Don't rely on a tooltip as the only place critical information appears
Anything the user must see to complete a task should also be visible without hovering or focusing a trigger — a permanent label, hint text, or inline instruction.
API reference
The following are the properties and references of a tooltip
Properties
| Attribute | Description | Type | Default |
|---|---|---|---|
| Plain-text tooltip body. Ignored when the |
| undefined |
| Side of the trigger the tooltip appears on. Does not auto-flip — only clamped inward at the viewport edge. Mirrored automatically in RTL ( |
|
|
| Alignment along the tooltip's cross-axis relative to the trigger. Flips in RTL. |
|
|
| How the tooltip is shown. Keyboard focus always shows the tooltip regardless of this setting. |
|
|
| Distance in pixels between the trigger and the tooltip. |
|
|
| Additional offset along the alignment axis, in pixels. |
|
|
| Suppresses the tooltip without removing the trigger from the DOM or tab order. |
|
|
| Delay before showing on hover, in milliseconds. |
|
|
| Delay before hiding on hover, in milliseconds. |
|
|
Slots
| Slot | Description |
|---|---|
(default) | The trigger element — typically a button or link. |
| Rich tooltip body. Takes precedence over the |
Pass-through attributes
| Attribute group | Forwarded? | Notes |
|---|---|---|
| Yes | Applied to the inner trigger wrapper ( |
| Managed | Set permanently on the trigger's real focusable element at component mount (reaching inside a shadow-DOM trigger like |
| Allowed | Applied to the host element. |
Notes
The following notes are applicable of this component.
Built-in accessibility
- The tooltip panel renders with
role="tooltip"and a stableid, and always stays in the DOM (hidden viavisibility: hidden) rather than being added/removed — so it can be resolved by assistive technology througharia-describedbyat any time. aria-describedbyis set permanently on the trigger's real focusable element at component mount — reaching inside a shadow-DOM trigger likeaegov-buttonautomatically (confirmed live: it lands on the inner native<button>, not just the wrapper) — and removed only when the component disconnects.- The tooltip appears on keyboard focus regardless of
triggermode, so it is never reachable by mouse alone. Escapehides the tooltip immediately, even when it was shown purely by hover with no keyboard focus inside it (the listener is document-scoped for this reason) — SC 1.4.13 Dismissible.- The tooltip stays open when the pointer moves from the trigger onto the panel itself, so the content can be read or copied — SC 1.4.13 hoverable.
- An unrecognised
position,align, ortriggervalue falls back to its documented default.
Developer responsibilities
- The trigger must have its own accessible name. A tooltip describes a control — it does not name it. Buttons and links should already be labelled (visible text or
aria-label); the tooltip then supplements that label, not replaces it. - Keep tooltip content short — one short sentence at most. For richer help text, use
aegov-popover. - Avoid placing interactive controls (links, buttons, form fields) inside tooltip content. Tooltips are not focusable and content inside them cannot be reached with the keyboard.
- On touch devices, hover does not exist. Provide an alternative pattern (a click-triggered tooltip, an info icon next to the field, or persistent helper text) for any tooltip whose content is essential.
- Do not set
aria-describedbyyourself — the component manages it automatically.
Keyboard support
| Key | Action |
|---|---|
Tab |
Move focus to the trigger; the tooltip appears on focus regardless of trigger mode. |
Enter, Space |
Toggle the tooltip when trigger="click" and the trigger is a button. |
Escape |
Hide the tooltip if it is currently visible. |
Shift + Tab |
Move focus to the previous focusable element; the tooltip hides as focus leaves. |
Notes
- The tooltip does not auto-flip to the opposite side when space is tight (unlike
aegov-popover) — it only nudges inward to stay within the viewport. Choose apositionthat has room to render in your layout. - The tooltip does not emit custom events. To react to visibility changes, observe the trigger's own focus/hover state from application code.