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

const { sortConfig, setSortConfig, sortByKey, clearSort, handleTableSort } =
useTwoLevelSort();
const isContainerNarrow = useContainerNarrow(gridRef, 624);
const { search } = 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.

Maybe not an issue, I'm not sure. But because we're using useSearch here, any search results that are filtered on inside this file, are reduced to seeing only 50 results before any filters here are even run. This could be fine, but nowhere in our UX do we state "the top 50 results" or something like that, so people might be left wondering. Basically, the / filters run on the 50 results, not all of the potential results, so the numbers given might be misleading.

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 see what you mean. The limit was set to 50, I bumped it to 500. Also made it configurable in case we need to adjust it later.

const { sortConfig, setSortConfig, sortByKey, clearSort, handleTableSort } =
useTwoLevelSort();
const isContainerNarrow = useContainerNarrow(gridRef, 780);
const { search } = 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.

Same issues here as described in ComponentsGrid.tsx

const { sortConfig, setSortConfig, sortByKey, clearSort, handleTableSort } =
useTwoLevelSort();
const isContainerNarrow = useContainerNarrow(gridRef, 624);
const { search } = 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.

You're not consuming isLoading or error. So this search can't render a loading state, or respond to errors if they're encountered, it'll just show a blank search results.

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.

Fixed. The search input now shows "Loading search..." while it's loading and "Search unavailable" if something goes wrong.

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 664aef2 to ab2d88f Compare March 31, 2026 01:38
@twjeffery twjeffery requested a review from ArakTaiRoth March 31, 2026 14:58
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