Wocart

@wocart/theme v4.1.0


@wocart/theme / index / SlotDefinition

Interface: SlotDefinition

One composition point a component declares ("default" = children).

Renderer ceiling (V1): the reference renderer (@wocart/theme/astro) fills at most one named slot per instance. The Astro compiler lifts the first slot-attribute expression of a dynamic child expression into the slots-object key, evaluated at component scope, so per-item slot names inside a .map() are not expressible. Any further named slot with content is reported as multiple-slots-unsupported — never silently dropped.

Declaring several named slots is legal; it is a capability declaration, not a promise that all of them can be filled at once. A component that needs more than one filled can transfer Astro's own slots inside itself (<slot name="x" slot="x" />) — a component-level decision, deliberately not part of this contract.

Properties

allow?

optional allow?: readonly string[]

The component types this slot accepts (catalog keys). Absent = any type. Assembly rejects a type that is not in the catalog; the reader drops a child of any other type with a disallowed-child issue. Narrowing a list after documents are saved hides their children, so treat it like removing a slot.


max?

optional max?: number

At most this many instances (1–50). Absent: the platform's cap (THEME_LIMITS.slotInstances).


multiple?

optional multiple?: boolean

False = at most one child instance. Defaults to true.


name

name: string

"default" or a lowercase kebab-case name.


required?

optional required?: readonly RequiredBlock[]

Types that must be present: an editor cannot remove, hide or move out the last min of them, nor insert past max, and a document that lacks them renders them anyway (completePage). Each type must be one allow takes.