Skip to content

Open a widget popup

Keep the tile small and put extra controls in a popup or side panel.

Define the popup in the template

Place a popup block beside the tile markup. It has the same device, settings and style as the tile. Only the chosen block is drawn in the popup.

<button data-hd-on-click="openPopup('details')">More controls</button><hd-popup id="details">  <hd-slider bind="{{ cap.dim }}" label="Brightness"></hd-slider>  <button data-hd-on-click="closePopup()">Done</button></hd-popup>

Share state with the tile

State is shared: setState in the popup updates the tile too. The popup context value holds its id inside the popup and is empty on the tile. An id starts with a letter and contains up to 40 letters, digits, hyphens or underscores. Popups cannot be nested.

Open a side panel

Use 'side' for a side panel, which opens from the bottom on a phone. Without an id, openPopup opens the block named main. The close button, a tap outside or Escape closes the popup.

openPopup('details', 'side')

Open from JavaScript

The script opens the same template block. The script frame does not run inside the popup; use template controls and HdScript there.

button.addEventListener('click', () => {  tiledash.openPopup('details');});

Choose the right kind of popup

openPopup shows your own template block. openDevice shows built-in device controls; openHistory shows recorded readings; openDashboard opens another dashboard. A widget popup works on dashboards, wall panels and share links. In the editor it is shown in place.