Loading...
Loading...
Define valid component.yml metadata for Canvas components, including props, slots, and enums. Use when (1) Creating a new component, (2) Adding or modifying props, (3) Troubleshooting "not a valid choice" or prop type errors, (4) Mapping enums to CVA variants.
npx skill4agent add acquia/nebula canvas-component-metadatacomponent.ymlname: Component Name # Human-readable display name
machineName: component-name # Machine name in kebab-case
status: true # Whether the component is enabled
required: [] # Array of required prop names
props:
properties:
# ... prop definitions
slots: [] # Use [] only when there are no slots; otherwise use an object maptitleexamplesprops:
properties:
heading:
title: Heading
type: string
examples:
- Enter a heading...propertiestitle# Correct
props:
properties:
buttonText: # camelCase of "Button Text"
title: Button Text
type: string
backgroundColor: # camelCase of "Background Color"
title: Background Color
type: string
isVisible: # camelCase of "Is Visible"
title: Is Visible
type: boolean
# Wrong
props:
properties:
btn_text: # should be "buttonText" for title "Button Text"
title: Button Text
bgColor: # should be "backgroundColor" for title "Background Color"
title: Background Colortype: string
examples:
- Hello, world!type: string
contentMediaType: text/html
x-formatting-context: block
examples:
- <p>This is <strong>formatted</strong> text with HTML.</p>type: string
format: uri-reference
examples:
- /about/contacturiuri-reference#uri-reference# Correct
examples:
- /resources
- /about/team
- https://example.com/page
# Wrong
examples:
- "#"
- ""type: object
$ref: json-schema-definitions://canvas.module/image
examples:
- src: >-
https://images.unsplash.com/photo-1484959014842-cd1d967a39cf?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1770&q=80
alt: Woman playing the violin
width: 1770
height: 1180type: object
$ref: json-schema-definitions://canvas.module/video
examples:
- src: https://media.istockphoto.com/id/1340051874/video/aerial-top-down-view-of-a-container-cargo-ship.mp4?s=mp4-640x640-is&k=20&c=5qPpYI7TOJiOYzKq9V2myBvUno6Fq2XM3ITPGFE8Cd8=
poster: https://example.com/600x400.pngtype: boolean
examples:
- falsetype: integer
examples:
- 42type: number
examples:
- 3.14type: string
enum:
- option1
- option2
- option3
meta:enum:
option1: Option 1
option2: Option 2
option3: Option 3
examples:
- option1type: integer
enum:
- 1
- 2
- 3
meta:enum:
1: Option 1
2: Option 2
3: Option 3
examples:
- 1meta:enum# Correct
enum:
- left_aligned
- center_aligned
meta:enum:
left_aligned: Left aligned
center_aligned: Center aligned
examples:
- left_aligned
# Wrong
enum:
- Left aligned
- Center alignedexamplescomponent.yml// component.yml defines: enum: [left_aligned, center_aligned]
// CVA variants must match:
const variants = cva("base-classes", {
variants: {
layout: {
left_aligned: "text-left", // matches enum value
center_aligned: "text-center", // matches enum value
},
},
});slotscontentsidebar[]slots:
content:
title: Content
buttons:
title: Buttonsconst Section = ({ width, content }) => {
return <div className={sectionVariants({ width })}>{content}</div>;
};slots: []slots: []# Wrong
slots:
- name: content
title: Content