Tooltip
Tooltips are contextual, non-actionable, and informative floating labels. They can be activated by hover, focus, or even click to display additional information to help users understand something. They should always be non-essential to the global understanding.
Hover me!
<QtmTooltip tooltipTitle="Tooltip title." content="Write the tooltip content here.">
Hover me!
</QtmTooltip>
The tooltip can be displayed by adding a visible
property.
Default tooltip
<QtmTooltip
visible
tooltipTitle="Tooltip title."
content="Write the tooltip content here."
>
Default tooltip
</QtmTooltip>
Tooltip Sizes
Tooltips are available in three sizes: small
, medium
, large
. By default, the medium tooltip is used. You can change the tooltip size with the size
property.
<QtmTooltip
visible
tooltipTitle="Tooltip title."
content="Write the tooltip content here."
size="small"
>
Small tooltip
</QtmTooltip>
<QtmTooltip
visible
tooltipTitle="Tooltip title."
content="Write the tooltip content here."
size="medium"
>
Medium tooltip
</QtmTooltip>
<QtmTooltip
visible
tooltipTitle="Tooltip title."
content="Write the tooltip content here."
size="large"
>
Large tooltip
</QtmTooltip>
Tooltip Orientations
The tooltip component can be positioned according to its target by setting the orientation
property with the bottom
, top
, left
, right
values.
Top tooltip
Left tooltip
Right tooltip
Bottom tooltip
<QtmTooltip
visible
tooltipTitle="Tooltip title."
content="Write the tooltip content here."
orientation="top"
>Top tooltip</QtmTooltip
>
<QtmTooltip
visible
tooltipTitle="Tooltip title."
content="Write the tooltip content here."
orientation="left"
>Left tooltip</QtmTooltip
>
<QtmTooltip
visible
tooltipTitle="Tooltip title."
content="Write the tooltip content here."
orientation="right"
>Right tooltip</QtmTooltip
>
<QtmTooltip
visible
tooltipTitle="Tooltip title."
content="Write the tooltip content here."
orientation="bottom"
>Bottom tooltip</QtmTooltip
>
Tip Positions
The tooltip component should always be positioned according to its target. The tip position variants help you complete the tooltip orientation variant to be even more precise.
For all orientations, use the tipPosition property with the start
, center
, end
values.
<QtmTooltip content="Top end tooltip" visible tipPosition="end"></QtmTooltip>
<QtmTooltip content="Top center tooltip" visible></QtmTooltip>
<QtmTooltip
content="Top start tooltip"
visible
tipPosition="start"
></QtmTooltip>
<QtmTooltip
content="Left end tooltip"
visible
tipPosition="end"
orientation="left"
></QtmTooltip>
...
Low Contrast Option
To lower the visual emphasis on the tooltip component, you can activate the Low contrast option by adding the lowContrast
property. This option will apply a lighter background to the tooltip while remaining always accessible.
Hover me!
<QtmTooltip
visible
lowContrast
tooltipTitle="Tooltip title."
content="Write the tooltip content here."
>
Hover me!
</QtmTooltip>
API
QtmTooltip
Property | Type | Default | Description |
---|---|---|---|
classes | string | '' | List of classes to override or extend the styles applied to the component. You can use available utility classes by importing |
content | string | '' | The tooltip content. |
lowContrast | boolean | false | Low contrast option to apply a lighter background. |
orientation | "bottom" | "left" | "right" | "top" | 'top' | Tooltip position according to its target. |
size | "large" | "medium" | "small" | 'medium' | The size of element |
tipPosition | "center" | "end" | "start" | 'center' | The tip position. |
title | string | '' | DEPRECATED: The deprecated tooltip title. Use `tooltipTitle` instead. |
tooltipTitle | string | '' | The tooltip title. |
visible | boolean | false | Visible option of the tooltip to display. |
Deprecated Property
Note: The title
property is deprecated. Use the tooltipTitle
property instead.