Infotip
An information icon that opens a short explanation on hover, click or touch.
Usage guidelines
- Use
Infotipwhen an information icon's primary action is opening an explanation. UseTooltipwhen the trigger already has another primary action and only needs a visual hint. Infotipis a popover: it opens on hover, click, touch and keyboard activation, so its content reaches every user and can hold links.- Name the trigger with
aria-labelledbywhen a visible topic exists, otherwise with a shortaria-label. The trigger needs its name while the popup is closed, so it never comes from the popup content. - Name the popup with the same short topic, through
aria-labelledby,aria-labelor anInfotipTitle. Do not copy the explanation into either name, and keep the body as normal children rather than turning it into the dialog's description. InfotipTriggerstops click propagation, so an infotip inside a clickable row or card does not trigger the enclosing action.Infotipowns its surface, spacing, typography, radius and shadow. Callers may constrain the width or keep intentional line breaks, and may place and color the trigger, but do not resize it; usesize.
Anatomy
InfotipTrigger renders the icon button itself and takes no children; iconVariant picks its glyph: question (the default), information or warning. InfotipContent bundles the portal, positioner and popup, and opens on the top side by default.
Examples
Named by a title
When adjacent text states a value rather than the topic, InfotipTitle gives the dialog its name while the trigger carries a matching aria-label.
Links in the explanation
The popup can hold interactive content. Opening it from the keyboard moves focus to the first link.
Icon variants
iconVariant selects the trigger glyph: question for general help, information for factual details and warning for caveats.
- Top Kquestion
- Model contextinformation
- Legacy indexingwarning
Sizes
size sets the icon and the trigger's layout box together: sm (12px), md (16px, the default) and lg (16px with a larger icon). Every size keeps a 24px pointer target outside its layout box, so the larger target does not move the surrounding content. An ancestor that clips overflow also clips that target.
- Top Ksm
- Score thresholdmd
- Rerank modellg
Keyboard
| Key | Action |
|---|---|
| EnterorSpace | Opens the infotip from a focused trigger and moves focus into the popup, to its first link when it has one. |
| Tab | Moves focus past the popup's last link to the next control on the page and closes the popup. |
| Escape | Closes the infotip and returns focus to the trigger. |
API reference
Infotip
Groups an icon button trigger and an accessible explanation popover. Doesn't render its own HTML element.
Opens on hover, click, touch, or keyboard activation and supports interactive content such as links.
| Prop | Type | Default | Details |
|---|---|---|---|
defaultOpen | boolean | false | |
open | boolean | No default | |
onOpenChange | ((open: boolean, eventDetails: BasePopover.Root.ChangeEventDetails) => void) | No default | |
onOpenChangeComplete | ((open: boolean) => void) | No default | |
actionsRef | React.RefObject<PopoverRootActions | null> | No default | |
modal | 'trap-focus' | boolean | false | |
triggerId | string | null | No default | |
defaultTriggerId | string | null | No default | |
children | PayloadChildRenderFunction<Payload> | React.ReactNode | No default | |
InfotipContent
A container for the popover contents. Renders a <div> element.
| Prop | Type | Default | Details |
|---|---|---|---|
side | 'bottom' | 'inline-end' | 'inline-start' | 'left' | 'right' | 'top' | 'top' | |
sideOffset | number | OffsetFunction | 8 | |
children required | React.ReactNode | No default | |
className | string | ((state: PopoverPopupState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, PopoverPopupState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: PopoverPopupState) => React.CSSProperties | undefined) | No default | |
initialFocus | boolean | React.RefObject<HTMLElement | null> | ((openType: InteractionType) => void | boolean | HTMLElement | null) | No default | |
finalFocus | boolean | React.RefObject<HTMLElement | null> | ((closeType: InteractionType) => void | boolean | HTMLElement | null) | No default | |
align | 'center' | 'end' | 'start' | 'center' | |
alignOffset | number | OffsetFunction | 0 | |
| Attribute | Description |
|---|---|
data-open | Present when the popup is open. |
data-closed | Present when the popup is closed. |
data-starting-style | Present when the popup begins animating in. |
data-ending-style | Present when the popup is animating out. |
data-side | Values: Indicates which side the popup is positioned relative to the trigger. |
data-align | Values: Indicates how the popup is aligned relative to specified side. |
data-instant | Values: Present if animations should be instant. |
| Variable | Description |
|---|---|
--popup-width | The width of the popup. |
--popup-height | The height of the popup. |
--available-width | Values: The available width between the trigger and the edge of the viewport. |
--available-height | Values: The available height between the trigger and the edge of the viewport. |
--anchor-width | Values: The anchor's width. |
--anchor-height | Values: The anchor's height. |
--transform-origin | Values: The coordinates that this element is anchored to. Used for animations and transitions. |
--positioner-width | Values: The width of the popover's positioner. It is important to set |
--positioner-height | Values: The height of the popover's positioner. It is important to set |
InfotipTitle
A heading that labels the popover. Renders an <h2> element.
| Prop | Type | Default | Details |
|---|---|---|---|
className | string | ((state: PopoverTitleState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, PopoverTitleState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: PopoverTitleState) => React.CSSProperties | undefined) | No default | |
InfotipTrigger
An icon button that opens the infotip on hover or click and stops click propagation; requires aria-label or aria-labelledby. Renders a <button> element.
| Prop | Type | Default | Details |
|---|---|---|---|
aria-label | string | No default | |
aria-labelledby | string | No default | |
iconVariant | 'information' | 'question' | 'warning' | 'question' | |
size | 'lg' | 'md' | 'sm' | 'md' | |
openOnHover | boolean | true | |
closeDelay | number | 200 | |
id | string | No default | |
className | string | ((state: PopoverTriggerState) => string | undefined) | No default | |
style | React.CSSProperties | ((state: PopoverTriggerState) => React.CSSProperties | undefined) | No default | |
payload | Payload | No default | |
delay | number | 300 | |
Valid prop combinations:
aria-label: string,aria-labelledby?: undefinedaria-label?: undefined,aria-labelledby: string
| Attribute | Description |
|---|---|
data-popup-open | Present when the corresponding popover is open. |
data-pressed | Present when the trigger is pressed. |
data-disabled | Present when the trigger is disabled. |