createElement vnode, the wrong component, or a plain value — Solar throws a ContractError with a structured message that names the required component. This means composition mistakes surface immediately at call time, not silently at render time.
Defining a slot prop
Usetype: 'slot' in your prop schema to declare that a prop expects a rendered component vnode. Add accepts to restrict the slot to the output of a specific named component.
The Card component below declares an action slot that only accepts a vnode produced by Button:
render, you use the slot value directly as a child. Because Solar has already validated it at the call boundary, you know it is a legitimate vnode from the expected component — no additional checks needed.
Using a slot
To fill a slot, call the required component and pass its return value as the slot prop. The vnode it returns carries an internal_source tag that Solar checks against accepts.
createElement vnode has no _source property. The ContractError it produces will tell you exactly which component to use instead.
How slot validation works
WhendefineComponent wraps your render function, it stamps every vnode the component returns with a _source property set to the component’s name:
validateProps then checks two things in order:
- Is the value an object (and not an array)? If not, it throws — a string or number cannot be a vnode.
- If
acceptsis set, doesvalue._sourceequalaccepts? If not, it throws, reporting whether the vnode has no_sourceat all (plaincreateElement) or the wrong_source(a different component).
Untyped slots
If you omitaccepts, Solar accepts any rendered component vnode for that slot. The vnode still must be an object (not a plain value), but it can come from any registered or unregistered component.
accepts) whenever your component has a real contract about what goes in that position.
When a slot validation fails, the
ContractError’s fix field names the exact component you need to pass. For example: "Pass a vnode produced by the Button component". This field is intentionally formatted as a complete instruction so that an AI agent can read it and correct the call without parsing the error message string.