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:
This is a pre-release version and is not production ready. For new and ongoing projects, please refer to the latest Design System version.
next.design-system.post.ch/?path=/docs/cd684d90-e7a7-41a9-8923-b1b72ad9b384--docs&story=Default#cd684d90-e7a7-41a9-8923-b1b72ad9b384--default
/?path=/story/cd684d90-e7a7-41a9-8923-b1b72ad9b384--default&full=true
<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>
Name | Description | Default | Control |
---|---|---|---|
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.
next.design-system.post.ch/?path=/docs/cd684d90-e7a7-41a9-8923-b1b72ad9b385--docs&story=Default#cd684d90-e7a7-41a9-8923-b1b72ad9b385--default
/?path=/story/cd684d90-e7a7-41a9-8923-b1b72ad9b385--default&full=true
<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>
Name | Description | Default | Control |
---|---|---|---|
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.
next.design-system.post.ch/?path=/docs/cd684d90-e7a7-41a9-8923-b1b72ad9b384--docs&story=Non Focusable#cd684d90-e7a7-41a9-8923-b1b72ad9b384--non-focusable
/?path=/story/cd684d90-e7a7-41a9-8923-b1b72ad9b384--non-focusable&full=true
The same tooltip can be displayed on multiple elements. This reduces the amount of markup necessary.
next.design-system.post.ch/?path=/docs/cd684d90-e7a7-41a9-8923-b1b72ad9b384--docs&story=Multiple#cd684d90-e7a7-41a9-8923-b1b72ad9b384--multiple
/?path=/story/cd684d90-e7a7-41a9-8923-b1b72ad9b384--multiple&full=true