No Preview

Sorry, but you either have no stories or none are selected somehow.

If the problem persists, check the browser console, or the terminal you've run Storybook from.

The component failed to render properly, likely due to a configuration issue in Storybook. Here are some common causes and how you can address them:

  1. Missing Context/Providers: You can use decorators to supply specific contexts or providers, which are sometimes necessary for components to render correctly. For detailed instructions on using decorators, please visit the Decorators documentation.
  2. Misconfigured Webpack or Vite: Verify that Storybook picks up all necessary settings for loaders, plugins, and other relevant parameters. You can find step-by-step guides for configuring Webpack or Vite with Storybook.
  3. Missing Environment Variables: Your Storybook may require specific environment variables to function as intended. You can set up custom environment variables as outlined in the Environment Variables documentation.

This is a pre-release version and is not production ready. For new and ongoing projects, please refer to the latest Design System version.

For short, informative messages or explanations.
Hi there 👋
<post-tooltip-trigger for="tooltip-one"> <button class="btn btn-secondary btn-large">Button</button></post-tooltip-trigger > <post-tooltip id="tooltip-one" class="palette-accent" placement="top" animation="none"> Hi there 👋 </post-tooltip>
NameDescriptionDefaultControl
General
Content
Defines the HTML markup contained in the tooltip. Markup accepted: inline content like <span> or <post-icon>, but no interactive content like <a> or <button>.
string
-
Palette
Define the color scheme of the tooltip.
HTML class attribute
-
props
Placement

Defines the position of the tooltip relative to its trigger. Tooltips are automatically flipped to the opposite side if there is not enough available space and are shifted towards the viewport if they would overlap edge boundaries. For supported values and behavior details, see the Floating UI placement documentation.

"bottom""bottom-end""bottom-start""left""left-end""left-start""right""right-end"
'top'
Animation
Choose a tooltip animation
"pop-in"
Arrow
Whether or not to display a little pointer arrow
boolean
false
open
Indicates the open state of the tooltip
boolean
false
methods
hide
Programmatically hide this tooltip.
hide() => Promise<void>
--
show
Programmatically display the tooltip.
show(target: HTMLElement) => Promise<void>
--
toggle
Toggle tooltip display.
toggle(target: HTMLElement, force?: boolean) => Promise<void>
--

<post-tooltip-trigger>

The <post-tooltip-trigger> component enables you to show tooltips with customizable delay.

This is the tooltip content
<post-tooltip-trigger for="tooltip-cd684d90-e7a7-41a9-8923-b1b72ad9b385--default" delay="300"> <button class="btn btn-secondary btn-large">Tooltip with delay</button> </post-tooltip-trigger> <post-tooltip id="tooltip-cd684d90-e7a7-41a9-8923-b1b72ad9b385--default"> This is the tooltip content </post-tooltip>
NameDescriptionDefaultControl
props
delay
Delay (in milliseconds) before the tooltip is shown.
number
0
for*
ID of the tooltip element that this trigger is linked to.
string
-
slots
default
Content to trigger the tooltip. Can contain any focusable element or will be made focusable automatically.
other
--

The <post-tooltip> and <post-tooltip-trigger> elements are part of the @swisspost/design-system-components package. For more information, read the getting started with components guide.

If you assign a tooltip to a non-focusable element, the component will add tabindex="0" automatically. With that, the tooltip is also visible for keyboard users. Also, if you forget to link the tooltip and the trigger with aria-describedby="tooltip-id", we've got you covered.

This is a cite element with a tooltip on it. This is not the link you are looking for

The same tooltip can be displayed on multiple elements. This reduces the amount of markup necessary.

I'm the same, no matter what