Skip to content

feat(Select): add onSearchChange and show options added during a search - #1345

Draft
EvandroLG wants to merge 1 commit into
mainfrom
feat/select-on-search-change
Draft

EvandroLG wants to merge 1 commit into
mainfrom
feat/select-on-search-change

Conversation

@EvandroLG

Copy link
Copy Markdown
Collaborator

Description

Select can't load its options from a backend while the user types: the search text stays inside the component, and options that arrive during a search never match. This PR fixes both.

  • New onSearchChange?: (search: string) => void prop on Select, MultiSelect and CheckboxMultiSelect. It's called whenever the search text changes, including when it's cleared or reset on close.
  • Options added during a search now show up when they match. The searchable text used to be captured only when a search started. It's now also recaptured when the options change while a search is active, in a layout effect, so there's no flicker.
  • New SearchWithRemoteOptions story: typing "berry" loads matching fruits after a short delay.

Links and tickets

Use case: picking one of thousands of message-queue topics, where only the first part of the list is loaded up front and the rest comes from a backend search.

Good to know

  • What I tested: unit tests (a regression test for options added during a search, which fails on main, and onSearchChange on typing, clearing, closing and no change), plus the full pre-PR suite (typecheck, lint, format, circular-dependency:check, test, build, storybook:build).
  • Not tested yet: visual tests (yarn test:visual, needs Docker), the Storybook Accessibility panel, and trying the new story by hand.
  • Out of scope: virtualizing long lists. Every option is still rendered.

Checklist

  • Breaking changes? (add migration notes in changesets)
  • Visual changes? (specify in changesets)
  • Design review needed?

Contribution

  • Sufficient research before PR
  • Self-reviewed the PR
  • Manually tested the changes (when applies - visual confirmation in Storybook)

🤖 Generated with Claude Code

`onSearchChange` reports the search text as it changes, so consumers can
load options from a backend while the user types. Options added during a
search now match right away: the searchable text is recaptured when the
options change while a search is active, not only when a search starts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@EvandroLG EvandroLG self-assigned this Dec 2, 2026
@changeset-bot

changeset-bot Bot commented Dec 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 61ea59c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clickhouse/click-ui Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@workflow-authentication-public

Copy link
Copy Markdown
Contributor

Storybook Preview Deployed

✅ Preview URL: https://click-mya2i9rku-clickhouse.vercel.app

Built from commit: 646ec369e2eaa6211013599037e7e1dd9f7b264c

@workflow-authentication-public

Copy link
Copy Markdown
Contributor

Chromatic Storybook

Check Status Link
Storybook ✅ 673 stories published Open Storybook
UI Tests ⏳ 1 change must be accepted as baseline Open build

Built from commit: 61ea59c9771732b6149200d320f50ee5972db35c · Chromatic run

Statuses as of the end of the run. The build link shows the live review state.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant