structyl

Tooltip API

View component

The full prop reference for the Tooltip component. A popup that displays information related to an element when it receives keyboard focus or hover.

Import

tsx
import { Tooltip } from '@structyl/styled';

Props

Tooltip.Provider

Context provider that manages shared tooltip timing and delay behavior for all nested tooltips

PropTypeDefault
children#React.ReactNode

Content to be wrapped by the provider

delayDuration#number

Delay in milliseconds before the tooltip opens on hover

700
skipDelayDuration#number

Duration in milliseconds after closing before the delay applies again to the next tooltip

300
disableHoverableContent#boolean

When true, disables the ability to hover over tooltip content to keep it open

false

Tooltip.Root

Root state container for a tooltip instance; manages open/closed state and positioning context

PropTypeDefault
children#React.ReactNode

Trigger and Content components

open#boolean

Controlled open state; when provided, component becomes controlled

defaultOpen#boolean

Initial open state when uncontrolled

false
onOpenChange#(open: boolean) => void

Callback fired when tooltip open state changes

delayDuration#number

Override the Provider's delayDuration for this tooltip instance

disableHoverableContent#boolean

Override the Provider's disableHoverableContent for this tooltip instance

Tooltip.Trigger

Button element that triggers tooltip visibility on hover, focus, or click

PropTypeDefault
asChild#boolean

When true, render as the child element instead of a button wrapper

...buttonProps#React.ComponentPropsWithoutRef<'button'>

All standard HTML button attributes (onClick, className, disabled, etc.)

Tooltip.Portal

Renders tooltip content into a portal (typically the DOM root) to avoid stacking context issues

PropTypeDefault
children#React.ReactNode

Tooltip Content component

container#Element | DocumentFragment | null

DOM element to portal content into; defaults to document.body

forceMount#boolean

When true, Content is mounted to the DOM regardless of open state

Tooltip.Content

Container for tooltip message; handles positioning, visibility, and floating-ui integration (primitive version)

PropTypeDefault
asChild#boolean

When true, render as the child element instead of a div wrapper

forceMount#boolean

When true, Content is mounted to the DOM regardless of open state

side#'top' | 'right' | 'bottom' | 'left'

Preferred position relative to the trigger

'top'
sideOffset#number

Distance in pixels between trigger and tooltip content

align#'start' | 'center' | 'end'

Alignment of content relative to trigger along the side axis

alignOffset#number

Offset in pixels along the align axis

arrowPadding#number

Distance in pixels to keep arrow from edge of content

avoidCollisions#boolean

When true, adjust position to avoid viewport collisions

collisionPadding#number

Distance in pixels to keep content from viewport edge

onEscapeKeyDown#(event: KeyboardEvent) => void

Callback fired when Escape key is pressed on content

onPointerDownOutside#(event: PointerEvent) => void

Callback fired when pointer down occurs outside content

...divProps#React.ComponentPropsWithoutRef<'div'>

All standard HTML div attributes (className, style, etc.)

Tooltip.Arrow

SVG arrow that points from tooltip content toward the trigger

PropTypeDefault
width#number

SVG arrow width in pixels

height#number

SVG arrow height in pixels

...svgProps#React.ComponentPropsWithoutRef<'svg'>

All standard SVG attributes (className, style, etc.)

Tooltip.Content (styled)

Enhanced tooltip content with styling variants and convenience props; wraps the primitive

PropTypeDefault
variant#'default' | 'dark' | 'light' | 'primary' | 'secondary' | 'info' | 'warning' | 'error' | 'success'

Visual style variant

'default'
maxWidth#string | number

Maximum width of content in pixels or any CSS value

280
arrow#boolean

When true, renders an arrow pointing to the trigger

false
className#string

Additional CSS class names, merged with variant styles

sideOffset#number

Distance between trigger and content in pixels

6
...contentProps#React.ComponentPropsWithoutRef<TooltipPrimitive.Content>

All primitive content props (side, align, forceMount, etc.) and standard div attributes

Tooltip (shorthand)

Convenience component that combines Provider, Root, Trigger, and Content into a single configurable element

PropTypeDefault
children#React.ReactNode

Element to trigger the tooltip on hover/focus

label#React.ReactNode

Text or content to display inside the tooltip

side#'top' | 'right' | 'bottom' | 'left'

Position of tooltip relative to trigger

'top'
align#'start' | 'center' | 'end'

Alignment of tooltip along the side axis

variant#'default' | 'dark' | 'light' | 'primary' | 'secondary' | 'info' | 'warning' | 'error' | 'success'

Visual style variant

maxWidth#string | number

Maximum width of tooltip content

280
arrow#boolean

Whether to show an arrow pointing to the trigger

false
disabled#boolean

When true, tooltip is disabled and children render unwrapped

delayDuration#number

Delay in milliseconds before tooltip opens

skipDelayDuration#number

Duration before delay resets after closing

...triggerProps#React.ComponentPropsWithoutRef<Trigger>

All button trigger props (className, onClick, etc.)

Keyboard interactions

KeyDescription
EscCloses the tooltip.

Source code

If you didn't find what you need here, read the component implementation .

structyl — Accessible React Component Library