ctify

Tooltips

Tooltips display brief labels or messages

Usage

Props

TooltipTrigger

NameTypeDefaultDescription
childrenReactNode
isDisabledbooleanWhether the tooltip should be disabled, independent from the trigger.
delaynumber1500The delay time for the tooltip to show up.
closeDelaynumber500The delay time for the tooltip to close.
triggerfocusBy default, opens for both focus and hover. Can be made to open only for focus.
isOpenboolean12Whether the overlay is open by default (controlled).
defaultOpenboolean0Whether the overlay is open by default (uncontrolled).

Tooltip

NameTypeDefaultDescription
triggerRefRefObject<Element | null>The ref for the element which the tooltip positions itself with respect to. When used within a TooltipTrigger this is set automatically. It is only required when used standalone.
isEnteringbooleanWhether the tooltip is currently performing an entry animation.
isExitingbooleanWhether the tooltip is currently performing an exit animation.
UNSTABLE_portalContainerElementdocument.bodyThe container element in which the overlay portal will be placed. This may have unknown behavior depending on where it is portalled to.
placementPlacement'top'The placement of the tooltip with respect to the trigger.
containerPaddingnumber12The placement padding that should be applied between the element and its surrounding container.
offsetnumber0The additional offset applied along the main axis between the element and its anchor element.
crossOffsetnumber0The additional offset applied along the cross axis between the element and its anchor element.
shouldFlipbooleantrueWhether the element should flip its orientation (e.g. top to bottom or left to right) when there is insufficient room for it to render completely.
isOpenbooleanWhether the element is rendered.
arrowBoundaryOffsetnumber0The minimum distance the arrow's edge should be from the edge of the overlay element.
defaultOpenbooleanWhether the overlay is open by default (uncontrolled).
childrenReactNode | (values: TooltipRenderProps & { defaultChildren: ReactNode | undefined }) => ReactNodeThe children of the component. A function may be provided to alter the children based on component state.
classNamestring | (values: TooltipRenderProps & { defaultClassName: string | undefined}) => stringThe CSS className for the element. A function may be provided to compute the class based on component state.
styleCSSProperties | (values: TooltipRenderProps & {defaultStyle: CSSProperties}) => CSSProperties | undefinedThe inline style for the element. A function may be provided to compute the style based on component state.