Skip to content

feat(core): add XDSPopover, XDSTypeahead, and XDSTokenizer - #286

Closed
cixzhang wants to merge 2 commits into
mainfrom
navi/feat/popover-typeahead-tokenizer
Closed

cixzhang wants to merge 2 commits into
mainfrom
navi/feat/popover-typeahead-tokenizer

Conversation

@cixzhang

Copy link
Copy Markdown
Contributor

Summary

Three new components for overlay, search, and multi-select patterns.

XDSPopover

Click/hover-triggered popover using the Popover API + CSS Anchor Positioning. Supports controlled/uncontrolled mode, placement, alignment, focus trapping, and custom widths. Hover trigger delegates to XDSHoverCard.

XDSTypeahead

Single-select search dropdown. XDSBaseTypeahead provides the unstyled combobox engine (keyboard navigation, ARIA, search source interface). XDSTypeahead wraps it with XDSField for label, description, validation, and status. XDSTypeaheadItem renders dropdown items with optional icon/secondary text.

XDSTokenizer

Multi-select typeahead with XDSToken chips. Supports maxEntries, clear all, backspace-to-remove, and change metadata (add/remove/reorder) in the onChange callback.

What's Included

  • 37 tests across all three components (9 + 13 + 15)
  • Storybook stories for each component
  • READMEs for Typeahead and Tokenizer modules
  • Barrel exports from @xds/core

Test Results

Test Files  59 passed (59)
Tests       944 passed (944)

Crafted with care by Navi

Three new components for overlay/search/multi-select patterns:

- XDSPopover: Click/hover-triggered popover using Popover API + CSS Anchor
  Positioning. Supports controlled/uncontrolled, placement, alignment, and
  focus trapping. Delegates hover trigger to XDSHoverCard.

- XDSTypeahead: Single-select search dropdown with XDSField integration.
  XDSBaseTypeahead provides the unstyled combobox engine (keyboard nav,
  ARIA, search source interface). XDSTypeaheadItem renders dropdown items.

- XDSTokenizer: Multi-select typeahead with XDSToken chips. Supports
  maxEntries, clear all, backspace-to-remove, and change metadata
  (add/remove/reorder) in the onChange callback.

Includes:
- 37 tests across all three components (9 + 13 + 15)
- Storybook stories for each component
- READMEs for Typeahead and Tokenizer modules
- Barrel exports from @xds/core

Co-authored-by: Navi <[email protected]>
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Feb 22, 2026
@github-actions

github-actions Bot commented Feb 22, 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.

New Components

Tokenizer · View in Storybook
Metric Value
Bundle Size (ESM) 531B
Bundle Size (CJS) 649B
Lines of Code 398
Source Files 2
Complexity Very High (44)
Exports XDSTokenizer
Props Count N/A
Has Tests Yes
Has Stories Yes
Typeahead · View in Storybook
Metric Value
Bundle Size (ESM) 619B
Bundle Size (CJS) 801B
Lines of Code 831
Source Files 5
Complexity Very High (103)
Exports XDSBaseTypeahead, XDSTypeahead, XDSTypeaheadItem
Props Count N/A
Has Tests Yes
Has Stories Yes

Modified Components

Layer
Metric Before After Delta
Bundle Size (ESM) N/A 491B N/A
Lines of Code N/A 1540 -
Complexity N/A Very High (162) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@xds/core 7.5KB 12.2KB 1.9KB

Accessibility Audit

Status: No accessibility violations detected.

Component Previews

Includes interactive hover previews as animated GIFs.

XDSTokenizer

Default

Screenshot:

Default

Interaction Preview: (view video)

Default interaction

View in Storybook · core-xdstokenizer--default

Pre-selected Items

Screenshot:

Pre-selected Items

View in Storybook · core-xdstokenizer--with-preselected

With Clear All Button

Screenshot:

With Clear All Button

View in Storybook · core-xdstokenizer--with-clear

Max 3 Entries

Screenshot:

Max 3 Entries

View in Storybook · core-xdstokenizer--max-entries

Required

Screenshot:

Required

