Tooltip
UI SDK Tooltip parts: names or describes its trigger, opens on hover and keyboard focus, Escape closes it, optional shortcut and arrow. ControlTooltip gives an icon-only control its name in a tooltip.
Example
Copy model ID
About $0.42 for 12k tokens
tooltip-demo.tsxCopy code
Installation
Copy code
Usage
ImportCopy code
API reference
TooltipContent
TooltipArrow
TooltipShortcut
ControlTooltip
| Prop | Type | Default |
|---|---|---|
labelThe control's accessible name. The tooltip repeats it unless `tooltip` gives other text. | string | – |
tooltip | ControlTooltipOption | – |
iconOnlyShows `label` without being asked to, for a control with no visible text. | boolean | true |
shortcutKeys shown after the text, like `"mod+s"`. | string | – |
agentPressableLists the tooltip in the agent snapshot under the control's name, so an agent can press a control that isn't a component of its own, like a collapsible's trigger. Otherwise it stays out, since it repeats the control's name. | boolean | false |
childrenrequiredThe control, rendered as the tooltip's trigger: it receives the trigger's props and ref. A natively `disabled` one can't be focused, so it gets no tooltip; `focusableWhenDisabled` keeps it. One that is already labelled or described by something else, like the `TooltipTrigger` it renders for, keeps that, and an `aria-hidden` one gets none. | ReactElement<TriggerProps> | – |
Other exports
createTooltipControllerTooltipTooltipTriggertype ControlTooltipOptiontype ControlTooltipPropsAccessibility
- Names or describes its trigger; opens on hover and focus, never holds interactive content.
- Escape dismisses it without moving focus.
- A touch screen never opens it, so it never covers the finger or hides what a tap does.
Agent actions
Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.