Canonical definition
A Canvas component is a package of:
- A React implementation (
index.jsx)
- Canvas metadata/schema (
component.yml)
- Naming and structure compatibility (
machineName, folder path, Workbench
mock path)
- Canvas-compatible props/slots modeling
- Workbench mock coverage for authored preview states
The first four parts are required for the component to be usable in Drupal
Canvas. Workbench mocks are the supported way to author named preview states
beyond Workbench's built-in Default tab.
Minimum contract (MUST)
Every Canvas component MUST satisfy all checks below:
- Component folder exists at
<components-root>/<machine-name>/ (use the
repository's configured components root, which may be defined in .env)
- React implementation exists at
<components-root>/<machine-name>/index.jsx
- Metadata exists at
<components-root>/<machine-name>/component.yml
component.yml includes required top-level keys (name, machineName,
status, required, props, slots)
- Folder name exactly matches
machineName in component.yml (kebab-case)
- Props/slots follow Canvas rules (for example, avoid unsupported
array-of-object prop shapes; use slots for repeatable complex content)
If any item is missing, the component is incomplete for Canvas usage.
For local authoring and review, add a matching Workbench mock file beside the
component source and metadata:
- Use
mocks.json beside index.jsx and component.yml
- Author at least one named mock whenever the component needs a preview beyond
the auto-generated
Default tab, which renders the component using the first
example value for each prop from component.yml
Naming guidance
Use references/naming.md for naming rules and examples.
Workbench mocks
Use references/workbench-mocks.md for mock naming, placement, format
selection, and validation.
Skill coordination
Evaluate using companion skills in this order.
canvas-component-metadata
- Use when creating/changing
component.yml, props/slots, enums, or fixing
prop validation errors.
canvas-component-composability
- Use when designing prop/slot structure, decomposing large components,
deciding props vs slots, or modeling repeatable list/grid content.
canvas-styling-conventions
- Use for all styling work: new components, style props, Tailwind token
usage, CVA variants, class changes, and prop changes that affect styles.
canvas-component-utils
- Use when rendering formatted HTML text or media via
FormattedText and
Image.
canvas-data-fetching
- Use when fetching/rendering Drupal content with JSON:API, SWR, includes,
and filter patterns.
canvas-component-push
- Use after implementation is complete and validated, when pushing changes
and recovering from push failures.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: balintbrews-canvas-starter-canvas-component-definition3description: Canonical definition4---56## Canonical definition78A Canvas component is a package of:9101. A React implementation (`index.jsx`)112. Canvas metadata/schema (`component.yml`)123. Naming and structure compatibility (`machineName`, folder path, Workbench13 mock path)144. Canvas-compatible props/slots modeling155. Workbench mock coverage for authored preview states1617The first four parts are required for the component to be usable in Drupal18Canvas. Workbench mocks are the supported way to author named preview states19beyond Workbench's built-in `Default` tab.2021## Minimum contract (MUST)2223Every Canvas component MUST satisfy all checks below:2425- Component folder exists at `<components-root>/<machine-name>/` (use the26 repository's configured components root, which may be defined in `.env`)27- React implementation exists at `<components-root>/<machine-name>/index.jsx`28- Metadata exists at `<components-root>/<machine-name>/component.yml`29- `component.yml` includes required top-level keys (`name`, `machineName`,30 `status`, `required`, `props`, `slots`)31- Folder name exactly matches `machineName` in `component.yml` (kebab-case)32- Props/slots follow Canvas rules (for example, avoid unsupported33 array-of-object prop shapes; use slots for repeatable complex content)3435If any item is missing, the component is incomplete for Canvas usage.3637For local authoring and review, add a matching Workbench mock file beside the38component source and metadata:3940- Use `mocks.json` beside `index.jsx` and `component.yml`41- Author at least one named mock whenever the component needs a preview beyond42 the auto-generated `Default` tab, which renders the component using the first43 example value for each prop from `component.yml`4445## Naming guidance4647Use `references/naming.md` for naming rules and examples.4849## Workbench mocks5051Use `references/workbench-mocks.md` for mock naming, placement, format52selection, and validation.5354## Skill coordination5556Evaluate using companion skills in this order.57581. `canvas-component-metadata`59 - Use when creating/changing `component.yml`, props/slots, enums, or fixing60 prop validation errors.612. `canvas-component-composability`62 - Use when designing prop/slot structure, decomposing large components,63 deciding props vs slots, or modeling repeatable list/grid content.643. `canvas-styling-conventions`65 - Use for all styling work: new components, style props, Tailwind token66 usage, CVA variants, class changes, and prop changes that affect styles.674. `canvas-component-utils`68 - Use when rendering formatted HTML text or media via `FormattedText` and69 `Image`.705. `canvas-data-fetching`71 - Use when fetching/rendering Drupal content with JSON:API, SWR, includes,72 and filter patterns.736. `canvas-component-push`74 - Use after implementation is complete and validated, when pushing changes75 and recovering from push failures.7677---78> Converted and distributed by [TomeVault](https://tomevault.io/claim/balintbrews) — claim your Tome and manage your conversions.79<!-- tomevault:4.0:skill_md:2026-04-11 -->