Skip to content

Tooltip - Web Component โ€‹

The Tooltip component can be used imported from:

Playground โ€‹

Parameters โ€‹

The Web component uses the <z-tooltip> tag:

By default, all the parameters are optional or can be set in different, except for the ones marked as required

The parametrization of the component can be done with the following custom HTML params:

NameTypeDescriptionSlotA11y
text
[required]
stringThe text to be displayed inside the tooltip.
configstring

The main parameter has three components following the pattern: <side><?:size>.

  • side: The position of the tooltip. Can be top, top-right, top-left, bottom, bottom-right or bottom-left.
  • size: The size of the tooltip. Can be xs, s ,m or l.
contentstringThe text to be hovereddefault

Slots โ€‹

This component has slots. Check the documentation about how to use the slots.

NameTagsDescription
defaultspanThe text to be hovered

Parameters use โ€‹

content โ€‹

The thing to be assigned to the tooltip. It uses the default slot too.

Tooltip content

text โ€‹

The text parameter is used to define the text that will be displayed when the user hovers the element.

Hover me

config โ€‹

The config parameter is used to define the tooltip side and size. Following the pattern: <side><?:size>

side โ€‹

The side parameter is used to define the position of the tooltip. Can be top, top-right, top-left, bottom, bottom-right or bottom-left.

Hover meHover meHover meHover meHover meHover me
size โ€‹

The size parameter is used to define the size of the tooltip. Can be xs, s ,m or l.

Hover me Hover me Hover me

Both background color and text color can be customized using the --z-tooltip--bg and --z-tooltip--color CSS variables.

Hover me

Browser support โ€‹

Detected engine: ย 

  • Chromium

  • Webkit

  • Gecko

HTML Examples โ€‹

CodeSandbox example โ€‹