Docs
registry.json

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 组件。",
      "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。每个项目必须实现 registry-item 模式规范

registry.json
{
  "items": [
    {
      "name": "hello-world",
      "type": "registry:block",
      "title": "Hello World",
      "description": "一个简单的 hello world 组件。",
      "files": [
        {
          "path": "registry/new-york/hello-world/hello-world.tsx",
          "type": "registry:component"
        }
      ]
    }
  ]
}

有关更多信息,请参见 registry-item 模式文档