ActionTooltip

담당자:
amje
GitHub
title
description
hotkey
disabled
trigger
placement

Tooltip for labeling action buttons without descriptive text (e.g. icon buttons).

Usage

import {ActionTooltip} from '@gravity-ui/uikit';

<ActionTooltip title="Action">
  <div tabIndex={0}>Anchor</div>
</ActionTooltip>;

Anchor

In order for ActionTooltip to work you should pass a valid ReactElement as a children which accepts ref property for HTMLElement and other properties for HTMLElement.

Alternatively, you can pass function as a children to provide ref and props manually to your underlying components:

import {ActionTooltip} from '@gravity-ui/uikit';

<ActionTooltip title="Action">
  {(props, ref) => <MyCustomButton buttonProps={props} buttonRef={ref} />}
</ActionTooltip>;

Controlled State

By default ActionTooltip opens and hides by hovering the anchor. You can change this behaviour to manually set the open state. Pass your state to the open prop and change it from onOpenChange callback. onOpenChange callback has the following signature: (open: boolean, event?: Event, reason: 'hover' | 'focus') => void.

Properties

NameDescriptionTypeDefault
childrenAnchor element for the ActionTooltipReact.ReactElement Function
classNameclass HTML attributestring
closeDelayNumber of ms to delay hiding the ActionTooltip after the hover endsnumber0
containerDOM element to which component is mounted via PortalHTMLElementdocument.body
descriptionDescription contentReact.ReactNode
disablePortalDisables using Portalbooleanfalse
disabledPrevent the ActionTooltip from openingboolean
hotkeyHotkey value to be shown in the top-end cornerHotkey value
offsetActionTooltip offset from its anchornumber4
onOpenChangeCallback to handle open state changeFunction
openControlled open stateboolean
openDelayNumber of ms to delay showing the ActionTooltip after the hover beginsnumber1000
placementActionTooltip position relative to its anchorPopupPlacementbottom
qadata-qa HTML attribute, used for testingstring
strategyThe type of CSS position property to use.absolute fixedabsolute
stylestyle HTML attributeReact.CSSProperties
titleTitle contentstring
triggerEvent type that should trigger opening. By default both hover and focus do."focus"