Skip to content

[combobox] Native way to prevent clearing of input after selection #3977

Closed

Description

@sarthakmalik0810

Feature request

Summary

I think the Combobox should have a native way to prevent resetting of inputValue after selection of an item.

The prop could be called - clearInputAfterSelection.

Maybe another prop called - closePopupAfterSelection to prevent closing the popup when the input is not in popup.

Motivation

This would be useful in lists where you want to select multiple options with the similar search query, but I have seen this in other comboboxes as well. Example from Github label selector.

Screen.Recording.2026-02-05.at.1.05.16.PM.mov

This is how I would do it right now, but I feel this would be fragile, and may cause issues as the library evolves -

    <Combobox.Root
      items={fruits}
      inputValue={controlledInputValue}
      onInputValueChange={(inputValue, eventDetails) => {
        if (eventDetails.reason === 'input-change') {
          setControlledInputValue(inputValue);
        }
      }}
      multiple
    />

Activity

  1. added
    type: new featureExpand the scope of the product to solve a new problem.
    component: comboboxChanges related to the combobox component.
    and removed on Feb 5, 2026
  2. mj12albert commented on Feb 9, 2026

    @mj12albert
    Member

    This would be useful in lists where you want to select multiple options with the similar search query

    @sarthakmalik0810 This seems quite similar to #3181

    Is this what you're trying to achieve? https://stackblitz.com/edit/bcocshwo-kkp2dff4?file=src%2FApp.tsx

    <Combobox.Root
      items={langs}
      multiple
      onOpenChange={(nextOpen, eventDetails) => {
        if (!nextOpen && eventDetails.reason === 'item-press') {
          eventDetails.cancel();
        }
      }}
    />
  3. sarthakmalik0810 commented on Feb 9, 2026

    @sarthakmalik0810
    ContributorAuthor

    @mj12albert That works for when you have popups, but the query will still be reset for inline comboboxes. Therefore I think we should have a native way to do this (for both inline and non-inline comboboxes). Not resetting the query after selection is a valid use case for quite a few comboboxes. These custom checks would be difficult to maintain as the component internal reasons, etc can change through various minor versions of the library.

  4. github-actions commented on Aug 12, 2026

    @github-actions

    This feature will be available in the next npm release of Base UI.

    In the meantime, use the canary build from PR #5362:

    npm i https://pkg.pr.new/@base-ui/react@ec51aaf

    This installs a complete package for @base-ui/react with the feature included. It is hosted by pkg.pr.new rather than npm, and the URL is available for up to six months.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: comboboxChanges related to the combobox component.type: new featureExpand the scope of the product to solve a new problem.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions