Combobox

Pick one from a long list by typing. Suggestions open when the field is focused and narrow as you type.

Example

Click in the field, then type a name or part of an MMSI. The X clears it.

<Field label="Vessel">
	<Combobox
		bind:value={vessel}
		placeholder="Search vessels"
		clearable
		options={vessels.map((v) => ({
			value: v.id,
			label: v.name,
			description: `MMSI ${v.mmsi}`,
			keywords: [v.mmsi],
		}))}
	/>
</Field>

Groups

Rules

  • For lists people search in: vessels, waypoints, organisations. Ten options or fewer that are read rather than searched: a Select.
  • The placeholder says what to type: "Search vessels".
  • Add keywords for what people type besides the name, like an MMSI or an org number. A description shows the one that tells two similar options apart.
  • Group when the list has a natural split, like waypoints by project.
  • Clearable when empty is a real answer, like a filter or an optional field. Not for required choices.