文档
registry.json

registry.json

用于运行您自己的组件注册表的 Schema。

registry.json schema 用于定义您的自定义组件注册表。

registry.json
{
  "$schema": "https://ui.shadcn.org.cn/schema/registry.json",
  "name": "shadcn",
  "homepage": "https://ui.shadcn.org.cn",
  "items": [
    {
      "name": "hello-world",
      "type": "registry:block",
      "title": "Hello World",
      "description": "A simple hello world component.",
      "files": [
        {
          "path": "registry/new-york/hello-world/hello-world.tsx",
          "type": "registry:component"
        }
      ]
    }
  ]
}

定义

您可以在这里查看 registry.json 的 JSON Schema。

$schema

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

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

name

name 属性用于指定您的注册表的名称。这用于数据属性和其他元数据。

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

homepage

您的注册表的 homepage。这用于数据属性和其他元数据。

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

items

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

registry.json
{
  "items": [
    {
      "name": "hello-world",
      "type": "registry:block",
      "title": "Hello World",
      "description": "A simple hello world component.",
      "files": [
        {
          "path": "registry/new-york/hello-world/hello-world.tsx",
          "type": "registry:component"
        }
      ]
    }
  ]
}

请参阅 registry-item schema 文档以获取更多信息。