Overlays
Tooltip
A short description shown on hover and keyboard focus — mostly for icon buttons. Behaviour comes from React Aria.
import { Tooltip } from '@reactloom/ui';Examples
Icon buttons
Once one tooltip is visible, neighbours appear without delay.
import { HStack, IconButton, Tooltip } from '@reactloom/ui';
import { Copy, Download, Pencil, Trash2 } from 'lucide-react';
export default function Example() {
return (
<HStack gap="1">
<Tooltip content="Edit"><IconButton icon={<Pencil />} label="Edit" /></Tooltip>
<Tooltip content="Duplicate"><IconButton icon={<Copy />} label="Duplicate" /></Tooltip>
<Tooltip content="Download PDF"><IconButton icon={<Download />} label="Download PDF" /></Tooltip>
<Tooltip content="Delete"><IconButton icon={<Trash2 />} label="Delete" variant="destructive" /></Tooltip>
</HStack>
);
}Placement
import { Button, HStack, Tooltip } from '@reactloom/ui';
export default function Example() {
return (
<HStack gap="2" wrap>
{(['top', 'right', 'bottom', 'left'] as const).map((placement) => (
<Tooltip key={placement} content={`Placed ${placement}`} placement={placement}>
<Button variant="secondary">{placement}</Button>
</Tooltip>
))}
</HStack>
);
}API reference
| Prop | Type | Default |
|---|---|---|
contentrequiredShort, non-interactive text. | ReactNode | — |
childrenrequiredOne focusable element. | ReactElement | — |
placement | OverlayPlacement | 'top' |
delay · closeDelayms | number | 600 · 0 |
open / defaultOpen · onOpenChangeControlled visibility. | | — |
disabled | boolean | false |
Customization
Extracted from the component’s source on every build, so it matches the code. How the layers fit together is explained in Customization.
Theme tokens it reads
--pl-color-bg-inverse --pl-color-fg-inverse --pl-font-size-xs --pl-radius-sm
Accessibility
- Shown on keyboard focus, not only hover; Escape hides it.
- Linked with aria-describedby; IconButton keeps its own aria-label as the name.
- Never put links or buttons inside a tooltip — use Popover.
| Key | Action |
|---|---|
| Tab | Focus the trigger: show |
| Escape | Hide |
Usage guidelines
Do
- Keep tooltip text to a few words.
Don’t
- Don’t hide essential information in tooltips.
- Don’t add tooltips to disabled buttons (they cannot be focused).