Skip to content

Adapted from the canonical English UIX documentation by Lint-Free-Technology/uix, CC BY 4.0. Source: dev / 9.0.0-beta.2, revision 26e54e6, reviewed 22 October 2026. This source mirror may describe preview behavior beyond stable 8.4.0. Markup adapted for this site; the original documentation remains authoritative.

Map spark ​

The map spark adds advanced map state management to a map card used inside a UIX Forge forged element. It supports five modes:

  • Memory mode (memory: true): Captures the current map zoom and centre before each update and restores them afterwards, so the user's view is always preserved. Without it, every forge template update causes the map to reset to its default zoom level and centre position.
  • Fit map mode (fit_map: true): Fits the map view when map card does not auto fit on load when used in custom cards which may hide the map initially. e.g. custom: auto-entities.
  • Tour mode (tour: true | object): Automatically moves the map between a list of points of interest. A pause/play button is injected into the map. When tour: true all defaults are used; pass an object to customise behaviour.
  • Hours to show slider mode (hours_to_show: true | object): Injects an interactive ha-slider overlay into the map allowing users to adjust the hours of history loaded and rendered in real-time.
  • Entity filter overlay mode (entity_filter: true | object): Injects an interactive checkable dropdown checklist overlay into the map allowing users to toggle visible entities on the map in real-time.

Basic usage ​

yaml
type: custom:uix-forge
forge:
  mold: card
  sparks:
    - type: map
      memory: true
element:
  type: map
  entities:
    - device_tracker.phone

Configuration ​

KeyTypeDefaultDescription
typestring—Must be map.
memorybooleanfalseSave/restore zoom and centre before/after each update.
fit_mapbooleanfalseFit map view to all entities once map is visible (useful for cards hidden on load).
tourboolean or objectfalseEnable tour mode. true uses all defaults; pass an object to customise (see below).
hours_to_showboolean or objectfalseEnable hours to show slider overlay. true uses all defaults; pass an object to customise (see below).
entity_filterboolean or objectfalseEnable entity filter checklist dropdown overlay. true uses all defaults; pass an object to customise (see below).

Tour sub-keys ​

KeyTypeDefaultDescription
periodstring or number10sTime to spend at each point of interest. Accepts a human-readable duration (e.g. "30s", "2m") or a number in milliseconds.
zoomnumber14Default zoom level used when moving to a POI.
icon_pausestringmdi:pauseIcon shown on the overlay button while the tour is playing.
icon_playstringmdi:playIcon shown on the overlay button while the tour is paused.
icon_positionobject{bottom: 40px, right: 10px}CSS position of the pause/play button. Accepts top, bottom, left, and right keys (numbers are treated as pixels).
poilist(unset)List of points of interest. When omitted, the entities declared on the ha-map card are used.

Each poi list entry may contain:

KeyTypeDescription
entitystringEntity ID. Must be present in the ha-map's entities list. Lat/lng are read from hass state attributes.
latitudenumberLatitude (required when entity is not set).
longitudenumberLongitude (required when entity is not set).
zoomnumberPer-POI zoom override.

Hours to Show sub-keys ​

KeyTypeDefaultDescription
minnumber0Minimum hours to show on the slider.
maxnumber24Maximum hours to show on the slider.
stepnumber1Increment step size of the slider.
positionobject{bottom: 40px, right: 10px}CSS position of the slider capsule. Accepts top, bottom, left, and right keys (numbers are treated as pixels).
tooltip_distancenumber20Distance in pixels of slider tooltip away from thumb.

Controls with no position configured, or an explicit {bottom: 40px, right: 10px}, share a horizontal row above the map attribution. Other positions, including {bottom: 10px, right: 10px}, use the configured offsets independently.

Entity Filter sub-keys ​

