Component page template
Every component page has the same sections, in the same order, so people and agents find things in the same place. Start from templates/component.mdx.template.
- Generated sections come from the component source, so they can't drift from the code. Fix them in the source, not in the MDX.
- Authored sections are H2s with a fixed heading id, e.g.
## Use cases {/* #use-cases */}. The label can change, the id can't. - Put other headings as H3s inside a section, e.g. one H3 per example under
examples. - Each authored section shows in the Design or Technical tab, according to its id. Write them in table order: Design sections first.
- The Component health page shows which required sections each page is missing.
| Section | Tab | Required | Heading | Content |
|---|---|---|---|---|
| Thumbnail | Above the tabs | ✅ | Generated | static/img/thumbnails/<Name>.png, shown in the components list. |
| Name and description | Above the tabs | ✅ | Generated | TSDoc summary of the component, or description in frontmatter. |
| Status and replacements | Above the tabs | ✅ | Generated | TSDoc @alpha, @beta or @deprecated with @replacement tags. Stable when untagged, missing when deprecated without a replacement. |
| Example | Design | ✅ | ## Example {/* #basic-example */} | A <Demo> of the component in its most common use, without a live editor. |
| Use cases | Design | ✅ | ## Use cases {/* #use-cases */} | A <UseCases> block with <WhenToUse> and <WhenNotToUse> lists, then ### Alternatives with an <Alternative> card per component to pick instead. |
| Visuals | Design | Optional | ## Visuals {/* #visuals */} | Anatomy, variants and sizes. Skip for purely technical components. |
| States | Design | Optional | ## States {/* #states */} | One H3 and <Demo> per state: default, filled, error, disabled, read-only... |
| Responsive behavior | Design | Optional | ## Responsive behavior {/* #responsive */} | How the component adapts across breakpoints or platforms. |
| Playground | Technical | ✅ | ## Playground {/* #playground */} | A jsx live code block setting the most used props, except sx. |
| Do's and don'ts | Technical | ✅ | ## Do's and don'ts {/* #dos-and-donts */} | A <DoDont> block. |
| Accessibility | Technical | Optional | ## Accessibility {/* #accessibility */} | What the consumer must provide (labels, aria-* props) and links to the relevant WCAG criteria. Compliance status stays in the accessibility frontmatter. |
| Usage examples | Technical | ✅ | ## Usage examples {/* #examples */} | Implementation examples, with at least one <Demo> or code block. |
| Props | Props | ✅ | Generated | Props tab generated from source. Present when every prop has a TSDoc description. |
| Style API | Props | Optional | Generated | Accepted sx keys, listed in the Props tab from the sx prop type. Put any guidance in the TSDoc of the sx prop. |