Skip to content

PopupContentSchema

const PopupContentSchema: ZodArray<ZodRecord<ZodString, ZodArray<ZodType<{[key: string]: unknown; alt?: string; else?: string; format?: string | PopupNumberFormat; href?: string; property?: string; src?: string; str?: string | { $html: string; }; target?: string; text?: string; }, ZodTypeDef, {[key: string]: unknown; alt?: string; else?: string; format?: string | PopupNumberFormat; href?: string; property?: string; src?: string; str?: string | { $html: string; }; target?: string; text?: string; }>, "many">>, "many">

Defined in: packages/core/src/schemas/layer.schema.ts:311

Popup content structure.

Array of HTML elements where each element is { tagName: [items] }. Elements are rendered in order to build popup HTML.

Supported Tags: h1, h2, h3, h4, h5, h6, p, span, div, strong, em, code, pre, a, img, ul, ol, li, blockquote, hr, br

A link or image item is usually placed in p:/div:. Under a: or img: it is emitted as-is (one element, not one wrapped in an empty tag).

popup:
- h3:
- property: name
else: "Unknown"
- p:
- str: "Population: "
- property: population
format: ",.0f"
- p:
- str: "Learn more"
href: "https://example.com"

Output for { name: "NYC", population: 8336817 }:

<h3>NYC</h3>
<p>Population: 8,336,817</p>
<p><a href="https://example.com" target="_blank" rel="noopener noreferrer">Learn more</a></p>