106k
New

registry.json

运行你自己的组件注册表的架构。

registry.json 架构用于定义你自定义的组件注册表。

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": "一个简单的 hello world 组件。",
      "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.json 的 JSON 架构。

$schema

$schema 属性用于指定 registry.json 文件的架构。

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

name

name 属性用于指定你的注册表的名称。该名称用于数据属性及其他元数据。

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

homepage

注册表的主页地址。该地址用于数据属性及其他元数据。

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

items

注册表中的 items。每个 item 必须实现registry-item 架构规范

registry.json
{
  "items": [
    {
      "name": "hello-world",
      "type": "registry:block",
      "title": "Hello World",
      "description": "一个简单的 hello world 组件。",
      "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 架构文档