Skip to content

Popup — Target

The popup renders into a specified DOM node instead of floating over the map. Useful for mobile interfaces — information appears in a fixed panel, not on top of the diagram.

Click a room to see the info appear in the panel on the right.

Click a room

Usage

ts
new Svgic('#container', {
  popup: {
    placement: 'target',
    target: '#info-panel',  // CSS selector or HTMLElement
    trigger: 'click',       // recommended for mobile
    render(item) {
      const el = document.createElement('div')
      // build your panel content
      return el
    },
  },
})

target accepts a CSS selector string or an HTMLElement directly.

Options

OptionTypeDefaultDescription
placement'target'Render into a DOM node
targetstring | HTMLElementTarget element (required)
trigger'hover' | 'click''hover'Open on hover or click
render(item) => HTMLElement | stringCustom popup content
templatestring | HTMLTemplateElementHTML template (alternative to render)
bind(el, item) => voidBind data into template