.agents/skills/canvas-component-composability/SKILL.md
Design Canvas-ready React components with slots and decomposition-first patterns. Use when (1) Designing a component's prop/slot structure, (2) A component is growing too large, (3) Deciding between props vs slots, (4) Refactoring monolithic components, (5) Modeling repeatable list/grid content. Ensures Canvas compatibility.
npx skillsauth add balintbrews/canvas-starter canvas-component-composabilityInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Prefer small, focused components over monolithic ones with many props. When a component starts accumulating many unrelated props, decompose it into smaller, composable pieces.
Load references only as needed:
references/repeatable-content.mdreferences/repeatable-content.md ("Slot container minimum size" section)Consider breaking up a component when it has:
Slots are the primary mechanism for composability. Instead of passing complex data through props, use slots to let parent components accept child components. This matches how Canvas users build pages by placing components inside other components.
| Use slots for | Use props for | | ------------------------------------- | ----------------------------------- | | Variable number of child components | Single, required values (text, URL) | | Content that users should compose | Configuration options (size, color) | | Complex nested structures | Simple data (strings, booleans) | | Content that varies between instances | Content consistent across instances |
Declare slots in component.yml and render them as named props in JSX.
For exact slot schema and constraints (map vs [], slot keys, children
handling), follow canvas-component-metadata as the source of truth.
Elements that appear on many pages but are not always needed together should be separate components.
When the same combination of elements is repeated, extract it:
article-metaresource-covermetadata-itemicon-linkDo not bake two-column or grid layouts into content components. Use layout components and compose content into them.
Keep components together when:
development
Use when work must be verified in local Canvas Workbench, or when the user asks to run, open, or check a component in Workbench. Verifies that Canvas Workbench is available through the project's package runner, starts the local Workbench dev server, and keeps Workbench verification as part of the implementation workflow.
tools
Style Canvas components with Tailwind CSS 4 theme tokens and approved utility patterns. Use when (1) Creating a new component, (2) Adding colors or styling to components, (3) Working with Tailwind theme tokens, (4) Adding or updating design tokens in global.css, (5) Creating color/style props, (6) Any change where component props are added/removed/renamed/retyped and can affect rendered styles. Covers @theme variables, CVA variants, and cn() utility.
tools
Fetch and render Drupal content in Canvas components with JSON:API and SWR patterns. Use when building content lists, integrating with SWR, or querying related entities. Covers JsonApiClient, DrupalJsonApiParams, relationship handling, and filter patterns.
tools
Use utility components to render formatted text and media correctly. Use when (1) Rendering HTML text content from props, (2) Displaying images, (3) Working with formatted text or media. Covers FormattedText and Image utilities.