View in Storybook · core-xdstokenizer--required

With Description

Screenshot:

With Description

View in Storybook · core-xdstokenizer--with-description

With Error

Screenshot:

With Error

View in Storybook · core-xdstokenizer--with-error

With Warning

Screenshot:

With Warning

View in Storybook · core-xdstokenizer--with-warning

With Success

Screenshot:

With Success

View in Storybook · core-xdstokenizer--with-success

Disabled

Screenshot:

Disabled

View in Storybook · core-xdstokenizer--disabled

XDSTypeahead

Default

Screenshot:

Default

Interaction Preview: (view video)

Default interaction

View in Storybook · core-xdstypeahead--default

With Bootstrap Results

Screenshot:

With Bootstrap Results

View in Storybook · core-xdstypeahead--with-bootstrap

Required

Screenshot:

Required

View in Storybook · core-xdstypeahead--required

Optional

Screenshot:

Optional

View in Storybook · core-xdstypeahead--optional

With Description

Screenshot:

With Description

View in Storybook · core-xdstypeahead--with-description

With Error

Screenshot:

With Error

View in Storybook · core-xdstypeahead--with-error

With Warning

Screenshot:

With Warning

View in Storybook · core-xdstypeahead--with-warning

With Success

Screenshot:

With Success

View in Storybook · core-xdstypeahead--with-success

Disabled

Screenshot:

Disabled

View in Storybook · core-xdstypeahead--disabled

Without Clear Button

Screenshot:

Without Clear Button

View in Storybook · core-xdstypeahead--no-clear

Max 3 Results

Screenshot:

Max 3 Results

View in Storybook · core-xdstypeahead--limited-results


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

@cixzhang

Copy link
Copy Markdown
Contributor Author

Popover:

  • Missing default padding -- check the hovercard and try to match that visually
  • We should apply the same animation as the hovercard on entry
  • Just to make the examples a bit better, let's make the popover heading a focusable element so the initial focus goes there when the popover opens instead of on the close popover button.

Tokenizer:

  • After reaching max entries, we lose keyboard focus. I might suggest keeping the typeahead and preserving focus on it so that backspace can still function even if we don't allow adding new entries.
  • Error state is missing the red border. Can we also get examples for success and warning states?
  • We have ways of handling overflow internally. Check the truncationBehavior property in our internal version of XDSTokenizer to see how it works. One note is that we try to keep the typeahead's default width much smaller so that it can continue to fit in one line after adding multiple tokens.

Typeahead:

  • There's a bug where pressing backspace to clear "Banana" from the Default example can't actually clear the last "B"
  • Let's also reuse the selection appearance on the typeahead items as selector items with the checkmark at the end and slightly bolder text.
  • Error state is missing the red border. Can we also get examples for success and warning states?
  • Internally, we like to visually differentiate when a typeahead item is selected vs. text is added. You can check the internal XDSTypeahead to see how it works but the gist is -- when an entry is selected, we will show that as a token. If no entry is selected but text is entered, we will show the text. Internally we use a warning state but in this case, let's converge designs on how we handle invalid temporary states as the XDSNumberInput and make the text secondary colored.

Popover:
- Add default padding matching HoverCard
- Add entry animation matching HoverCard
- Make popover heading focusable for initial focus

Typeahead:
- Fix backspace bug: can't clear last character of selected value
- Add checkmark + bold text for selected items (selector pattern)
- Add status border styles (error/warning/success)
- Show selected value as Token, free text in secondary color
- Add WithWarning and WithSuccess stories

Tokenizer:
- Preserve keyboard focus at max entries (input stays in DOM)
- Add status border styles (error/warning/success)
- Compact input width when tokens are present
- Add WithWarning and WithSuccess stories

Tests updated to match new behavior.
@cixzhang

Copy link
Copy Markdown
Contributor Author

This PR has been split into two for faster landing:

Closing this in favor of the split PRs.

@cixzhang

Copy link
Copy Markdown
Contributor Author

Superseded by #298 + #299

@cixzhang cixzhang closed this Feb 23, 2026
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant