Skip to content

anyOf

What this slot permits — the one list of its accepted content. Each entry is a component type name, or a reserved primitive marker ($text, $glyph); no entry kind is ever required. With nothing to list, omit the member — absence means any component and no primitive, and an empty list is invalid rather than a synonym for it.

Path

component-api:props.<SlotProp prop>.anyOf

Value

ComponentName[], at least 1 entry

Primitive content markers

anyOf is the one list of what a slot accepts. Alongside component names it carries reserved markers naming a primitive kind:

MarkerAdmits
$textA text primitive — a plain string fill
$glyphA glyph primitive — an icon fill
props:
children:
type: slot
defaultSlot: true
anyOf: [$glyph, $text, badge] # a glyph, a label, or a composed Badge
description:
type: slot
anyOf: [$text, link] # accepts a primitive, and is not the default slot

anyOf: [$text] is a text-only slot — no component permitted. anyOf: [badge] is Badge-only — no primitive permitted. Absent means any component and no primitive, which is what every slot without markers means today.

The names are the ones anatomy items already use, so type: text on an element and $text here are the same primitive. The $ prefix marks a value the contract reserves rather than one the library supplies — the same role it plays in $token, $binding and $slotContent, extended from keys to values. A component key can never shadow a marker, because the safe key grammar admits no leading $.

A marker is recorded when the slot’s default content in Figma held a top-level primitive of that kind, in at least one variant, and slotPrimitives is on — which it is unless the library turns it off. A marker only ever joins an anyOf that already names at least one component; a slot whose detected content is primitives alone carries no anyOf, because anyOf is a constraint and [$text] would say only a text primitive may fill the slot. Those primitives are not emitted as anatomy elements — the slot is — and their formatting travels on the slot element’s contentStyles, keyed by the same markers.

Markers and defaultSlot are orthogonal. A Button’s children accepts primitives and is the default slot; an Alert’s description accepts a primitive and is not the default; a layout component’s slots are default-eligible and take components only.

Decisions

  • ADR-056 — Rename SlotProp.minItems/maxItems to minChildren/maxChildren
  • ADR-102 — Slots That Accept Primitive Content — $text and $glyph in anyOf
  • ADR-105 — Type–Schema Parity for Overlapping Prop Unions

Source

FormatFile
JSON Schemapackages/schema/schema/component.schema.json
TypeScriptpackages/schema/types/Props.ts
Specification§4.2, §11