Skip to content

feat(selector): add dropdown-internals theme targets for Selector & MultiSelector - #4596

Closed
freddymeta wants to merge 1 commit into
mainfrom
feat/selector-theme-targets
Closed

feat(selector): add dropdown-internals theme targets for Selector & MultiSelector#4596
freddymeta wants to merge 1 commit into
mainfrom
feat/selector-theme-targets

Conversation

@freddymeta

@freddymeta freddymeta commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

What

Expose stable theme targets for the searchable-dropdown internals of Selector and MultiSelector, so consumers can restyle them via defineTheme instead of fragile structural CSS.

New targets (on existing elements — purely additive themeProps, default appearance unchanged):

Selector MultiSelector Element
selector-dropdown multi-selector-dropdown dropdown popover content wrapper
selector-search multi-selector-search search field wrapper
selector-search-input multi-selector-search-input search <input>
selector-empty multi-selector-empty "No results found" state
selector-section-header multi-selector-section-header grouped-option section titles

Each target is registered in the component's .doc.mjs theming.targets and covered by tests (the themingTargets suite validates every rendered target is documented).

Why

Restyling dropdown internals previously required brittle descendant CSS that broke whenever the DOM structure shifted. These stable, named targets make dropdown theming first-class.

Notes

This PR is the theming half of a split, per review feedback that the low-risk, purely-additive theme targets should land on their own (easier to review, avoids collision with in-flight theming PRs). The search-affordances half (a built-in search magnifier + clear button in the dropdown search field) is a separate PR that composes with these targets — it adds its own *-search-icon / *-search-clear-icon targets and does not touch the targets here.

Testing

  • Selector + MultiSelector suites and the themingTargets suite pass.
  • typecheck, typecheck:docs, storybook typecheck, docsite generate + test, sync-exports --check, check-sync, check-changesets, generate-token-docs --check, and eslint on the changed files all pass locally.

@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview Aug 1, 2026 2:27pm

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 31, 2026
@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge needs:design-review Affects visuals — Design should review labels Jul 31, 2026
@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

Modified Components

MultiSelector (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1355 -
Complexity N/A Very High (151) -
Selector (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1337 -
Complexity N/A Very High (112) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.9KB 1.3KB

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two asks before this lands:

1. Split out the theming. The dropdown-internals theme targets (selector-dropdown / -search / -search-input / -empty / -section-header and the multi-selector equivalents) are purely additive and low-risk — let's land those as their own PR. It's much easier to review/merge and stays out of the way of the other Selector-family theme-target PRs in flight (#4626, #4628).

2. Search icon + clear button should be built in, not opt-in props. Rather than adding hasSearchClear, let's make the dropdown search field just have the clear (×) button and a search magnifier as part of the component — a searchable dropdown wanting a clear affordance and a search glyph is the expected default, not something each consumer opts into. That keeps the API surface smaller and behavior consistent everywhere instead of gating standard search-field affordances behind a flag (same reasoning we've been applying elsewhere — prefer built-in correct behavior over an options knob).

So: theme targets → their own PR; the search-field clear button + icon → built into the component directly (no hasSearchClear prop).

github-actions Bot added a commit that referenced this pull request Aug 1, 2026
@freddymeta
freddymeta force-pushed the feat/selector-theme-targets branch from 60cbc17 to 911583a Compare August 1, 2026 13:49
@github-actions
github-actions Bot requested a review from cixzhang August 1, 2026 13:49
…ultiSelector

Expose stable theme targets for the searchable dropdown internals so
consumers can restyle them via defineTheme instead of fragile structural
CSS. New targets on both components: the dropdown popover content wrapper,
the search wrapper and its input, the empty state, and grouped-option
section headers.

Purely additive themeProps on existing elements; default appearance is
unchanged.
@freddymeta
freddymeta force-pushed the feat/selector-theme-targets branch from 911583a to dd718a0 Compare August 1, 2026 14:24
github-actions Bot added a commit that referenced this pull request Aug 1, 2026
@freddymeta

Copy link
Copy Markdown
Contributor Author

Closing in favor of #4636, which reworks the dropdown search field into a TextInput. That makes the search field themeable through the standard text-input target (plus the composed Icon targets for the magnifier/clear), so the selector-search / selector-search-input targets here would attach to elements that no longer exist and would conflict with that refactor.

The non-search targets proposed here (selector-dropdown / -empty / -section-header and the multi-selector equivalents) don't conflict and are still worth having — happy to re-raise them as a focused follow-up on top of #4636.

@freddymeta freddymeta closed this Aug 3, 2026
@github-actions
github-actions Bot deleted the feat/selector-theme-targets branch August 3, 2026 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants