Skip to main content
2.0.0Next2.0.92.0.82.0.72.0.62.0.52.0.42.0.32.0.22.0.12.0.01.0.0
Version: 2.0.0

Tooltip

A Tooltip is a small popup that appears when the user hovers an associated UI item. Tooltips are used to inform the user of an action they are about to take, or to provide other contextual information. They are especially useful for buttons with only an icon (and no label), because unfamiliar users might not know what the button does.

Basic Usage

<triton-tooltip title="This is a tooltip">
A tooltip will open when this text is hovered
</triton-tooltip>
<TritonTooltip title="This is a tooltip"> 
A tooltip will open when this text is hovered
</TritonTooltip>
<html> 
<head>
<script type="module">
import { defineCustomElements } from '~node_modules/@kognifai/triton-cl-core/loader/index.es2017.js';
defineCustomElements();
</script>
</head>
<body>
<triton-tooltip title="This is a tooltip">
A tooltip will open when this text is hovered
</triton-tooltip>
</body>
</html>

A tooltip will open when this text is hovered

Behavior

The TritonTooltip can be used by wrapping a markup element in a <triton-tooltip>. Use the title property to set the content of the tooltip.

A tooltip will open when this text is hovered

<triton-tooltip title="This is a tooltip">
<h4>A tooltip will open when this text is hovered</h4>
</triton-tooltip>

Placement

There are several options for where to place the tooltip relative to its associated element.

toptopLefttopRight
rightrightBottomrightTop
leftleftBottomleftTop
bottombottomLeftbottomRight
<triton-tooltip title="tooltip!" placement="top">
<triton-badge>top</triton-badge>
</triton-tooltip>
...

API

Properties

PropertyDescriptionTypeDefault
placementWhere to place the tooltip relative to the object it belongs tobottom bottomLeft bottomRight left leftBottom leftTop right rightBottom rightTop top topLeft topRight'bottom'
sizeSet the size of the component.This size setting will only affect the tooltip popup itself, not the element that triggers the tooltipbase body large medium small tiny xlarge xxlarge xxxlargedefaultOptions.baseSize
titleTextual content of the tooltip. If no content is provided, the tooltip will not showstring-

Slots

Main

takes any kind of markup element

<triton-tooltip>
<div></div>
</triton-tooltip>