Skip to content
LoidoltTheme 0.11.1
Svelte 5

Component

MultiSelect

A searchable multiple choice whose picks show as removable chips.

import { MultiSelect } from '@loidolt/theme-svelte';

Example

  • Cut lines

Choose up to three.

Notes

  • The search clears after each pick so the next one can be typed straight away.
  • Backspace in the empty search removes the last chip. Removing a chip with its button moves focus to the next chip, or back to the input.
  • Once max is reached the remaining options disable, and screen readers are told why.
  • Chips are square because they are pressable; the pill shape is reserved for badges.

Props

Generated from the component source, so it cannot drift from the implementation.

MultiSelect props
PropTypeDefaultNotes
options required OptionEntry<T>[]—Options, optionally in labelled groups.
boxed booleanfalseDraws the full box instead of the default underline.
class string—Lands on the wrapper; the rest props land on the text input.
contentClass string—
disabled booleanfalse
emptyText string'No results'
filter ((option: Option<T>, query: string) => boolean) | false—How typing narrows the list. false when onQueryChange filters on a server.
item Snippet<[Option<T>, { selected: boolean; highlighted: boolean }]>—
label string—Accessible name when the control is not wrapped in a Field or <label>.
loading booleanfalse
loadingText string'Loading…'
max number—Most values that can be chosen. Remaining options disable once it is reached.
maxText (max: number) => string(limit) => `Up to ${limit} can be chosen`
name string—Submits each selected value under this name.
onOpenChange (open: boolean) => void—
onQueryChange (query: string) => void—
onValueChange (value: T[]) => void—
open bindablebooleanfalse
query bindablestring''
queryDebounce number0
ref bindableHTMLElement | nullnull
removeLabel (label: string) => string(text) => `Remove ${text}`Accessible name of each chip's remove button.
required booleanfalse
resultsText (count: number, selected: number) => string(count, selected) => `${count} ${count === 1 ? 'result' : 'results'}, ${selected} selected`
triggerLabel string'Show options'
value bindableT[][]The selected values, in the order they were chosen.

Plus the attributes of Omit< ComboboxInputProps, 'value' | 'child' | 'children' | 'defaultValue' | 'clearOnDeselect' | 'oninput' | 'ref' >, forwarded to the root element.