Components
@shadcn/react
Utilities
开源注册表索引是一个包含所有可开箱即用的开源注册表的列表。
当你运行 shadcn add 或 shadcn search 时,CLI 会自动检查你所查找的注册表索引,并将其添加到你的 components.json 文件中。
你可以在 https://ui.shadcn.com/r/registries.json 查看完整列表。
你无需将公共 GitHub 注册表提交到注册表目录中,也可以使用 owner/repo/item 地址来使用它。注册表目录适用于诸如 @acme 之类的命名空间。
添加注册表#
- 将你的注册表添加到
apps/v4/registry/directory.json - 运行
pnpm validate:registries来验证注册表目录。 - 向 https://github.com/shadcn-ui/ui 创建一个拉取请求
提交请求后,团队会对其进行验证和审核。
要求#
- 注册表必须是开源的且公开可访问。
- 注册表必须是符合 registry schema specification 的有效 JSON 文件。
- 注册表预计为扁平结构,不包含嵌套项,即
/registry.json和/component-name.json文件应位于注册表根目录。 - 如果存在
files数组,其内容不得包含content属性。
这是一个有效注册表的示例:
{
"$schema": "https://ui.shadcn.com/schema/registry.json",
"name": "acme",
"homepage": "https://acme.com",
"items": [
{
"name": "login-form",
"type": "registry:component",
"title": "登录表单",
"description": "一个登录表单组件。",
"files": [
{
"path": "registry/new-york/auth/login-form.tsx",
"type": "registry:component"
}
]
},
{
"name": "example-login-form",
"type": "registry:component",
"title": "登录表单示例",
"description": "展示如何使用登录表单组件的示例。",
"files": [
{
"path": "registry/new-york/examples/example-login-form.tsx",
"type": "registry:component"
}
]
}
]
}