How to use
Tooltip wraps a single trigger element and shows contextual content on hover or focus — a label for an icon-only button, a hint for a form field, extra detail on truncated text. It positions itself relative to the trigger with automatic flipping to stay in the viewport, and its hover/touch timing adapts per-interaction rather than assuming one input method for the whole session.
import { Tooltip } from "oks-ui";Tooltip takes exactly one child — the trigger — and content for what to show. It opens on hover or keyboard focus and closes on the corresponding leave/blur, so a keyboard-only user reaches it the same way a mouse user does.
<Tooltip content="Copy to clipboard">
<Button isIconOnly variant="ghost" aria-label="Copy">
<CopyIcon />
</Button>
</Tooltip>placement supports the full 12-way positioning set (each side, plus start/end variants), with shouldFlip on by default so it automatically switches sides rather than rendering off-screen near a viewport edge. showArrow adds a small pointer connecting the tooltip back to its trigger.
<Tooltip content="Delete" placement="bottom" showArrow>
<Button isIconOnly color="danger" variant="ghost" aria-label="Delete">
<TrashIcon />
</Button>
</Tooltip>delay controls how long a hover has to hold before the tooltip opens (0 by default — instant); closeDelay controls how long it stays open after the pointer leaves, and also acts as a floor for touch-triggered opens so a tap-and-release on a touch device doesn't flash the tooltip for an imperceptible instant. This is decided per interaction event, not a single device check, so a device with both touch and mouse input (a touchscreen laptop) gets correct behavior for whichever input actually triggered it.
<Tooltip content="Advanced settings" delay={300} closeDelay={100}>
<Button variant="ghost">Settings</Button>
</Tooltip>For a tooltip driven by something other than hover/focus (showing it programmatically after an action, keeping it open during a guided tour step), use isOpen + onOpenChange instead of the default uncontrolled hover behavior.
<Tooltip content="Click here to continue" isOpen={tourStep === 2} onOpenChange={setTourVisible}>
<Button color="primary">Next</Button>
</Tooltip>All available props for Tooltip. See the full component page for an interactive playground.
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | — | The trigger element the tooltip attaches to. |
content | ReactNode | — | Tooltip content. |
children
ReactNode
Default: —
The trigger element the tooltip attaches to.
content
ReactNode
Default: —
Tooltip content.
| Prop | Type | Default | Description |
|---|---|---|---|
size | "xs" | "xs-sm" | "sm" | "md" | "lg" | "xl" | md | Tooltip size. |
color | "default" | "primary" | "secondary" | "info" | "success" | "warning" | "danger" | default | Semantic color. |
colorDepth | number | 100 | Shade depth for the selected color. |
radius | "none" | "xs" | "xs-sm" | "sm" | "md" | "lg" | "full" | md | Border radius. |
shadow | "none" | "xs" | "xs-sm" | "sm" | "md" | "lg" | sm | Box-shadow depth. |
showArrow | boolean | false | Shows a pointing arrow. |
triggerScaleOnOpen | boolean | false | Slightly scales the trigger while the tooltip is open. |
size
"xs" | "xs-sm" | "sm" | "md" | "lg" | "xl"
Default: md
Tooltip size.
color
"default" | "primary" | "secondary" | "info" | "success" | "warning" | "danger"
Default: default
Semantic color.
colorDepth
number
Default: 100
Shade depth for the selected color.
radius
"none" | "xs" | "xs-sm" | "sm" | "md" | "lg" | "full"
Default: md
Border radius.
shadow
"none" | "xs" | "xs-sm" | "sm" | "md" | "lg"
Default: sm
Box-shadow depth.
showArrow
boolean
Default: false
Shows a pointing arrow.
triggerScaleOnOpen
boolean
Default: false
Slightly scales the trigger while the tooltip is open.
| Prop | Type | Default | Description |
|---|---|---|---|
placement | "top" | "bottom" | "left" | "right" | ... (12-way) | top | Position relative to the trigger. |
offset | number | 7 | Distance from the trigger. |
containerPadding | number | 12 | Minimum distance kept from the viewport edge. |
crossOffset | number | 0 | Offset along the cross axis. |
shouldFlip | boolean | true | Flips placement to stay in the viewport. |
portalContainer | Element | DocumentFragment | null | — | Custom portal mount target. |
placement
"top" | "bottom" | "left" | "right" | ... (12-way)
Default: top
Position relative to the trigger.
offset
number
Default: 7
Distance from the trigger.
containerPadding
number
Default: 12
Minimum distance kept from the viewport edge.
crossOffset
number
Default: 0
Offset along the cross axis.
shouldFlip
boolean
Default: true
Flips placement to stay in the viewport.
portalContainer
Element | DocumentFragment | null
Default: —
Custom portal mount target.
| Prop | Type | Default | Description |
|---|---|---|---|
delay | number | 0 | Open delay in ms. |
closeDelay | number | 500 | Close delay in ms (also floors touch-triggered opens). |
isOpen | boolean | — | Controlled open state. |
defaultOpen | boolean | false | Uncontrolled initial open state. |
isKeyboardDismissDisabled | boolean | false | Disables closing via Escape. |
isDismissable | boolean | false | Allows dismissing an isOpen-controlled tooltip via outside click/Escape. |
shouldCloseOnBlur | boolean | true | Closes when the trigger loses focus. |
shouldCloseOnInteractOutside | (element: HTMLElement) => boolean | — | Custom predicate for outside-interaction dismissal. |
isDisabled | boolean | false | Disables the tooltip entirely. |
delay
number
Default: 0
Open delay in ms.
closeDelay
number
Default: 500
Close delay in ms (also floors touch-triggered opens).
isOpen
boolean
Default: —
Controlled open state.
defaultOpen
boolean
Default: false
Uncontrolled initial open state.
isKeyboardDismissDisabled
boolean
Default: false
Disables closing via Escape.
isDismissable
boolean
Default: false
Allows dismissing an isOpen-controlled tooltip via outside click/Escape.
shouldCloseOnBlur
boolean
Default: true
Closes when the trigger loses focus.
shouldCloseOnInteractOutside
(element: HTMLElement) => boolean
Default: —
Custom predicate for outside-interaction dismissal.
isDisabled
boolean
Default: false
Disables the tooltip entirely.
| Prop | Type | Default | Description |
|---|---|---|---|
disableAnimation | boolean | false | Disables the enter/exit animation. |
disableAnimation
boolean
Default: false
Disables the enter/exit animation.
| Prop | Type | Default | Description |
|---|---|---|---|
onOpenChange | (isOpen: boolean) => void | — | Called when open state changes. |
onClose | () => void | — | Called when the tooltip closes. |
onOpenChange
(isOpen: boolean) => void
Default: —
Called when open state changes.
onClose
() => void
Default: —
Called when the tooltip closes.
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Class applied to the tooltip content. |
classNames | { base?; content?; arrow? } | — | Per-slot class overrides. |
className
string
Default: —
Class applied to the tooltip content.
classNames
{ base?; content?; arrow? }
Default: —
Per-slot class overrides.