HelpTooltip
An inline info icon that explains the term it follows on hover or focus.
Installation
- Install the package.
npm install @hashintel/ds-components- Import the component.
import { HelpTooltip } from "@hashintel/ds-components";
export const EntityTypeLabel = () => (
<span>
Entity type
<HelpTooltip content="The schema this entity conforms to" />
</span>
);When to use
- Do: Use HelpTooltip after a term, field label, or setting that needs one short clarifying sentence.
- Do: Use it for supplemental detail users can succeed without — definitions, consequences, defaults.
When not to use
- Don't: Avoid hiding required information in it — instructions users need to complete a task usually belong in visible text, such as a form field's description.
- Don't: Don't use it to explain an existing control — HelpTooltip brings its own icon trigger; wrap the control in Tooltip instead.
- Don't: Don't put links, buttons, or rich layout in the content — a hover overlay can't be interacted with; use Popover.
Examples
Basic
Place it flush after the term it explains, with the explanation in content.
Don't type a space before it — the icon brings its own gap and stays glued to
the last word.
Alignment
align tunes the icon's vertical position: top (default) suits labels and
running text; use center in vertically centered rows such as tab labels.
Tooltip position
The tooltip prefers the right side, where it won't cover the text just read,
and flips automatically when there's no room. Set position to prefer another
side.
Light and dark
variant sets the overlay surface. Keep the default dark for contrast;
switch to light where a dark panel feels heavy against the surrounding UI.
In form labels
In forms, don't place HelpTooltip by hand: Form.Field takes labelTooltip
and renders the icon after the label text — outside the <label> element and
on the side away from the control.
import { useState } from "react";
import { Form, TextInput } from "@hashintel/ds-components";
export const WorkspaceNameField = () => {
const [name, setName] = useState("");
return (
<Form.Field
label="Workspace name"
labelTooltip="Shown in the sidebar and on invitations"
>
<TextInput value={name} onChange={setName} placeholder="Acme Research" />
</Form.Field>
);
};Content
- Write one clarifying sentence, ideally under 15 words — the overlay caps at its width and wraps; anything needing paragraphs belongs in a Popover or the docs.
- Add what the label can't carry: a definition, a consequence, a constraint, or a default. Don't restate the label — a redundant tooltip teaches users to skip the rest.
- Keep it plain text in sentence case. No links or "Learn more" — they're unreachable in a hover overlay.
Accessibility
HelpTooltip implements the WAI-ARIA tooltip pattern.
What HelpTooltip provides
- The icon trigger receives
tabindex="0"automatically, so keyboard users can reach it; the tooltip opens on hover and keyboard focus, and closes on Escape, blur, or pointer-leave. - While open, the trigger references the content via
aria-describedby, so screen readers announce the explanation. - The trigger is exposed as an image named "Information" (
role="img"), so it isn't an unnamed tab stop; the decorative info icon inside staysaria-hidden. Passaria-labelto rename it — useful when several help icons land in the same list of form fields.
What you must do
- Write the component flush against the preceding word, no space or line break before it, to avoid the help tooltip becoming a widow.
- Keep
contentplain text so thearia-describedbyannouncement reads cleanly. - Place the trigger beside, not inside,
<label>elements — inside one, clicking the icon focuses the form control.Form.Fieldalready renders it outside.
API reference
| Prop | Type | Description |
|---|---|---|
| content | ReactNode | The content rendered inside the tooltip overlay |
| position | Position default: "right" | The preferred position of the tooltip; another may be chosen for a better fit. |
| variant | "light" | "dark" default: "dark" | Whether to display a light or dark tooltip |
| openDelay | "none" | "medium" | "fast" | "slow" default: "medium" | The delay before the tooltip opens on hover or focus (fast 200ms, medium 500ms, slow 1s). |
| closeDelay | "none" | "medium" | "fast" | "slow" default: "medium" | The delay before the tooltip closes after hover or focus ends (fast 100ms, medium 200ms, slow 300ms). |
| gapX | number default: 8 | The horizontal distance in pixels between the tooltip and the trigger. |
| gapY | number default: 8 | The vertical distance in pixels between the tooltip and the trigger. |
| closeOnClick | boolean default: true | Whether clicking the trigger closes the tooltip. Disable when keyboard activation dispatches a native click — e.g. a radio checked via arrow keys — which would instantly dismiss the tooltip that just opened on focus. |
| onOpen | (() => void) | |
| onClose | (() => void) | |
| align | "top" | "center" default: "top" | How the icon aligns with the surrounding text |
| aria-label | string default: "Information" | Accessible name for the icon trigger |
Was this page helpful?