UNPKG

@base-ui-components/react

Version:

Base UI is a library of headless ('unstyled') React components and low-level hooks. You gain complete control over your app's CSS and accessibility features.

70 lines 2.21 kB
import * as React from 'react'; import { TooltipOpenChangeReason } from "./TooltipRootContext.js"; /** * Groups all parts of the tooltip. * Doesn’t render its own HTML element. * * Documentation: [Base UI Tooltip](https://base-ui.com/react/components/tooltip) */ export declare function TooltipRoot(props: TooltipRoot.Props): React.JSX.Element; export declare namespace TooltipRoot { interface State {} interface Props { children?: React.ReactNode; /** * Whether the tooltip is initially open. * * To render a controlled tooltip, use the `open` prop instead. * @default false */ defaultOpen?: boolean; /** * Whether the tooltip is currently open. */ open?: boolean; /** * Event handler called when the tooltip is opened or closed. */ onOpenChange?: (open: boolean, event: Event | undefined, reason: OpenChangeReason | undefined) => void; /** * Event handler called after any animations complete when the tooltip is opened or closed. */ onOpenChangeComplete?: (open: boolean) => void; /** * Whether the tooltip contents can be hovered without closing the tooltip. * @default true */ hoverable?: boolean; /** * Determines which axis the tooltip should track the cursor on. * @default 'none' */ trackCursorAxis?: 'none' | 'x' | 'y' | 'both'; /** * How long to wait before opening the tooltip. Specified in milliseconds. * @default 600 */ delay?: number; /** * How long to wait before closing the tooltip. Specified in milliseconds. * @default 0 */ closeDelay?: number; /** * A ref to imperative actions. * - `unmount`: When specified, the tooltip will not be unmounted when closed. * Instead, the `unmount` function must be called to unmount the tooltip manually. * Useful when the tooltip's animation is controlled by an external library. */ actionsRef?: React.RefObject<Actions>; /** * Whether the tooltip is disabled. * @default false */ disabled?: boolean; } interface Actions { unmount: () => void; } type OpenChangeReason = TooltipOpenChangeReason; }