Entity Select
Usage
Entity Select is a repository-backed select that loads its options from an Admin SDK entity repository. Use it when options should come from a repository and you want built-in search and pagination for the results, or when an existing modelValue should be hydrated to a visible selected label.
import { MtEntitySelect } from "@shopware-ag/meteor-component-library";
Examples
With initial value
Multi-selection
Disabled
API reference
Props
| Prop | Type | Default |
|---|---|---|
entity * | keyof EntitySchema.Entities | |
repository | (<EntityName extends keyof EntitySchema.Entities>(entityName: EntityName) => { search: (criteria: default, context?: ApiContext | undefined) => Promise<default<EntityName> | null>; get: (id: string, context?: ApiContext | undefined, criteria?: default | undefined) => Promise<Entity<EntityName> | null>; save: (entity: Entity<EntityName>, context?: ApiContext | undefined) => Promise<void | null>; clone: (entityId: string, contextOrBehavior?: any, behaviorOrContext?: any) => Promise<unknown>; hasChanges: (entity: Entity<EntityName>) => Promise<boolean | null>; saveAll: (entities: default<EntityName>, context?: ApiContext | undefined) => Promise<unknown>; delete: (entityId: string, context?: ApiContext | undefined) => Promise<void | null>; create: (context?: ApiContext | undefined, entityId?: string | undefined) => Promise<Entity<EntityName> | null>; }) | undefined | undefined |
model-value | any | null |
label-property | string | string[] | "name" |
value-property | string | "id" |
disabled | boolean | false |
enable-multi-selection | boolean | false |
Events
| Event | Payload |
|---|---|
update:modelValue | [value: any] |
Best practices
Do
- Pass
entityfor the default repository lookup. - Use
repositoryonly when you need custom fetching behavior. - Keep
labelPropertyandvaluePropertyaligned with the entity shape you want to show and store.
Don't
- Do not use it when options are already available locally.
- Do not duplicate search or pagination in the parent component.
- Do not assume
modelValuestores the whole entity by default.
Behavior
- The first page loads on mount.
- Search is handled through repository term lookups.
modelValuestores the selectedvalueProperty, which defaults toid.
Accessibility
- Use a clear visible field label so users understand what entity they are selecting.
- Keep result labels distinct so search results stay easy to understand.
Related components
- Select: when options come from local or externally managed lists.