هذه الصفحة غير مترجمة بعد، وهي معروضة بالإنجليزية.

With multiple, the Autocomplete keeps several values: value is an array of ids, each selected option shows as a tag in the trigger, and the popup stays open as you pick, so you can choose several in a row.

Selected: accessibility, forms

Open the picker and press Backspace with the search box empty: the last tag goes. Clicking a selected option again removes it too.

Value and onChange

multiple changes the type of the selection props, so neither mode can be given the other’s shape. In single mode, value is an id or null and onChange receives (id, option). In multiple mode, value is an array of ids and onChange receives (ids, options), the options in the same order as the ids. An option is undefined only for an id no option has been seen for; selected supplies those.

Tags

  • maxTags sets how many tags show (2 by default); the rest collapse into a count read from the more label, “+2”. The demo shows three.
  • Each tag has a remove button named by the remove label, “Remove Forms”. The Tag slot replaces the whole tag.
  • The clear button removes every value at once.

Picking and removing from the keyboard

  • Enter on a highlighted option adds it, or removes it if it is already selected. The popup stays open; set closeOnSelect to close it after each pick.
  • Backspace in the empty search box removes the last tag. With text in the search box it deletes text as usual.
  • The listbox has aria-multiselectable="true", and each option’s aria-selected follows the selection.

Disabled options

optionDisabled marks options that stay visible but cannot be picked, like the archived topic in the demo. They get aria-disabled="true", the arrow keys skip them, and a click does nothing.