The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
---
title: Tooltip
description: Show supplementary information when a trigger is hovered or focused.
---
import { PageBanner } from "/snippets/page-banner.mdx"
import { StoryEmbed } from '/snippets/ui/StoryEmbed.mdx';
import TooltipReference from '/snippets/ui/generated/surfaces/tooltip.mdx';
## Overview
Use `Tooltip` for a short explanation of a control or truncated text. Keep essential information visible, give controls an accessible name, and use [Popover](/ui/primitives/surfaces/popover) when the content contains links, buttons, or other controls.
<StoryEmbed
storyId="ui-surfaces-tooltip--display"
title="Tooltip example"
height={180}
/>
## Usage
```tsx
import { Button } from 'twenty-ui/primitives/input';
import { Tooltip } from 'twenty-ui/primitives/surfaces';
import { Text } from 'twenty-ui/primitives/typography';
export const ExportHelp = () => (
<Tooltip content="Download the visible records as a CSV file" side="top">
<Text render={<span />}>
<Button>Export records</Button>
</Text>
</Tooltip>
);
```
The convenience component accepts one trigger element as `children`. Native elements receive the trigger attributes, event handlers, and ref directly. Custom trigger components must forward all of them. A wrapper element also works with a component that does not forward every trigger prop.
Hover opens the tooltip after `delay` milliseconds, which defaults to `600`. Keyboard focus opens it immediately. `closeDelay` defaults to `0`; hovering over the popup keeps it open unless `disableHoverablePopup` is set. Escape dismisses it.
## Controlled state
Use `open` and `onOpenChange` together when the application owns visibility. Use `defaultOpen` only to set the initial visibility of an uncontrolled tooltip.
```tsx
import { useState } from 'react';
import { Button } from 'twenty-ui/primitives/input';
import { Tooltip } from 'twenty-ui/primitives/surfaces';
export const ControlledExportHelp = () => {
const [open, setOpen] = useState(false);
return (
<Tooltip
content="Download the visible records as a CSV file"
open={open}
onOpenChange={setOpen}
delay={300}
>
<span>
<Button>Export records</Button>
</span>
</Tooltip>
);
};
```
## Rich content and composition
Shorthand accepts `description` and `startIcon` beside `content`. Custom node content renders as supplied unless a description or icon requests the title layout.
```tsx
import { IconInfoCircle } from 'twenty-ui/icon';
import { Button } from 'twenty-ui/primitives/input';
import { Tooltip } from 'twenty-ui/primitives/surfaces';
export const ExportDetails = () => (
<Tooltip
content="Export visible records"
description="Only records matching your current filters are included."
startIcon={<IconInfoCircle />}
arrow
>
<Button>Export records</Button>
</Tooltip>
);
```
Compound usage exposes every installed Base UI part and the optional `Tooltip.Body` layout. Assemble the portal, positioning, popup and optional arrow explicitly. Popup renders its children as supplied; Body provides the same title, description and decorative icon layout as shorthand.
```tsx
import { Button } from 'twenty-ui/primitives/input';
import { Tooltip } from 'twenty-ui/primitives/surfaces';
export const ComposedExportDetails = () => (
<Tooltip.Provider delay={300} closeDelay={100} timeout={400}>
<Tooltip.Root>
<Tooltip.Trigger render={<Button>Export records</Button>} />
<Tooltip.Portal>
<Tooltip.Positioner side="inline-end" sideOffset={10} arrowPadding={8}>
<Tooltip.Popup>
<Tooltip.Arrow />
<Tooltip.Viewport>
<Tooltip.Body description="Only records matching your current filters are included.">
Export visible records
</Tooltip.Body>
</Tooltip.Viewport>
</Tooltip.Popup>
</Tooltip.Positioner>
</Tooltip.Portal>
</Tooltip.Root>
</Tooltip.Provider>
);
```
| Part | Native, prop and ref target |
| ------------ | --------------------------------------------------------------------------------------------------------------------------- |
| `Root` | State and payload coordination. No DOM node, native props or DOM ref. `actionsRef` exposes `close` and `unmount`. |
| `Provider` | Shared `delay`, `closeDelay` and `timeout`. No DOM node or DOM ref. |
| `Trigger` | A button by default. Native props, handlers, `render` and ref target the trigger element. |
| `Portal` | The portal div. Defaults to the theme container, then document body. |
| `Positioner` | The positioning div. Owns anchor, physical/logical side, offsets, collision handling, sticky positioning and arrow padding. |
| `Popup` | The popup div. Owns content, native props, styles, `render` and ref. |
| `Body` | The optional body div inside Popup or Viewport. Native props, styles, `render` and ref target its root. |
| `Arrow` | The arrow div inside Popup. |
| `Viewport` | The optional div for transitions between trigger payloads. |
`Tooltip.Body` accepts optional title children, `description` and `startIcon` nodes. Titles use medium weight; descriptions use the secondary tooltip color, preserve line breaks and wrap long text. Omit title children for a description-only tooltip. The icon is decorative and appears only with a title. Body adds no tooltip role, popup styling, sizing or positioning. Arbitrary Popup content remains supported. Import `TooltipBodyProps` from `twenty-ui/primitives/surfaces` when typing a wrapper.
Every DOM part accepts native props, refs, and element or callback `render` composition. Shorthand's top-level native props, `render` and ref target Popup. Use `triggerProps`, `positionerProps` and `portalProps` to customize the other targets; these override shorthand defaults. Children supply the default trigger render element. Both forms preserve controlled/uncontrolled Root state and Base UI callback event details, including cancellation, reason, original event and active trigger.
`Tooltip.createHandle<TPayload>()` connects detached triggers to either form through `handle`. Compound Root's children or shorthand's `content` can be a function receiving the typed active payload. `Tooltip.Handle` and the public `TooltipHandle` type expose the installed handle contract. Handles support imperative `open(triggerId)` and `close()` while their Root is mounted.
## Migration
Replace `content={<Tooltip.Content description={description} startIcon={icon}>title</Tooltip.Content>}` with `content={title} description={description} startIcon={icon}`. In compound usage, use `Tooltip.Body` for the shared title and description layout or compose your own content. `Tooltip.Content` and `TooltipContentProps` are removed.
Existing compound Popup positioning props move to Positioner. Wrap it in Portal, move `container` and `keepMounted` to Portal, keep `maxWidth` on Popup, and replace `arrow` with an Arrow child. Preserve the former spacing explicitly with `sideOffset={10}` when needed. Compound Positioner keeps Base UI's `sideOffset={0}`. Both forms cap Popup at 300 pixels by default.
## Disabled controls
Native disabled buttons cannot receive keyboard focus. Wrap one in a focusable trigger so users can discover why the action is unavailable.
```tsx
import { Button } from 'twenty-ui/primitives/input';
import { Tooltip } from 'twenty-ui/primitives/surfaces';
export const UnavailableExport = () => (
<Tooltip content="Select at least one record to export">
<span tabIndex={0} aria-label="Export records unavailable">
<Button disabled>Export records</Button>
</span>
</Tooltip>
);
```
Setting `disabled` on shorthand or Root suppresses the tooltip itself. Trigger `disabled` suppresses that trigger’s tooltip interaction. Disable the native control through its own props or Trigger’s render element.
## Placement and overflowing text
Shorthand defaults to `side="top"`, `align="center"`, and `sideOffset={10}`. Both shorthand and compound tooltips have a maximum width of 300 pixels, capped by the available space beside the anchor. Pass `maxWidth` to shorthand or `Tooltip.Popup` to choose a different maximum, including wider previews. Native popup styles remain available for custom sizing. Placement adjusts to available space. An open tooltip hides while its anchor is scrolled out of view, including out of a scroll container. Use `arrow` for an arrow and `container` to override the theme's portal destination; see [theming](/ui/theming).
Use [OverflowingTextWithTooltip](/ui/primitives/typography/overflowing-text-with-tooltip) when a text label should show its full value only when truncated. Its existing `text`, `tooltipContent`, and `tooltipPlace` props remain available.
## Props
The reference is generated from the public component types. Native popup attributes and event handlers are also accepted.
<TooltipReference />
<PageBanner illustration="card-page-messaging-channels" />