Skip to main content

Tooltip
Ready

Tooltips are floating labels that briefly explain the function of a user interface element. They can be triggered when user clicks or navigates to it via keyboard.

Please keep in mind that when the screen width is under 768px this component should always be positioned on the right side of the screen as it’s going to open towards left.

Examples

Open in new window
<div style="padding-top:170px;margin:0 auto;max-width:100px;">
<duet-tooltip active>
Hello, I’m a tooltip! To close me you can hit ESC key,
click the close button, or click the X button.
</duet-tooltip>
</div>
Open in new window
<div style="margin:260px 0 0 20px;width:100%;min-height:100px;">
<duet-tooltip active label="Click me to open a tooltip">
Hello, I’m a tooltip! To close me you can hit ESC key,
click the close button, or click the X button.
</duet-tooltip>
</div>
Open in new window
<div style="margin:40px auto 0;width:60%;min-height:400px;">
<duet-input label="Katuosoite" placeholder="Kadunnimi 1 A 2" tooltip="Hello, I’m a tooltip! To close me, you can click outside of the tooltip, hit ESC key or click the X button." required expand></duet-input>
</div>
Open in new window
<div style="padding-top:170px;margin:0 auto;max-width:100px;">
<duet-tooltip breakpoint="large" active>
Hello, I’m a tooltip! To close me you can hit ESC key,
click the close button, or click the X button.
</duet-tooltip>
</div>
Open in new window
<div style="padding-top:170px;margin:0 auto;max-width:100px;">
<duet-tooltip direction="right" active>
Hello, I’m a tooltip! To close me you can hit ESC key,
click the close button, or click the X button.
</duet-tooltip>
</div>
Open in new window
<div style="padding-top:170px;margin:0 auto;max-width:100px;">
<duet-tooltip direction="left" active>
Hello, I’m a tooltip! To close me you can hit ESC key,
click the close button, or click the X button.
</duet-tooltip>
</div>

Properties #

Property Attribute Description Type Default
accessibleCloseLabel accessible-close-label Adds accessible label for the close icon that is only shown for screen readers. This property is always required to create an accessibly interface! string "Sulje lisätiedot"
accessibleLabel accessible-label Adds accessible label for the info icon that is only shown for screen readers. This property is always required to create an accessibly interface! string "Näytä lisätietoja"
active active Toggle whether the tooltip is initially visible or not. This property should not be used in production in most cases. boolean false
breakpoint breakpoint Adjust the responsive breakpoint where tooltip starts opening towards left. "large" | "medium" "medium"
direction direction With direction setting you can force the tooltip to always open towards left or right instead of automatically determining the direction. "auto" | "left" | "right" "auto"
label label Label of the tooltip. If used, replaces the accessibleLabel option. string ""
positionHorizontal position-horizontal Adjust the horizontal positioning of the tooltip toggle in pixels. Can be a negative value as well. E.g. "-13px". string "0"
positionVertical position-vertical Adjust the vertical positioning of the tooltip toggle in pixels. Can be a negative value as well. E.g. "-13px". string "0"
theme theme Theme of the tooltip. "" | "default" | "turva" ""

Usage #

This section includes guidelines for designers and developers about the usage of this component in different contexts.

When to use #

  • When you need to provide an explanation for an element.
  • To add a floating label that briefly explains the function of a user interface element.

When not to use #

  • For communicating critical information, like errors. Use alert component instead.
  • When you need to include links or actions.
  • When you have a long explanation.

Accessibility #

This component has been validated to meet the WCAG 2.1 AA accessibility guidelines. You can find additional information regarding accessibility of this component below.


Integration

For integration, event and theming guidelines, please see Using Components. This documentation explains how to implement and use Duet’s components across different technologies like Angular, React or Vanilla JavaScript.



Tutorials

Follow these practical tutorials to learn how to build simple page layouts using Duet’s CSS Framework, Web Components and other features:

Tutorials

Abstract

Tutorials

Building Layouts

Tutorials

Using CLI Tools

Tutorials

Creating Custom Patterns

Tutorials

Server Side Rendering

Tutorials

Sharing Prototypes

Tutorials

Usage With Markdown

Tutorials

VS Code

Tutorials

Zeplin


Troubleshooting

If you experience any issues while using a component, please head over to the Support page for more guidelines and help.