jpskill.com
🎨 デザイン コミュニティ

canvas-component-metadata

Canvasコンポーネントのpropsやslotsといった構成要素を定義し、新規コンポーネント作成、props変更、エラー対応、enumとCVA variantsのマッピング時に、有効なmetadataを記述・管理するSkill。

📜 元の英語説明(参考)

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.

🇯🇵 日本人クリエイター向け解説

一言でいうと

Canvasコンポーネントのpropsやslotsといった構成要素を定義し、新規コンポーネント作成、props変更、エラー対応、enumとCVA variantsのマッピング時に、有効なmetadataを記述・管理するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o canvas-component-metadata.zip https://jpskill.com/download/9232.zip && unzip -o canvas-component-metadata.zip && rm canvas-component-metadata.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/9232.zip -OutFile "$d\canvas-component-metadata.zip"; Expand-Archive "$d\canvas-component-metadata.zip" -DestinationPath $d -Force; ri "$d\canvas-component-metadata.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して canvas-component-metadata.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → canvas-component-metadata フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

ファイル構造

すべての component.yml には、以下のトップレベルのキーが含まれている必要があります。

name: Component Name # 人間が読める表示名
machineName: component-name # ケバブケースのマシン名
status: true # コンポーネントが有効かどうか
required: [] # 必須の prop 名の配列
props:
  properties:
    # ... prop の定義
slots: [] # スロットがない場合は [] を使用します。それ以外の場合はオブジェクトマップを使用します

Props

要件

すべての prop の定義には、UI ラベル用の title が含まれている必要があります。 examples 配列は、必須の prop には必須であり、その他すべてに推奨されます。 Drupal Canvas では、最初の例の値のみが使用されます。

props:
  properties:
    heading:
      title: Heading
      type: string
      examples:
        - Enter a heading...

Prop ID は、タイトルの camelCase バージョンである必要があります。

prop ID ( properties の下のキー) は、 title 値の camelCase 変換である必要があります。

component.yml には、ユーザー向けの Canvas で編集可能な prop のみを含めます。 実装専用の React prop は JSX に保持し、メタデータに追加しないでください。

classNamecomponent.yml に含めないでください。 Canvas エディターのコントロールではなく、開発者向けのコンポジション prop として扱います。

# 正しい
props:
  properties:
    buttonText:           # "Button Text" の camelCase
      title: Button Text
      type: string
    backgroundColor:      # "Background Color" の camelCase
      title: Background Color
      type: string
    isVisible:            # "Is Visible" の camelCase
      title: Is Visible
      type: boolean

# 間違い
props:
  properties:
    btn_text:             # title "Button Text" の場合は "buttonText" にすべき
      title: Button Text
    bgColor:              # title "Background Color" の場合は "backgroundColor" にすべき
      title: Background Color

Prop の型

Text

基本的なテキスト入力。 文字列値として保存されます。

type: string
examples:
  - Hello, world!

Formatted text

HTML フォーマットをサポートするリッチテキストコンテンツ。ブロックコンテキストで表示されます。

type: string
contentMediaType: text/html
x-formatting-context: block
examples:
  - <p>This is <strong>formatted</strong> text with HTML.</p>

Link

内部または外部リソースへのリンクの URL または URI 参照。

type: string
format: uri-reference
examples:
  - /about/contact

注: フォーマットは、 uri (絶対 URL のみを受け入れる) または uri-reference (絶対 URL と相対 URL の両方を受け入れる) のいずれかになります。

重要: URL prop には適切なパスの例を使用してください。 uri-reference prop の例の値として # を使用しないでください。アップロード中に検証エラーが発生する可能性があります。 常に現実的なパスのような例を使用してください。

# 正しい
examples:
  - /resources
  - /about/team
  - https://example.com/page

# 間違い
examples:
  - "#"
  - ""

Image

alt テキスト、寸法、ファイル URL などのメタデータを含む画像オブジェクトへの参照。 ファイル URL のみが存在する必要があり、他のすべてのメタデータは常にオプションです。

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: 1180

Video

寸法やファイル URL などのメタデータを含むビデオオブジェクトへの参照。 ファイル URL のみが存在する必要があり、他のすべてのメタデータは常にオプションです。

type: 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.png

Boolean

true または false の値。

type: boolean
examples:
  - false

Integer

小数点以下の桁がない整数値。

type: integer
examples:
  - 42

Number

小数点以下の桁数を含めることができる数値。

type: number
examples:
  - 3.14

List: text

ユーザーが選択できるテキストオプションの定義済みリスト。

type: string
enum:
  - option1
  - option2
  - option3
meta:enum:
  option1: Option 1
  option2: Option 2
  option3: Option 3
examples:
  - option1

List: integer

ユーザーが選択できる整数オプションの定義済みリスト。

type: integer
enum:
  - 1
  - 2
  - 3
meta:enum:
  1: Option 1
  2: Option 2
  3: Option 3
examples:
  - 1

Enums

Enum 値は、小文字のマシンフレンドリーな識別子を使用する必要があります。 UI の人間が読める表示ラベルを提供するには、 meta:enum を使用します。

注: Enum 値にドットを含めることはできません。

# 正しい
enum:
  - left_aligned
  - center_aligned
meta:enum:
  left_aligned: Left aligned
  center_aligned: Center aligned
examples:
  - left_aligned

# 間違い
enum:
  - Left aligned
  - Center aligned

examples 値は、表示ラベルではなく、enum 値である必要があります。

