Skip to content

Use one item counter for Combobox, Menu, and Command #962

Description

@ravisuhag

Combobox, Menu, ContextMenu, and Command each need to know how many items match the search. They use the count to show the empty state and to announce "N results" for screen readers.

Base UI's own count (useFilteredItems) only works when the root gets an items prop. Our components also filter their own children, so they need their own count.

Today there are two ways to do this:

Both do the same job.

Proposal

After #953, #954, and #960 merge, move Combobox to shared/item-count and delete its own count. Keep one code path for the empty state and the status message in all four components.

Select's search mode (#958) only shows Select.Empty when items is given. It could use the same helper to work without items too.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions