Tooltip
A tooltip briefly describes an interactive element on mouse hover or keyboard focus.Installation
| Install | yarn add @atlaskit/tooltip |
|---|---|
| Source | Bitbucket.org, (opens new window) |
| npm | @atlaskit/tooltip, (opens new window) |
| Bundle | unpkg.com, (opens new window) |
Props
| Description | Analytics context metadata. |
|---|---|
| Type | { [x: string]: any; } |
| Description | Whether or not the tooltip can be displayed. Once a tooltip is scheduled to be displayed, or is already displayed, it will continue to be shown. @description
|
|---|---|
| Type | () => boolean |
| Description | Elements to be wrapped by the tooltip. It can be either a:
|
|---|---|
| Type | React.ReactNode | ((props: TriggerProps) => React.ReactNode) |
| Description | Extend |
|---|---|
| Type | React.ComponentType<TooltipPrimitiveProps> | React.ForwardRefExoticComponent<Omit<TooltipPrimitiveProps, "ref"> & React.RefAttributes<HTMLDivElement>> |
| Description | The content of the tooltip. It can be either a:
This content will be rendered into two places:
|
|---|---|
| Type | React.ReactNode | (({ update }: { update?: () => void; }) => React.ReactNode) |
| Description | Time in milliseconds to wait before showing and hiding the tooltip. Defaults to 300. |
|---|---|
| Default | 300 |
| Type | number |
| Description | Hide the tooltip when the click event is triggered. Use this when the tooltip should be hidden if With |
|---|---|
| Default | false |
| Type | boolean |
| Description | Hide the tooltip when the mousedown event is triggered. This should be
used when tooltip should be hidden if With |
|---|---|
| Default | false |
| Type | boolean |
| Description | Adds |
|---|---|
| Default | false |
| Type | boolean |
| Description | By default tooltip content will be duplicated into a hidden element so it can be read out by a screen reader. Sometimes this is not ideal as it can result in the same content be announced twice. For those situations, you can leverage this prop to disable the duplicate hidden text. |
|---|---|
| Default | false |
| Type | boolean |
| Description | Where the tooltip should appear relative to the mouse pointer.
Only use this when the |
|---|---|
| Default | "bottom" |
| Type | AutoPlacement | BasePlacement | VariationPlacement |
| Description | Function to be called when the tooltip will be hidden. It's called after the delay, when the tooltip begins to animate out. |
|---|---|
| Default | noop |
| Type | (analyticsEvent: UIAnalyticsEvent) => void |
| Description | Function to be called when the tooltip will be shown. It's called when the tooltip begins to animate in. |
|---|---|
| Default | noop |
| Type | (analyticsEvent: UIAnalyticsEvent) => void |
| Description | Where the tooltip should appear relative to its target.
If set to |
|---|---|
| Default | "bottom" |
| Type | Placement | PositionMouseOptions |
| Description | Display a keyboard shortcut in the tooltip. Keys will be displayed as individual keyboard key segments after the tooltip content. |
|---|---|
| Type | string[] |
| Description | When set to true, the tooltip will always use the fade-in animation and never use the show-immediate behavior, even when another tooltip is already visible. |
|---|---|
| Default | false |
| Type | boolean |
| Description | When enabled, the tooltip will be rendered as a sibling to the trigger element instead of being portaled to the document body. This is an experimental prop and may be removed at any time. It is not yet intended for public use. |
|---|---|
| Default | false |
| Type | boolean |
| Description | Use this to define the strategy of popper. |
|---|---|
| Default | "fixed" |
| Type | "fixed" | "absolute" |
| Description | Replace the wrapping element. This accepts the name of a html tag which will be used to wrap the element. If you provide a component, it needs to support a ref prop which is used by popper for positioning. |
|---|---|
| Type | keyof JSX.IntrinsicElements | React.ComponentType<React.AllHTMLAttributes<HTMLElement> & { ref: React.Ref<HTMLElement>; }> | React.ForwardRefExoticComponent<...> |
| Description | A |
|---|---|
| Type | string |
| Description | Use this to show only one line of text, and truncate the text when it's too long. We no longer support truncating text in the tooltip as it's inaccessible, and this prop will be removed in a future release. |
|---|---|
| Default | false |
| Type | boolean |