Skip to content

feat(docs): add inline search with slash commands to grid pages#3702

Open
twjeffery wants to merge 1 commit intodevfrom
tom/docs-inline-search
Open

feat(docs): add inline search with slash commands to grid pages#3702
twjeffery wants to merge 1 commit intodevfrom
tom/docs-inline-search

Conversation

@twjeffery
Copy link
Copy Markdown
Collaborator

@twjeffery twjeffery commented Mar 27, 2026

Summary

  • Replace basic string-match search inputs on Components, Examples, and Tokens grids with FlexSearch-powered inline search
  • Add contextual slash commands (type /) that toggle grid filters with a stepped dimension picker
  • Consistent search UX across all three grid pages

What it does

Screen.Recording.2026-03-27.at.4.32.13.PM.mov

Type in the search input to filter the grid by relevance. Type / to open a slash command menu that lets you quickly apply filters (category, status, scale, user type) without opening the filter drawer. Multi-dimension pages (Components, Examples) show a dimension picker first, single-dimension pages (Tokens) go straight to values.

Keyboard navigation: arrow keys to navigate, right arrow to drill into a dimension, left/backspace to go back, escape to close, enter to toggle a filter.

Test plan

  • /components - search narrows grid, / shows Category + Status dimensions
  • /examples - search narrows grid, / shows Scale, Category, User Type dimensions
  • /tokens - search narrows grid, / shows category values directly
  • Arrow key navigation works (up/down, right to drill in, left to go back)
  • Slash command filters stay in sync with filter drawer checkboxes
  • Clear all resets search + filters + sort
  • Cmd+K global search modal still works independently
  • No flash of unstyled content on page load

@twjeffery twjeffery force-pushed the tom/docs-inline-search branch from 266a1b9 to b55dc27 Compare March 27, 2026 22:44
@Spark450 Spark450 added the P3 Priority 3 (nice to have): Valuable, but safe to release after launch. label Mar 30, 2026
@chrisolsen
Copy link
Copy Markdown
Collaborator

@twjeffery needs a rebase

@twjeffery twjeffery force-pushed the tom/docs-inline-search branch from b55dc27 to 664aef2 Compare March 30, 2026 22:33
@twjeffery
Copy link
Copy Markdown
Collaborator Author

@twjeffery needs a rebase

@chrisolsen Done

@twjeffery twjeffery force-pushed the tom/docs-inline-search branch from 664aef2 to ab2d88f Compare March 31, 2026 01:38
@twjeffery twjeffery requested a review from ArakTaiRoth March 31, 2026 14:58
: filteredCommands.length > 0;

const effectivePlaceholder = error
? "Search unavailable"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This doesn't work I don't think. In this screenshot I've blocked requests to search-index to simulate an error:

Image

This just modifies the placeholder of the search input. But they've already typed something the search input, so a placeholder change does nothing because there's already text in the input. Handling it like the modal I think would be preferable:

Image

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I switched it to show an error dropdown below the input, similar to how the modal handles it.

const { sortConfig, setSortConfig, sortByKey, clearSort, handleTableSort } =
useTwoLevelSort();
const isContainerNarrow = useContainerNarrow(gridRef, 840);
const { search, isLoading, error } = useSearch();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We're coupling this page to useSearch, but it isn't actually used anywhere in this page, the page seems to use a local page search instead.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good call, removed it. The tokens page uses its own substring matching so it doesn't need the search hook at all.

FlexSearch-powered inline search on Components, Examples, and Tokens
grids with contextual slash commands that toggle grid filters.

- Stepped dimension picker for multi-dimension pages (Category, Status,
  Scale, User Type) with arrow key navigation
- Single-dimension pages (Tokens) skip straight to values
- Search combines with filters using AND logic
- Filter chips bar only shows for real filters, not search-only
- Eager CSS import in BaseLayout prevents FOUC on search inputs
- Explicit SVG dimensions and focus outline suppression for polish
@twjeffery twjeffery force-pushed the tom/docs-inline-search branch from ab2d88f to c0871e0 Compare April 2, 2026 17:51
@twjeffery twjeffery requested a review from ArakTaiRoth April 2, 2026 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Priority 3 (nice to have): Valuable, but safe to release after launch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add inline search with slash commands to docs grid pages

4 participants