Skip to content

@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:119

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 ParameterDefault type
T extends ComponentComponent

Properties ​

PropertyTypeDescriptionDefined in
type"component"-types.ts:120
componentKind?ComponentKindOptional component-kind constraint. When provided, the inspector skips the dropdown and resolves directly to this kind.types.ts:123
value| { entityId: EntityId; componentKind: ComponentKind; } | null-types.ts:124