KeyTypeDefaultDescription
positionobject{bottom: 40px, right: 10px}CSS position of the filter button capsule. Accepts top, bottom, left, and right keys (numbers are treated as pixels).
sizestringsButton size (e.g. s, m, l).
variantstringneutralButton variant brand/style (e.g. brand, neutral, danger, warning, success).
appearancestringfilledButton presentation appearance (e.g. accent, filled, plain).
iconstringmdi:filter-variantTrigger button start-icon representation.
labelstringFilterTrigger button label string. Set to empty string to disable.
groupboolean or objectfalseGroup entities according to their domain. Set to true to use defaults, or an object to set labels for each entity domain grouping.

Entity filter group sub-keys ​

KeyTypeDefaultDescription
personsstringPersonsLabel for the person domain entity grouping.
trackersstringTrackersLabel for the device_tracker domain entity grouping.
zonesstringZonesLabel for the zone domain entity grouping.

Tour CSS variables ​

The pause/play button can be styled using CSS variables placed on the ha-card or any ancestor:

VariableDefaultDescription
--uix-map-tour-icon-colorvar(--primary-color)Icon color.
--uix-map-tour-icon-ring-colorvar(--uix-map-tour-icon-color)Countdown ring color (defaults to icon color).
--uix-map-tour-icon-backgroundrgba(255,255,255,0.8)Button background.
--uix-map-tour-icon-box-shadow0 1px 5px rgba(0,0,0,0.4)Box shadow of the icon container.
--uix-map-tour-icon-widthautoButton width.
--uix-map-tour-icon-heightautoButton height.
--uix-map-tour-icon-border-radius9999pxButton border radius (pill by default).
--uix-map-tour-icon-z-index1000Button z-index (Leaflet controls use 1000).

Hours to Show CSS variables ​

The history duration slider can be styled using CSS variables placed on the ha-card or any ancestor:

