Skip to content
SprecherEast
Issue 1532

enhancement: Showcase examples format and a generated showcase index

Back to our plan
Done
enhancementfrontendtoolingpriority: mediumready

Problem

The showcase needs one source for each component's examples and facts, so it never drifts from the code: today the gallery's samples, the Storybook stories and the generated reference are three separate places.

Proposed fix

  • One examples file beside each component (for example Tabs.examples.tsx): each export is one configuration with a name, a one-line purpose and, where it helps, the settings a visitor may change. The showcase renders them, shows their own source (read from the file at build time, never copied), and the tests render each one and run axe on it.
  • Extend the generated reference (scripts/reference/components.mjs, npm run docs:generate) to write a showcase index: each component's group, description, props, variants, the places that use it with their count (the existing "Used by" data, which counts importing files), and its examples with their source.
  • Prove the format on three components (Button, Badge, Tabs, with active, generated and disabled tabs).
  • Record the format in docs/ui/component-set.md and the UI kit note.

Existing work compared

Searched open and closed issues on 2026-11-26 (showcase, Storybook, gallery, toggle, switch, developer site, examples, theme readiness, usage, side navigation). Part of epic #1528, which replaces #1424 (owner decision 2026-11-26, recorded there). No other issue covers this step.

Acceptance criteria

  • Not done: Tests first for the generator: an examples file yields its configurations, purposes, settings and source; a component without one is listed as missing
  • Not done: The index holds the props, variants and usage count for every component in the reference, and Knowledge sync fails when it is stale
  • Not done: Every example renders in the tests with an axe check
  • Not done: Button, Badge and Tabs have examples files
  • Not done: The format is written down once, in the component set

Files likely touched

scripts/reference/, scripts/generate-reference.mjs, docs/reference/, src/platform/ui/Button.examples.tsx, src/platform/ui/Badge.examples.tsx, src/platform/ui/Tabs.examples.tsx, src/platform/ui/testing/, docs/ui/component-set.md, src/platform/ui/README.md

Must not touch

src/modules/, src/payload.config.ts, src/app/

Open questions

None.

Area

tooling, frontend

Priority

priority: medium


Generated by Claude Code, opens in a new tab

See it on GitHub, opens in a new tab