Skip to content

No.352 · 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

Copy this text

Automatic copying is unavailable. Copy the selected text using your device’s copy command.

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. Implementation requirements: Use React and TypeScript. Keep the component self-contained, with uniquely scoped CSS and no animation libraries. Include required imports, styles and font setup in the result. 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 behavior: Fluid to 40rem; category tags hide below 34rem. Touch: Everything is tap-sized; the keyboard opens with the field. Preserve keyboard access, visible focus and reduced-motion behavior. Keep fictional demo data and simulated service calls in a separate usage example; expose callbacks for real actions and recover from rejected requests. Keep usage-example links inside the demo: use local buttons or prevent navigation. Demonstration links must not navigate to Vitrine routes or open other pages; preserve real URL support in the reusable component itself. Verify the result at narrow and wide viewport sizes, with keyboard input and reduced motion enabled.

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.