UNPKG

1.28 kBTypeScriptView Raw
1import * as React from "react";
2import { BoxProps } from "../Box";
3import { PopperProps } from "../Popper";
4
5export interface ITooltip {
6 "aria-label": string;
7 /**
8 * The delay in `ms` for the tooltip to show
9 */
10 showDelay?: number;
11 /**
12 * The delay in `ms` for the tooltip to hide
13 */
14 hideDelay?: number;
15 /**
16 * The label of the tooltip.
17 */
18 label?: string;
19 /**
20 * The `ReactNode` to be used as the trigger of the tooltip.
21 */
22 children: React.ReactNode;
23 /**
24 * If `true` display an arrow tip on the tooltip.
25 */
26 hasArrow?: boolean;
27 placement?: PopperProps["placement"];
28 /**
29 * If `true` hide the tooltip, when the trigger is clicked.
30 */
31 closeOnClick?: boolean;
32 /**
33 * If `true`, the tooltip is initially shown.
34 */
35 defaultIsOpen?: boolean;
36 /**
37 * If `true`, the tooltip is shown.
38 */
39 isOpen?: boolean;
40 /**
41 * If `true`, the tooltip will wrap the children in a `span` with `tabIndex=0`
42 */
43 shouldWrapChildren?: boolean;
44 /**
45 * Function called when the tooltip shows.
46 */
47 onOpen?: () => void;
48 /**
49 * Function called when the tooltip hides.
50 */
51 onClose?: () => void;
52}
53
54export type TooltipProps = ITooltip & BoxProps;
55
56declare const Tooltip: React.FC<TooltipProps>;
57
58export default Tooltip;