VariableDefaultDescription
--uix-map-slider-backgroundrgba(255,255,255,0.8)Background color of slider container.
--uix-map-slider-text-colorvar(--primary-text-color, #212121)Color of the duration label next to the slider.
--uix-map-slider-width100pxExplicit width of the slider component.
--uix-map-slider-border-radius9999pxSlider container border radius (pill by default).
--uix-map-slider-padding4px 12pxPadding of the capsule container.
--uix-map-slider-box-shadow0 1px 5px rgba(0,0,0,0.4)Box shadow of the container element.
--uix-map-slider-z-index1000Controls overlay depth of the slider capsule.
--uix-map-slider-label-min-width28pxMinimum width of the duration label.
--uix-map-slider-thumb-size(unset)Height and width of the slider thumb.
--uix-map-slider-thumb-height16pxHeight of the slider thumb component structure (defaults to thumb-size if set).
--uix-map-slider-thumb-width16pxWidth of the slider thumb component structure (defaults to thumb-size if set).
--uix-map-slider-track-size4pxThickness of the slider track.
--uix-map-slider-track-colorvar(--disabled-color)Background base track color.
--uix-map-slider-indicator-colorvar(--primary-color)Color of the active indicator bar.
--uix-map-slider-thumb-colorvar(--uix-map-slider-indicator-color)Color of the circular slider thumb.
--uix-map-slider-thumb-hover-opacity0.08Hover opacity surrounding the thumb.
--uix-map-slider-thumb-pressed-opacity0.12Opacity of thumb halo while active/pressed.
--uix-map-slider-thumb-box-shadowinheritCustom shadow styling applied to the interactive thumb item.
--uix-map-slider-tooltip-colorvar(--primary-text-color)Text color inside the popup thumb tooltip.
--uix-map-slider-tooltip-font-sizevar(--ha-font-size-s)Font size of text inside the tooltip.
--uix-map-slider-tooltip-font-weightvar(--ha-font-weight-normal)Font thickness of elements inside tooltip.
--uix-map-slider-tooltip-background-colorvar(--secondary-background-color)Background color of popup tooltip bubble.
--uix-map-slider-tooltip-border-radiusvar(--ha-border-radius-sm)Corner rounding of tooltip bubble.
--uix-map-slider-tooltip-border-width0pxBorder thickness of tooltip.
--uix-map-slider-tooltip-border-colorcurrentColorBorder color of tooltip bubble.
--uix-map-slider-tooltip-border-stylenoneBorder line style.

Entity Filter CSS variables ​

The entity filter dropdown can be styled using CSS variables placed on the ha-card or any ancestor:

VariableDefaultDescription
--uix-map-entity-filter-backgroundrgba(255,255,255,0.8)Background color of entity filter container.
--uix-map-entity-filter-padding4pxPadding of the filter capsule container.
--uix-map-entity-filter-border-radius9999pxEntity filter container border radius (pill by default).
--uix-map-entity-filter-box-shadow0 1px 5px rgba(0,0,0,0.4)Box shadow of the container element.
--uix-map-entity-filter-z-index1000Controls overlay depth of the filter capsule.
--uix-map-entity-filter-dropdown-min-width180pxMinimum width of the opened dropdown menu list.
--uix-map-entity-filter-item-icon-colorvar(--ha-color-fill-neutral-loud-resting)Color of the check icon of entity filter list items.
--uix-map-entity-filter-item-icon-checked-colorvar(--uix-map-entity-filter-item-icon-color, var(--primary-color))Color of the check icon of entity filter items when checked.

How it works ​

Memory mode:

Each time the forged element is about to refresh due to a forge template update, the spark:

  1. Reads the current zoom and center from the map renderer inside ha-map.
  2. Waits for the forged element and then ha-map to finish their own update cycle.
  3. Restores the saved position through Home Assistant's map engine without triggering an animation.

If the map renderer has not yet initialised when the refresh fires (e.g. on initial render) the save step is skipped and no restore is attempted, so the map displays its default view on first load.

Fit map mode:

After the forged element and ha-map finish updating and once the map engine has a usable size, the spark will call fitMap() on ha-map.

Tour mode:

After the map is ready (and after fit_map completes if both are configured), the spark:

  1. Resolves the POI list (from poi config, or by reading latitude/longitude from hass state attributes of the ha-map entities).
  2. Injects a ha-icon-button overlay into the map renderer container with a circular SVG countdown ring around it.
  3. Moves the map to the first POI immediately, then starts a repeating timer that advances to the next POI every period seconds through the map engine.
  4. The countdown ring animates from full to empty over each period, giving a visual indication of time remaining at the current POI.
  5. When the user clicks the pause/play button, the timer is stopped or restarted and the countdown ring is hidden or restarted.

When memory: true and tour are both active, hass-update memory restores are suppressed while the tour is playing so that the tour animation is not interrupted.

Hours to show slider mode:

When active, the spark:

  1. Renders a horizontal ha-slider control in a capsule-shaped overlay container.
  2. If tour is also active and at the default position, the slider is automatically shifted leftwards to prevent visual overlapping.
  3. Automatically sets, clamps, and updates hui-map-card _config.hours_to_show based on slider drags and releases to fetch history records in real-time.
  4. Smoothly preserves the user's selected value across template-driven forge re-renders.

Entity filter overlay mode:

When active, the spark:

  1. Renders a dropdown overlay using ha-dropdown with a trigger ha-button.
  2. Resolves and displays each map entity as a checkbox using Friendly Name.
  3. Directly filters visible entities. As a map card will error with no entities, deselecting any last selected entity is disabled.
  4. If the show_all: true is set in forged map card config, a Show All option will also show in the dropdown. While entities are filtered, any new map entities will not show until Show All is selected.
  5. If touror hours_to_show is also active and at the default position, the slider is automatically shifted leftwards to prevent visual overlapping.
  6. If tour is also active, changing filtered entities will cause the map tour to restart.

INFO

The spark targets the hui-map-card element inside the forged element as well as the ha-map element within its shadow root. It supports Home Assistant's map engine (MapLibre when available, with Leaflet fallback) and older Leaflet-based frontends. If the forged element is not a map card (or is wrapped in another element that does not expose hui-map-card), none of the modes have any effect.

Examples ​

Using fit map mode with auto-entities ​

When using a map card with custom:auto-entities the way auto-entities hides the map card will mean it does not fit on load. Fit map mode can be used in this case to make sure the map fits on first load.

No include filters have been used for brevity of the example.

yaml
type: custom:auto-entities
entities:
  - zone.london
filter:
  include: []
  exclude: []
card:
  type: custom:uix-forge
  forge:
    mold: card
    sparks:
      - type: map
        fit_map: true
  element:
    type: map
    fit_zones: true
    uix:
      style: |
        :host {
          display: block;
          height: 400px;
        }

Without fit_map: true:

Forged map without map spark fit_map true

With fit_map: true:

Forged map with map spark fit_map true

Tour mode with default settings ​

Automatically cycle through all map entities using defaults (10 s per stop, pause/play button in bottom-right corner):

yaml
type: custom:uix-forge
forge:
  mold: card
  sparks:
    - type: map
      tour: true
element:
  type: map
  entities:
    - device_tracker.my_phone
    - device_tracker.my_tablet

:material-movie: Map spark tour mode example animation (mp4)

Tour mode with custom POI list ​

Fly between fixed coordinates and specific entities with individual zoom levels:

yaml
type: custom:uix-forge
forge:
  mold: card
  sparks:
    - type: map
      tour:
        period: 15s
        zoom: 13
        icon_pause: mdi:pause-circle
        icon_play: mdi:play-circle
        icon_position:
          bottom: 16px
          left: 16px
        poi:
          - latitude: 51.614387
            longitude: -0.731585
            zoom: 11
          - entity: device_tracker.my_tablet
            zoom: 14
element:
  type: map
  entities:
    - device_tracker.my_phone
    - device_tracker.my_tablet

:material-movie: Map spark tour mode with pois example animation (mp4)

Styling the tour button ​

Override the default pill shape with rounded corners and a dark background:

yaml
type: custom:uix-forge
forge:
  mold: card
  sparks:
    - type: map
      tour: true
element:
  type: map
  entities:
    - device_tracker.phone
  uix:
    style: |
      ha-card {
        --uix-map-tour-icon-color: white;
        --uix-map-tour-icon-background: rgba(255,0,0,0.5);
        --uix-map-tour-icon-border-radius: 4px;
      }

Map spark styling example

Hours to show history slider ​

Enable a customizable history duration slider to load between 1 and 48 hours of tracker data on the map:

yaml
type: custom:uix-forge
forge:
  mold: card
  sparks:
    - type: map
      hours_to_show:
        min: 1
        max: 48
        step: 2
        position:
          bottom: 15px
          left: 15px
element:
  type: map
  hours_to_show: 3
  default_zoom: 8
  entities:
    - device_tracker.phone

Map spark hours to show example

Entity selection filter dropdown ​

Enable an interactive dropdown to toggle entity tracks visibility in real-time:

yaml
type: custom:uix-forge
forge:
  mold: card
  sparks:
    - type: map
      entity_filter: true
element:
  type: map
  entities:
    - device_tracker.phone
    - device_tracker.tablet

Map spark entity filter example

Customise the trigger button text, size, color and icon styling:

yaml
type: custom:uix-forge
forge:
  mold: card
  sparks:
    - type: map
      entity_filter:
        label: "Trackers"
        icon: "mdi:account-multiple"
        size: "m"
        variant: "brand"
        appearance: "filled"
element:
  type: map
  entities:
    - device_tracker.phone
    - device_tracker.tablet

Map spark entity filter with style example

Display entity filter grouped by domain with custom labels

yaml
type: custom:uix-forge
forge:
  mold: card
  sparks:
    - type: map
      entity_filter:
        group:
          persons: Household
          trackers: Phones
          zones: Places
element:
  type: map
  entities:
    - zone.london
    - device_tracker.phone
    - device_tracker.tablet

Map spark entity filter with groups example