canvas-component-composability

Decompose React components into Canvas-compatible slot and prop structures.

16|6|Updated Feb 19, 2025
One-click install
npx skills add https://github.com/acquia/nebula --skill canvas-component-composability-acquia
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: canvas-component-composability
Source: https://github.com/acquia/nebula/tree/main/.agents/skills/canvas-component-composability
Command: npx skills add https://github.com/acquia/nebula --skill canvas-component-composability-acquia

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Helps developers and designers avoid monolithic React components that are hard to reuse and incompatible with Drupal Canvas by promoting slot-based composition and decomposition-first patterns. It addresses issues like excessive props, poor reusability, and Canvas limitations around array props by guiding how to model repeatable content and declare slots.

Core Features & Use Cases

  • Slot-first composition: Prefer slots for variable or nested child content so Canvas users can compose instances directly in Workbench.
  • Decomposition guidance: Identify when to extract repeated or standalone elements (cards, metadata items, link groups) into child components.
  • Repeatable content patterns: Convert array/object item patterns into parent/child slot pairs for lists, grids, carousels, and similar UIs while preserving interactive drop zones.
  • Practical examples: Refactor a large article card into article-meta, resource-cover, and metadata-item components and declare a named slot in component.yml.

Quick Start

Ask the skill to analyze a large React component and produce a decomposition plan that declares named slots in component.yml, recommends child components, and notes minimum slot container sizes.

Frequently Asked Questions about canvas-component-composability

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I decompose a large React component for Drupal Canvas?

Decomposing a large React component for Drupal Canvas involves breaking it into child components and declaring named slots in component.yml so Canvas users can compose variable content directly in Workbench. This approach replaces excessive props with slot-based composition.

What is the difference between using slots and props for React components in Canvas?

Slots are preferred over props for variable or nested child content in Canvas because they allow users to compose instances directly in Workbench. Props are limited, particularly for array data, making slots the better choice for repeatable content patterns like lists and grids.

When should I refactor a monolithic React component into child components?

Refactor a monolithic React component into child components when it grows complex, has excessive props, or contains repeated elements like cards and metadata items. Extracting these into child components with named slots improves reusability and Canvas compatibility.

How do I model repeatable lists or grids in React for Drupal Canvas?

Modeling repeatable lists or grids for Drupal Canvas requires converting array or object item patterns into parent and child slot pairs. This preserves interactive drop zones in Workbench while allowing users to compose repeating UI elements like carousels dynamically.

Does Drupal Canvas support array props in React components?

Drupal Canvas has limitations around array props in React components. To handle repeatable content, you should use parent and child slot pairs instead of array props, ensuring that interactive drop zones remain functional for users composing in Workbench.

What are the layout requirements for slot containers in Canvas components?

Slot containers in Canvas components require minimum container sizes to preserve drop-zone interactivity. When declaring named slots in component.yml, you must include layout advice noting these minimum dimensions so users can successfully drag and drop content into the slots.