attributes
Declares, coerces, and validates host HTML attributes into reactive component state.
TypeScript Signature
export const attributes: Record<string, { type: stringconstructor | numberconstructor booleanconstructor; default?: any; required?: boolean; reflect?: transform?: (val: any)> any;
validate?: (val: any) => boolean | string;
}>
</string,>
The 6-Step Execution Pipeline
Deterministic transformation sequence executed upon every attribute mount or host mutation.
01
Required Check
Validates presence.
02
Coerce
Casts raw string to primitive.
03
Transform
Executes custom transform callback.
04
Values Check
Inspects permissible enumerations.
05
Validate
Evaluates user validation predicate.
06
State Application
Injects reactive signal into host.
CORALITE-E102: Mutex Violation
required: true cannot be combined with a default assignment.
Allowed Types
| Type | Coercion Behavior | Reflection Behavior |
|---|---|---|
| String | Casts to string. | No (unless reflect: true). |
| Number | Parses float. | No (unless reflect: true). |
| Boolean | Presence is true. | Yes. Renders as attr="". |
Forbidden vs. Required
attributes: {
user: { type: Object }
}
attributes: {
userId: { type: String }
}