With creatable, a search in the Autocomplete that matches nothing offers a create row instead of “No results”. Picking it calls your onCreate with the typed text; you add the new option to options and select it.

Nothing selected.

Type a topic that is not in the list, such as “Zebra”, then press Enter or click the create row.

When the row shows

The create row is offered only once the search has settled on nothing: the search box has text, no option matches, and nothing is loading, failed or held back by minChars. While results may still arrive, it waits, so a record that was about to appear is not created twice.

Enter with no option highlighted creates, like a click on the row. The row’s text is the create label, “Create “Zebra””.

onCreate

onCreate receives the trimmed search text. The autocomplete does not add anything itself: you create the record, add it to options and set the value, as the demo does. A selected value stays labelled while the search changes.

When creating takes a request, pass createLoading while it runs: the row is disabled and shows the creating label. The Create slot replaces the row.