No.197 · FAQ
Search FAQ
An FAQ you can ask: typing filters and ranks the questions, highlights the words that matched in both question and answer, and the list re-sorts itself with a smooth FLIP.
The prompt
The design brief behind this component — reuse it to regenerate, remix, or explain it.
Build a searchable FAQ. A large rounded search field (accent focus ring) sits above a tabular count ('3 of 6 questions', announced politely) and the list. Each row: a small mono category tag, the question, and a plus that becomes a minus; answers fold open with grid-template-rows 0fr → 1fr. Typing scores every item by how many query words prefix-match words in it — question matches count 2, answer/tag matches count 1 — filters out zero scores, and sorts by score (stable by original order). Matching words are highlighted with a tinted <mark> in both the question and the open answer. The list re-sorts smoothly with FLIP: before each change, record every row's top; after render, animate each row from its old position (520ms expo-out), and new rows fade up 8px. When nothing matches, show a serif 'Nothing here matches “…”' with a link to ask a person by email.
Notes
- Interaction
- Type to filter and re-rank; click a question to open its answer; clear with ×.
- Motion
- FLIP re-sort 520ms; new rows fade up 420ms; answers fold 420ms; plus → minus 380ms.
- Accessibility
- Labelled search input, live result count, questions as buttons with aria-expanded, real <mark> highlights. Reduced motion removes FLIP and folding.
- Responsive
- Fluid to 40rem; category tags hide below 34rem.
- On touch
- Everything is tap-sized; the keyboard opens with the field.