99.1k

registry.json

上一页下一页

自建组件注册表所需的 Schema。

registry.json Schema 用于描述自定义组件注册表。

registry.json
{
  "$schema": "https://ui.shadcn.com/schema/registry.json",
  "name": "shadcn",
  "homepage": "https://ui.shadcn.com",
  "items": [
    {
      "name": "hello-world",
      "type": "registry:block",
      "title": "Hello World",
      "description": "A simple hello world component.",
      "registryDependencies": [
        "button",
        "@acme/input-form",
        "https://example.com/r/foo"
      ],
      "dependencies": ["is-even@3.0.0", "motion"],
      "files": [
        {
          "path": "registry/new-york/hello-world/hello-world.tsx",
          "type": "registry:component"
        }
      ]
    }
  ]
}

字段说明

可在此处查看完整 JSON Schema。

$schema

$schema 字段用于声明 registry.json 所对应的 Schema。

registry.json
{
  "$schema": "https://ui.shadcn.com/schema/registry.json"
}

name

name 表示注册表名称,会用于数据属性及其他元信息。

registry.json
{
  "name": "acme"
}

homepage

注册表主页地址,同样会用于数据属性及其他元信息。

registry.json
{
  "homepage": "https://acme.com"
}

items

注册表中的条目列表。每个条目都必须符合 registry-item Schema

registry.json
{
  "items": [
    {
      "name": "hello-world",
      "type": "registry:block",
      "title": "Hello World",
      "description": "A simple hello world component.",
      "registryDependencies": [
        "button",
        "@acme/input-form",
        "https://example.com/r/foo"
      ],
      "dependencies": ["is-even@3.0.0", "motion"],
      "files": [
        {
          "path": "registry/new-york/hello-world/hello-world.tsx",
          "type": "registry:component"
        }
      ]
    }
  ]
}

更多细节请参阅 registry-item Schema 文档