Skip to content

ContentElementSchema

const ContentElementSchema: ZodObject<{ alt: ZodOptional<ZodString>; classList: ZodOptional<ZodUnion<[ZodString, ZodArray<ZodString, "many">]>>; else: ZodOptional<ZodString>; height: ZodOptional<ZodUnion<[ZodString, ZodNumber]>>; href: ZodOptional<ZodString>; id: ZodOptional<ZodString>; property: ZodOptional<ZodString>; src: ZodOptional<ZodString>; str: ZodOptional<ZodString>; style: ZodOptional<ZodString>; target: ZodOptional<ZodString>; width: ZodOptional<ZodUnion<[ZodString, ZodNumber]>>; }, "passthrough", ZodTypeAny, objectOutputType<{ alt: ZodOptional<ZodString>; classList: ZodOptional<ZodUnion<[ZodString, ZodArray<ZodString, "many">]>>; else: ZodOptional<ZodString>; height: ZodOptional<ZodUnion<[ZodString, ZodNumber]>>; href: ZodOptional<ZodString>; id: ZodOptional<ZodString>; property: ZodOptional<ZodString>; src: ZodOptional<ZodString>; str: ZodOptional<ZodString>; style: ZodOptional<ZodString>; target: ZodOptional<ZodString>; width: ZodOptional<ZodUnion<[ZodString, ZodNumber]>>; }, ZodTypeAny, "passthrough">, objectInputType<{ alt: ZodOptional<ZodString>; classList: ZodOptional<ZodUnion<[ZodString, ZodArray<ZodString, "many">]>>; else: ZodOptional<ZodString>; height: ZodOptional<ZodUnion<[ZodString, ZodNumber]>>; href: ZodOptional<ZodString>; id: ZodOptional<ZodString>; property: ZodOptional<ZodString>; src: ZodOptional<ZodString>; str: ZodOptional<ZodString>; style: ZodOptional<ZodString>; target: ZodOptional<ZodString>; width: ZodOptional<ZodUnion<[ZodString, ZodNumber]>>; }, ZodTypeAny, "passthrough">>

Defined in: packages/core/src/schemas/content.schema.ts:115

Content element with styling and dynamic properties.

Defines a single element within content. Supports both static and dynamic values via property interpolation.

Core Properties:

  • str - Static text string
  • property - Feature/context property name
  • else - Fallback value if property is missing

Styling:

  • classList - CSS class names (space-separated or array)
  • id - Element ID
  • style - Inline CSS styles

Links (a tag):

  • href - URL
  • target - Link target (_blank, _self, etc.)

Media (img, iframe):

  • src - Source URL
  • alt - Alternative text (img)
  • width - Width (pixels or %)
  • height - Height (pixels or %)

Static Text

- str: "Welcome to our site"

Dynamic Property

- property: "userName"
else: "Guest"

Styled Element

- str: "Important"
classList: "text-bold text-red"
style: "font-size: 18px;"

Link

- str: "Learn more"
href: "https://example.com"
target: "_blank"

Image

- src: "https://example.com/photo.jpg"
alt: "Photo description"
width: "100%"