Enum 値は JSX コンポーネントのバリアントと一致する必要があります

JSX コンポーネントで class-variance-authority (CVA) または同様のライブラリを使用する場合、バリアントキーは component.yml で定義された enum 値と正確に一致する必要があります。

// component.yml は以下を定義します: enum: [left_aligned, center_aligned]
// CVA バリアントは一致する必要があります:
const variants = cva("base-classes", {
  variants: {
    layout: {
      left_aligned: "text-left", // enum 値と一致
      center_aligned: "text-center", // enum 値と一致
    },
  },
});

Slots

スロットを使用すると、他のコンポーネントをコンポーネント内に埋め込むことができます。 React では、各スロットはスロットキーと一致する名前付き prop として受信されます。

このセクションは、スロットスキーマの信頼できる情報源です。 他のスキルは、スロットスキーマの詳細を再定義するのではなく、これらのルールを参照する必要があります。

スロットを作成する前に、ユースケースが明らかに構成的でない限り (たとえば、リッチなネストされたコンテンツ、または繰り返し可能な埋め込みコンポーネント)、ユーザーに確認してください。 単純なテキストのような値の場合、p

📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

File structure

Every component.yml must include these top-level keys:

name: 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 map

Props

Requirements

Every prop definition must include a title for the UI label. The examples array is required for required props and recommended for all others. Only the first example value is used by Drupal Canvas.

props:
  properties:
    heading:
      title: Heading
      type: string
      examples:
        - Enter a heading...

Prop IDs must be camelCase versions of their titles.

The prop ID (the key under properties) must be the camelCase conversion of the title value.

Only include user-facing, Canvas-editable props in component.yml. Implementation-only React props must stay in JSX and must not be added to metadata.

Never include className in component.yml. Treat it as a composition prop for developers, not a Canvas editor control.

# 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 Color

Prop types

Text

Basic text input. Stored as a string value.

type: string
examples:
  - Hello, world!

Formatted text

Rich text content with HTML formatting support, displayed in a block context.

type: string
contentMediaType: text/html
x-formatting-context: block
examples:
  - <p>This is <strong>formatted</strong> text with HTML.</p>

Link

URL or URI reference for links to internal or external resources.

type: string
format: uri-reference
examples:
  - /about/contact

Note: The format can be either uri (accepts only absolute URLs) or uri-reference (accepts both absolute and relative URLs).

IMPORTANT: Use proper path examples for URL props. Do not use # as an example value for uri-reference props—it can cause validation failures during upload. Always use realistic path-like examples:

# Correct
examples:
  - /resources
  - /about/team
  - https://example.com/page

# Wrong
examples:
  - "#"
  - ""

Image

Reference to an image object with metadata like alt text, dimensions, and file URL. Only the file URL is required to exist, all other metadata is always optional.

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: 1180

Video

Reference to a video object with metadata like dimensions and file URL. Only the file URL is required to exist, all other metadata is always optional.

type: 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.png

Boolean

True or false value.

type: boolean
examples:
  - false

Integer

Whole number value without decimal places.

type: integer
examples:
  - 42

Number

Numeric value that can include decimal places.

type: number
examples:
  - 3.14

List: text

A predefined list of text options that the user can select from.

type: string
enum:
  - option1
  - option2
  - option3
meta:enum:
  option1: Option 1
  option2: Option 2
  option3: Option 3
examples:
  - option1

List: integer

A predefined list of integer options that the user can select from.

type: integer
enum:
  - 1
  - 2
  - 3
meta:enum:
  1: Option 1
  2: Option 2
  3: Option 3
examples:
  - 1

Enums

Enum values must use lowercase, machine-friendly identifiers. Use meta:enum to provide human-readable display labels for the UI.

Note: Enum values cannot contain dots.

# Correct
enum:
  - left_aligned
  - center_aligned
meta:enum:
  left_aligned: Left aligned
  center_aligned: Center aligned
examples:
  - left_aligned

# Wrong
enum:
  - Left aligned
  - Center aligned

The examples value must be the enum value, not the display label.

Enum values must match JSX component variants

When using class-variance-authority (CVA) or similar libraries in the JSX component, the variant keys must exactly match the enum values defined in component.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
    },
  },
});

Slots

Slots allow other components to be embedded within a component. In React, each slot is received as a named prop that matches the slot key.

This section is the slot schema source of truth. Other skills should reference these rules instead of redefining slot schema details.

Before creating slots, confirm with the user unless the use case is clearly compositional (for example, rich nested content, or repeatable embedded components). For simple text-like values, prefer a prop.

Important: Do not map Canvas slots to the children prop by default. If the slot key is content, consume it as content in JSX.

Using a slot key named children is technically possible, but it is not recommended because slot naming often flows into user-facing Canvas labels. Prefer explicit slot keys such as content, media, or actions.

slots must be either:

  1. An object map keyed by slot name (content, sidebar, etc.)
  2. [] when the component has no slots
slots:
  content:
    title: Content
  buttons:
    title: Buttons

In the JSX component, slots are destructured as named props and rendered directly:

const Section = ({ width, content }) => {
  return <div className={sectionVariants({ width })}>{content}</div>;
};
// Wrong when the slot key is `content`: this does not consume the named slot.
const Section = ({ children }) => {
  return <div>{children}</div>;
};

Use slots: [] only when the component has no slots:

slots: []

Do not use arrays of slot objects:

# Wrong
slots:
  - name: content
    title: Content