05 — Component System
Composition Rules
Composition rules govern how components may be combined. They declare constraints on where a component may appear, what it may contain, and what structural relationships between components are invalid. Composition rule violations are Transform errors — they are caught at build time, not at runtime. Rules are declared in the component specification, not inferred from structure or naming convention.
Rule Types
| Rule Type | Declaration | Example |
|---|---|---|
| placement | Declares which parent components a component may appear within. | TableCell may only appear within TableRow. |
| exclusion | Declares which component types may not appear within this component. | Modal may not contain another Modal. |
| requirement | Declares which child components are required. | Select must contain at least one Option. |
| ordering | Declares the required ordering of child component types. | ListItem must precede any nested List. |
Composition Rule Inheritance
Composition rules are not inherited between components. A rule declared on a parent component does not automatically apply to components placed in its slots. Each component's composition rules govern only the component itself — the components it may contain and the contexts it may appear in. This prevents implicit constraint propagation and keeps the composition rule set locally auditable.
Rule Violations at Runtime
Composition rules are enforced at compile time. IDL does not define runtime composition rule enforcement — platform implementations may choose to add runtime warnings as a development affordance, but this is outside the specification. A composition that passes compilation is conformant; platform-level runtime behavior for non-conformant compositions is undefined.