Skip to content

Tooltip Spark

Der Tooltip Spark hängt einen gestylten Tooltip an ein Element im Forge-Ergebnis. Der Inhalt kann normaler Text, HTML oder ein Template sein.

Grundnutzung

yaml
type: custom:uix-forge
forge:
  mold: card
  sparks:
    - type: tooltip
      for: hui-tile-card $ ha-tile-icon
      content: Wohnzimmer-Licht
element:
  type: tile
  entity: light.living_room
yaml
type: custom:uix-forge
forge:
  mold: card
  sparks:
    - type: tooltip
      for: hui-tile-card
      content: "<b>Status:</b> &#123;&#123; states(config.element.entity) &#125;&#125;"
      placement: bottom
element:
  type: tile
  entity: light.living_room

Konfiguration

SchlüsselTypPflichtStandardBeschreibung
typestringja-Muss tooltip sein.
forstringneinelement, bei Blank Card uix-forge-blank-card $ div.contentUIX-Selektor für das Zielelement.
contentstringnein""HTML-Inhalt des Tooltips.
placementstringneintopPosition relativ zum Ziel: top, top-start, top-end, bottom, bottom-start, bottom-end, left, left-start, left-end, right, right-start, right-end.
distancenumbernein8Abstand zwischen Tooltip und Ziel in Pixeln.
skiddingnumbernein0Versatz entlang der Achse des Zielelements in Pixeln.
show_delaynumbernein150Wartezeit bis zum Anzeigen in Millisekunden.
hide_delaynumbernein150Wartezeit bis zum Ausblenden in Millisekunden.
without_arrowbooleanneinfalseBei true wird der Richtungspfeil ausgeblendet.

TIP

Wenn ein Element bereits ein natives title-Attribut besitzt, kann der Attribute Spark es entfernen, damit nicht zwei Tooltips gleichzeitig erscheinen.

Templates im Inhalt

yaml
type: custom:uix-forge
forge:
  mold: card
  sparks:
    - type: tooltip
      for: hui-tile-card
      content: |
        <strong>&#123;&#123; state_attr(config.element.entity, 'friendly_name') &#125;&#125;</strong><br>
        Status: &#123;&#123; states(config.element.entity) &#125;&#125;
element:
  type: tile
  entity: sensor.outdoor_temperature

Tooltip auf einem Badge

yaml
# Badge im Dashboard-Header
type: custom:uix-forge
forge:
  mold: badge
  sparks:
    - type: tooltip
      content: Haustuer seit &#123;&#123; relative_time(states.binary_sensor.front_door.last_changed) &#125;&#125;
      placement: bottom
element:
  type: entity
  entity: binary_sensor.front_door

Aussehen anpassen

::: note Tooltip-Styles werden über CSS-Variablen gesetzt. Das ist stabiler als interne Tooltip-Elemente direkt zu stylen.

:::

yaml
type: custom:uix-forge
forge:
  mold: card
  sparks:
    - type: tooltip
      for: hui-tile-card
      content: Fenster offen
element:
  type: tile
  entity: binary_sensor.window
uix:
  style: |
    :host {
      --uix-tooltip-background-color: var(--error-color);
      --uix-tooltip-content-color: var(--white-color);
      --uix-tooltip-border-radius: 8px;
    }

CSS-Variablen

CSS-VariableStandardBeschreibung
--uix-tooltip-background-color--secondary-background-colorHintergrundfarbe.
--uix-tooltip-content-color--primary-text-colorTextfarbe.
--uix-tooltip-font-family--ha-font-family-bodySchriftfamilie.
--uix-tooltip-font-size--ha-font-size-sSchriftgröße.
--uix-tooltip-font-weight--ha-font-weight-normalSchriftgewicht.
--uix-tooltip-line-height--ha-line-height-condensedZeilenhöhe.
--uix-tooltip-padding8pxInnenabstand.
--uix-tooltip-border-radius--ha-border-radius-smRundung.
--uix-tooltip-arrow-size8pxGröße des Richtungspfeils.
--uix-tooltip-border-widthnicht gesetztRahmenbreite.
--uix-tooltip-border-colornicht gesetztRahmenfarbe.
--uix-tooltip-border-stylenicht gesetztRahmenstil.
--uix-tooltip-max-width30chMaximale Breite.
--uix-tooltip-show-duration100msDauer der Einblendanimation.
--uix-tooltip-hide-duration100msDauer der Ausblendanimation.
--uix-tooltip-opacity1Deckkraft.
--uix-tooltip-box-shadow--ha-card-box-shadowSchatten.
--uix-tooltip-text-aligncenterTextausrichtung.
--uix-tooltip-text-decorationnoneTextdekoration.
--uix-tooltip-text-transformnoneTexttransformation.
--uix-tooltip-overflow-wrapnormalUmbruchverhalten langer Inhalte.