A tooltip component to display contextual messages.
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props | object | Component props. Properties
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
type | string | The type of the tooltip button, one of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
ref | object | | Ref to the component. |
- Since
- 1.1.15
- Source
Return the functional tooltip component in React.
- Type:
- JSX.
Element
import Tooltip from '@gravityforms/components/react/admin/modules/Tooltip';
return (
<Tooltip customClasses={ [ 'example-class' ] } maxWidth={ 200 }>
{ children }
</Tooltip>
);
Methods
(inner) TooltipContent(con, cAttributes) → {JSX.Element|null}
The tooltip content if content exists, otherwise null.
Name | Type | Description |
---|---|---|
con | string | Tooltip content. Can only be strings. |
cAttributes | object | Custom attributes for the tooltip content. |
- Source
- Type:
- JSX.
Element |null
(inner) getNewPositionPercentageInFrame(from, to, rect, frame, bf) → {number}
Get the new position percentage in frame from the old position.
Name | Type | Description |
---|---|---|
from | string | Initial position of rect, one of |
to | string | Final position of rect, one of |
rect | DOMRect | The DOMRect object of rect. |
frame | Window | The DOM element of the frame. |
bf | number | The buffer from the edge of the frame, in px. |
- Source
The new position percentage in frame.
- Type:
- number
(inner) getPercentageInFrame(w, h, offsetLeft, offsetRight, offsetTop, offsetBottom) → {number}
Get the percentage of an area that is within frame, whether the box area is defined by width and height.
Name | Type | Description |
---|---|---|
w | number | The width of the box. |
h | number | The width of the box. |
offsetLeft | number | The left offset of the box, which is subtracted from the box area. |
offsetRight | number | The right offset of the box, which is subtracted from the box area. |
offsetTop | number | The top offset of the box, which is subtracted from the box area. |
offsetBottom | number | The bottom offset of the box, which is subtracted from the box area. |
- Source
The percentage of the box area that is within frame, as a decimal.
- Type:
- number
(inner) getSmartPosition(bf, pos, tRef) → {string}
Get smart position based on area in the frame.
Name | Type | Description |
---|---|---|
bf | number | The buffer from the edge of the frame, in px. |
pos | string | The current position of the tooltip. |
tRef | object | The ref object of the tooltip. |
- Source
The smart position based on area.
- Type:
- string