UNPKG

reablocks

Version:
119 lines (118 loc) 2.86 kB
import { FC, ReactNode } from 'react'; import { TriggerTypes } from '../../utils/Overlay'; import { Modifiers, Placement, ReferenceObject } from '../../utils/Position'; import { MotionNodeAnimationOptions } from 'motion/react'; import { TooltipTheme } from './TooltipTheme'; export interface TooltipProps { /** * Content to wrap. */ children?: ReactNode; /** * Close on any click. * @default false */ closeOnClick?: boolean; /** * Close when the body is clicked. * @default true */ closeOnBodyClick?: boolean; /** * Close when escape key is triggered. * @default true */ closeOnEscape?: boolean; /** * Content for the tooltip. */ content?: any; /** * Reference of the tooltip to align to. */ reference?: ReferenceObject | HTMLElement | any; /** * floating-ui placement. * @default 'top' */ placement?: Placement; /** * Delay before showing tooltip. * @default 0 */ enterDelay?: number; /** * Delay before closing tooltip. * @default 200 */ leaveDelay?: number; /** * floating-ui modifiers. */ modifiers?: Modifiers; /** * External setter for visibility. * @default false */ visible?: boolean; /** * Additional CSS classnames. */ className?: string; /** * CSS Classname for the tooltip container ( ie. the thing that the tooltip is bound to ). */ triggerClassName?: string; /** * How the tooltip will be triggered. * @default 'hover' */ trigger?: TriggerTypes[] | TriggerTypes; /** * Whether the tooltip is disabled. * @default false */ disabled?: boolean; /** * @deprecated Use animation configuration instead. * Whether the tooltip is animated. * @default true */ animated?: boolean; /** * Animation configuration for the tooltip. */ animation?: MotionNodeAnimationOptions; /** * Whether the tooltip should move with the cursor or not. * @default false */ followCursor?: boolean; /** * Add pointer events or not. Usually not for tooltips. * @default 'none' */ pointerEvents?: string; /** * Arrow pointing from the tooltip to the trigger element. * Pass `true` to render the default arrow, or a ReactNode to render a custom arrow. */ arrow?: boolean | ReactNode; /** * Differentiator for popovers to be handled separate from tooltips */ isPopover?: boolean; /** * Tooltip was opened. */ onOpen?(): void; /** * Tooltip was closed. */ onClose?(): void; /** * Theme for the tooltip. */ theme?: TooltipTheme; } export declare const Tooltip: FC<TooltipProps>;