Zum Hauptinhalt springen Seitenleiste
Auf dieser Seite
Zum Inhaltsverzeichnis springen

Tooltip

<pc-tooltip> 0.4.0 experimental

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Tooltips display additional information based on a specific action.

A tooltip’s target is its first child element, so you should only wrap one element inside the tooltip. If you need the tooltip to show up for multiple elements, nest them inside a container first.

Edit

Demos

Placement

Use the placement attribute to set the preferred placement of the tooltip.

Edit

Click trigger

Set the trigger attribute to click to toggle the tooltip on click instead of hover.

Edit

Manual trigger

Tooltips can be controlled programmatically by setting the trigger attribute to manual. Use the open attribute to control when the tooltip is shown.

Edit

Removing arrows

You can control the size of tooltip arrows by overriding the --pc-tooltip-arrow-size custom property. To remove them, set the value to 0 as shown below.

Edit

To override it globally, set it in a root block in your styles after the Placer Toolkit styles are loaded.

:root {
    --pc-tooltip-arrow-size: 0;
}

HTML in tooltips

Use the content slot to create tooltips with HTML content. Tooltips are designed only for text and presentational elements. Avoid placing interactive content, such as buttons, links and form controls, in a tooltip.

Edit

Set a maximum width

Use the --max-width custom property to change the width the tooltip can grow to before it wraps.

Edit

Eigenschaften

NameBeschreibungReflektiertStandard
contentThe tooltip’s content. If you need to display HTML, use the content slot instead.
Typ: string
""
placementThe preferred placement of the tooltip. Note that the actual placement will vary as configured to keep the tooltip inside of the viewport.
Typ: "top" | "top-start" | "top-end" | "right" | "right-start" | "right-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "left-start" | "left-end"
"top"
disabledDisables the tooltip so it won’t show when triggered.
Typ: boolean
false
distanceThe distance in pixels from which to offset the tooltip away from its target.
Typ: number
8
openIndicates whether or not the tooltip is open. You can use this instead of the show() and hide() methods.
Typ: boolean
false
skiddingThe distance in pixels from which to offset the tooltip along its target.
Typ: number
0
triggerControls how the tooltip is activated. Possible options include click, hover, focus and manual. Multiple options can be passed by separating them with a space. When manual is used, the tooltip must be activated programmatically.
Typ: string
"hover focus"
updateComplete Ein schreibgeschütztes Promise, das erfüllt ist, sobald die Komponente fertig aktualisiert wurde.

Erfahre mehr über Attribute und Eigenschaften.

Slots

NameBeschreibung
(Standard)The tooltip’s target element. Avoid slotting in more than one element, as subsequent elements will be ignored.
contentThe content to render in the tooltip. Alternatively, you can use the content attribute.

Erfahre mehr über die Benutzung von Slots.

Methoden

NameBeschreibungArgumente
show()Shows the tooltip.
hide()Hides the tooltip.

Erfahre mehr über Methoden.

Events

NameBeschreibungEvent‐Detail
pc-showEmitted when the tooltip starts to show.
pc-after-showEmitted when the tooltip shows and all animations are complete.
pc-hideEmitted when the tooltip starts to hide.
pc-after-hideEmitted when the tooltip hides and all animations are complete.

Erfahre mehr über Events.

Benutzerdefinierte Eigenschaften

NameBeschreibungStandard
--max-widthThe maximum width of the tooltip before its content will wrap.30ch
--hide-delayThe amount of time to wait before hiding the tooltip when hovering.0s
--show-delayThe amount of time to wait before showing the tooltip when hovering.0.15s

Erfahre mehr über das Anpassen von benutzerdefinierten Eigenschaften.

Parts

NameBeschreibung
baseThe component’s base wrapper, a <pc-popup> element.
base-popupThe popup’s popup part. Use this to target the tooltip’s popup container.
base-arrowThe popup’s arrow part. Use this to target the tooltip’s arrow.

Erfahre mehr über das Anpassen von CSS‐Parts.

Animationen

NameBeschreibung
tooltip.showThe animation to use when showing the tooltip.
tooltip.hideThe animation to use when hiding the tooltip.

Erfahre mehr über das Anpassen von Animationen.

Importieren

Wenn du den Autoloader oder den Standard‐Loader nutzt, kannst du diesen Abschnitt überspringen. Falls du „Cherry Picking“ betreibst, kannst du die folgenden Snippets verwenden, um diese Komponente zu importieren.

CDN (Skript‐Tag)CDN (Import)npm (Import)

Um diese Komponente manuell vom CDN zu importieren, kannst du dieses Code‐Snippet kopieren und es in dein HTML einfügen.

<script type="module" src="https://cdn.jsdelivr.net/npm/placer-toolkit@1.0.0-alpha.3/cdn/components/tooltip/tooltip.js"></script>

Um diese Komponente manuell vom CDN zu importieren, kannst du dieses Code‐Snippet kopieren und es in deine JavaScript‐Datei einfügen.

import "https://cdn.jsdelivr.net/npm/placer-toolkit@1.0.0-alpha.3/cdn/components/tooltip/tooltip.js";

Um diese Komponente manuell von npm zu importieren, kannst du dieses Code‐Snippet kopieren und es in deine JavaScript‐Datei einfügen.

import "placer-toolkit/dist/components/tooltip/tooltip.js";

Abhängigkeiten

Diese Komponente importiert automatisch folgende Komponenten:

Wir würden uns freuen, von dir zu hören. Kontaktiere uns bitte bei Fragen oder Anliegen, die du hast.

Du kannst uns per E‐Mail unter placer.coc.reports+contact@gmail.com erreichen.

Wir freuen uns darauf, von dir zu hören!

Alles klar!
Gefährliche Lande

Ui! Du bist in die gefährlichen Lande von Placer Toolkit geraten. Version 0 ist veraltet und entspricht nicht den EU‐Datenschutzstandards, einschließlich DSGVO.

Willst du die neuesten Kräfte, Sicherheit und Compliance? Bleib bei der aktuellen Version von Placer Toolkit!

Ups! Aufladen!

Unsere Website ist zu 100 % frei von Cookies! Wir legen großen Wert auf deine Privatsphäre und speichern daher keinerlei Cookies oder persönliche Informationen über dich.

Dein Browserverlauf bleibt sauber und deine Daten sind geschützt, ganz im Einklang mit modernen Datenschutzstandards wie der DSGVO. Genieße deinen Besuch ganz ohne digitale Cookies! 🍪🚫

Weitere Informationen findest du in unserer Datenschutzerklärung.

Alles klar!