Skip to main content

Tooltip

A simple text popup tip.

When To Use#

  • The tip is shown on mouse enter, and is hidden on mouse leave. The Tooltip doesn't support complex text or operations.
  • To provide an explanation of a button/text/operation. It's often used instead of the html title attribute.

Examples#

import { Position, Tooltip } from 'tailor-ui';

Basic#

Position#

Use mouseEnterDelay and mouseLeaveDelay#

Controlled usage#

With defaultVisible#

API#

PropertyDescriptionTypeDefault
defaultVisibleWhether the floating tooltip card is visible by defaultboolean
visibleWhether the floating tooltip card is visibleboolean
onVisibleChangeCallback executed when visibility of the tooltip card is changed(visible: boolean) => void
positionThe position base on the children componentPositionsPosition.TOP
mouseEnterDelayDelay in milliseconds, before tooltip is shown on mouse enternumber0
mouseLeaveDelayDelay in milliseconds, before tooltip is hidden on mouse leavenumber200
contentA string or react component inside this tooltip. If you are using click to trigger, it can be a function that with hide callback as first argumentReactNode | (handleClose: () => void) => ReactNode
onOpenCompleteWhether to mount child components on onClose() => void
onCloseCompleteWhether to unmount child components on onClose() => void
WrapperThe wrapper of tooltip contentComponentType