@relu-interactives/spatial-ecs
@relu-interactives/spatial-ecs / types / ComponentInput
Type Alias: ComponentInput<T>
ts
type ComponentInput<T> = {
type: "component";
componentKind?: ComponentKind;
value: | {
entityId: EntityId;
componentKind: ComponentKind;
}
| null;
};Defined in: types.ts:109
Inspector field that lets the user drag an entity and optionally pick a component from it.
The optional componentKind property narrows which component the inspector should auto-resolve or pre-filter to. When set, dropping an entity will immediately commit that component kind — skipping the dropdown entirely.
Example
ts
// Unconstrained — shows a component-kind dropdown after entity drop
anyRef: { type: "component", value: null } as ComponentInput
// Constrained — auto-resolves to "Transform", no dropdown
transform: { type: "component", componentKind: "Transform", value: null } as ComponentInput<Transform>Type Parameters
| Type Parameter | Default type |
|---|---|
T extends Component | Component |
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
type | "component" | - | types.ts:110 |
componentKind? | ComponentKind | Optional component-kind constraint. When provided, the inspector skips the dropdown and resolves directly to this kind. | types.ts:113 |
value | | { entityId: EntityId; componentKind: ComponentKind; } | null | - | types.ts:114 |

