import type { ReactElement, ReactNode } from 'react'; import type { BehaviorTrackingProps } from '../../core/types/behavior-tracking-props.js'; import type { DataTestId } from '../../core/types/data-props.js'; import type { DOMProps } from '../../core/types/dom.js'; import type { MaskingProps } from '../../core/types/masking-props.js'; import type { StylingProps } from '../../core/types/styling-props.js'; /** * @public */ export interface TooltipBaseProps extends DOMProps, StylingProps, DataTestId, MaskingProps, BehaviorTrackingProps { /** Single child of the tooltip considered to trigger the tooltip element. */ children: ReactElement; /** * Defines if the tooltip is disabled or not. * @defaultValue false */ disabled?: boolean; /** * Placement of the tooltip relative to its trigger element. * @defaultValue 'top' */ placement?: 'top' | 'right' | 'bottom' | 'left' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'right-start' | 'right-end' | 'left-start' | 'left-end'; /** * Defines if the tooltip should be open initially when used uncontrolled. * @defaultValue false */ defaultOpen?: boolean; /** * Defines if the tooltip is open / closed in a controlled component. In * this case, you need to react to `onOpenChange` yourself in order * to open and close the tooltip. */ open?: boolean; /** * Defines the type of delay which is used for the tooltip. * @defaultValue 'default' */ delay?: 'default' | 'none'; /** Callback fired when the tooltip opens. */ onOpenChange?: (isOpen: boolean) => void; /** Array of placements to be used as fallback if the tooltip doesn't fit at the specified placement. */ fallbackPlacements?: Array<'top' | 'right' | 'bottom' | 'left' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'right-start' | 'right-end' | 'left-start' | 'left-end'>; } /** * @public */ export interface TooltipProps extends TooltipBaseProps { /** Text displayed in the tooltip component. */ text: ReactNode; }