s-m-r-t
Open the s-m-r-t source on GitHub Switch to dark color scheme
← All UI components

Commerce · Components

VendorSelect

Searchable vendor picker for a relation field. Presentation only: the caller owns `search` and `resolve` (returning the vendor DTO, whose `profile.name` is the label) and the "New vendor" action. Registered as the selector for `@happyvertical/smrt-commerce:Vendor`.

Public export

typescript
import { VendorSelect } from '@happyvertical/smrt-commerce/svelte';
Import path
@happyvertical/smrt-commerce/svelte
Props
15
Props described
15 of 15
Bindable state
0
Callback events
2
Verified release
0.57.40

Props

NameTypeRequiredDescription
namestringYesField name; the selected vendor id posts under it.
valuestringNoSelected vendor id (bindable). Empty string means no selection.
labelstringNoVisible label. Defaults to the localized "Vendor".
requiredbooleanNoRequired field: hides the clear button.
disabledbooleanNoDisabled state.
errorstringNoValidation error shown below the field.
placeholderstringNoPlaceholder shown while nothing is selected.
descriptionstringNoHint announced with the field.
search(query: string) => Promise<VendorDisplayData[]>YesCaller-owned lookup; called with '' when the list opens.
resolve(id: string) => Promise<VendorDisplayData | null>NoCaller-owned lookup of the current value when it has not been listed yet.
onCreate(query: string) => void | VendorDisplayData | Promise<void | VendorDisplayData>No"New vendor" action, offered only when supplied. Receives the text most recently searched for; a returned vendor is selected.
createLabelstringNoText for the "New vendor" button.
debounceMsnumberNoMilliseconds to wait after typing before searching.
interactionControlInteractionOptions | falseNoCombobox interaction options for agents, or false to opt out.
onchange(id: string) => voidNoCalled when the selected id changes ('' when cleared).

Bindable state

This component has no bindable public state.

Callback events

  • onCreate(query: string) => void | VendorDisplayData | Promise<void | VendorDisplayData>
  • onchange(id: string) => void

Examples and explanation