Mixins / Inside-out composition

Why Slots beat className props

A plain className prop only injects CSS strings without saying what element it targets, which events exist, or which attributes are structural. A Slot contract specifies:

  • Capability: Whether the slot is a Container, Interactive control, Focusable item, or TextInput.
  • Published events and attributes: Which events (such as Event.Input) and ARIA attributes (such as Attr.AriaInvalid) attachments may rely on or supply.
  • Protected members: Structural roles or attributes (like role) that external attachments cannot overwrite.

When a Behavior declares requires: { capability: Capability.TextInput, attributes: [Attr.AriaInvalid] }, attaching it to an incompatible slot fails at definition time rather than silently breaking at runtime. Contracts also export serializable metadata for DevTools, tests, and documentation.