PopupContentItemSchema
constPopupContentItemSchema:z.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; }>
Defined in: packages/core/src/schemas/layer.schema.ts:230
Content item for popup or dynamic text rendering.
Remarks
Section titled “Remarks”Supports static strings, dynamic property interpolation, and fallback values.
Properties:
str- Static text stringproperty- Feature property name to interpolateelse- Fallback value if property is missingformat- How a numericpropertyis written, with MapLibre’snumber-formatoptions:locale,currency,unit,min-fraction-digits,max-fraction-digits(formatted withIntl.NumberFormat, in the page’s language unlesslocaleis given). The older d3-style string (",.0f") still works.href- Link URL: absolute (https:,http:,mailto:,tel:) or a relative path (/about,./notes.html,#top). Other schemes, such asjavascript:, render as plain text.text- Link text (falls back tostr, then to the URL itself)target- Where the link opens:_blank(default, withrel="noopener noreferrer"),_self,_parentor_topsrc- Image source URLalt- Image alt text
Examples
Section titled “Examples”Static Text
- str: "Population: "Dynamic Property
- property: name else: "Unknown"Formatted Number
- property: population format: { max-fraction-digits: 0 }- property: price format: { currency: EUR, locale: de-DE }Link (`str` or `text` is the link text)
- str: "Wikipedia" href: "https://en.wikipedia.org/wiki/Chicago" target: _self