mui / mui/base-ui

[combobox] Predicate function for `autoHighlight`

Open
#5,205 0 comments 0 reactions 0 assignees View on GitHub
component: combobox type: new feature
Dominant language
TypeScript
Stars
10.9k
Forks
543
Avg merge
1d 20h
Merged PRs (30d)
101

Description

# Feature request

Would like to have a way to decide on the fly whether the first filtered item should be highlighted.

Currently we accomplish this via a bun patched version of the Combobox where `autoHighlight` accepts a function like `(item) => boolean`

https://github.com/user-attachments/assets/bd9adb3e-1e59-4242-bafa-f271588c855b

In Paper this is so that if you are typing in a value into the input, we highlight theme tokens only for exact matches, otherwise the value is treated like normal text.

For the user it means that if they type "1" and press Enter they wouldn't get a token for "12", but if they type in "12" and a matching token exists, that one is selected on Enter.

Contributor guide

Open the contributing guide

Research direction

Start at the Combobox implementation and trace how the existing autoHighlight option is read when filtering and committing a selection. Check the current Combobox tests if available, then verify that exact-match input highlights the intended item while non-exact input does not automatically select a different filtered item.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.