import * as React from 'react'; import type { HTMLAttributes, RefObject } from 'react'; type TooltipProps = { /** * The element or ref to append the tooltip to. * Defaults to the body element, or to the trigger's parent when `interactive` is set. * 'parent' is suggested if used in a modal. */ appendTo?: 'parent' | Element | ((ref: Element) => Element); /** * Behavior of the tooltip transition, defaults to an opacity "fade". * The value is set on the bubble as `data-animation`, for custom transitions to target. * To disable animations, pass `animation={false}` or `duration={0}`. */ animation?: string | boolean; /** * Whether to show the arrow pointing at the trigger. * * **Default is `true`**. */ arrow?: boolean; /** * The trigger element the tooltip appears next to. */ children?: React.ReactElement; /** * If the child being passed into the Tooltip via the `children` prop is not interactive (e.g. a disabled button or an icon). * * Please note that spacing and placement styling will need to be added to a wrapper around the Tooltip, * not on the child component inside the Tooltip, because there will be a wrapper around the child. Example: *
*/ childNotInteractive?: boolean; /** * Custom classname for additional styles. * * These styles will only affect the tooltip bubble. */ className?: string; /** * How long to delay the Tooltip showing and hiding on hover, in milliseconds. * * If a single number is provided, it will be applied to showing and hiding. * If an array with 2 numbers is provided, the first will apply to showing and * the second will be applied to hiding. `null` uses no delay. */ delay?: number | [number | null, number | null]; /** * Prevents the tooltip from showing. */ disabled?: boolean; /** * Duration of Tooltip animation, in milliseconds. Default is 200. */ duration?: number; /** * Whether the tooltip hides when clicking the trigger or outside of the tooltip. * `'toggle'` only hides it by clicking the trigger again, and needs `trigger` to include `'click'`. * * **Default is `true`**. */ hideOnClick?: boolean | 'toggle'; /** * Lets the pointer move from the trigger into the tooltip without it hiding, * so its content can be clicked or selected. */ interactive?: boolean; /** * Maximum width of the tooltip bubble. Numbers are in pixels. * * **Default is `350`**. */ maxWidth?: number | string; /** * Called when the tooltip hides. */ onHide?: () => void; /** * Called when the tooltip shows. */ onShow?: () => void; /** * The trigger element the tooltip appears next to. * * Use this instead of `children` if the trigger element is being * stored in a ref. Most cases will use `children` and not * `reference`. */ reference?: RefObject | Element; /** * The events on the trigger that show the tooltip, separated by spaces. * Supports `'mouseenter'`, `'focus'` (or `'focusin'`), and `'click'`. * * **Default is `"mouseenter focus"`**. */ trigger?: string; /** * Whether the tooltip is always visible or always invisible. * * This is most often left undefined so the Tooltip component * controls if/when the bubble appears (on hover, click, focus, etc). */ visible?: boolean; /** * The z-index of the tooltip. * * **Default is `9999`**. */ zIndex?: number; /** * Where the tooltip should be placed in relation to the element it's attached to. * If there isn't room on that side, it flips to the opposite side. * `"auto"` picks whichever side has the most space. * * **Default is `"auto"`**. */ placement?: 'auto' | 'top' | 'right' | 'bottom' | 'left'; /** * The content of the tooltip bubble. */ content?: React.ReactNode; /** * The variant treatment for tooltips * * **Default is `"default"`**. */ variant?: 'default' | 'inverse'; } & Omit, 'children' | 'content'>; /** * ## Usage * * | Type/Use | Description | Example | * |----------|-------------|---------| * | Standard | Brief text that appears on hover or focus, near a UI element. | Labeling icon-only buttons, explaining uncommon terms. | * | Interactive | Includes styled content such as links, formatting, or icons. | Short instructions, embedded documentation, "Learn more" links. | * | Disabled element | Visible even on elements that are not interactive. | Explaining why a button is disabled. | * | Contextual | Shows information specific to the user's current context or state. | Explaining dynamic UI states, custom user guidance. | * * ### Best Practices * * * Don't put tooltips on actions except for icon-only buttons. * * Keep tooltip content simple; avoid complex/custom typography styling inside a tooltip. * * When an icon's meaning is not immediately obvious or universally recognized, use a tooltip as a hint or clarification. * * Don't use tooltips to communicate critical information such as form errors; consider `ToastNotification` instead. * * Tooltips aren't meant for a first-time user experience; consider a NUX to guide onboarding. * * Display one tooltip at a time. * * ## Interaction * * A tooltip is triggered by hovering over or focusing an element. The most common example of a trigger is an icon, but hovering over a text link can also trigger a tooltip. * * ## Content & Accessibility * * ### Do's * * * Keep tooltips to 3 lines or less. * * Keep icon label tooltips to 2-3 words with no end punctuation. * * Use full sentences for definitions and instructive tooltips, with sentence case and end punctuation. * * Start instructional tooltips with a verb. * * ### Don'ts * * * Don't use tooltips to communicate error messages or other critical information. * * Don't put essential task instructions in tooltips. * * Don't use tooltips to restate text that is already on the screen. * * Don't pair tooltips with disabled elements directly, as it may not receive pointer events. Attach to a wrapper element instead. * * ## Resources * * * https://floating-ui.com/docs/tooltip * * https://floating-ui.com/docs/react */ export declare const Tooltip: { ({ animation, appendTo, arrow, childNotInteractive, className, content, delay, disabled, duration, hideOnClick, interactive, maxWidth, onHide, onShow, placement, reference, trigger, variant, visible, zIndex, children: childrenProp, style, ...rest }: TooltipProps): React.JSX.Element; displayName: string; }; export {};