fumadocs-registry-integration
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRegistry Integration
注册表集成
Register 8-bit components in for discovery via .
registry.jsonshadcn add @8bitcn/[component-name]在中注册8-bit组件,以便通过命令发现这些组件。
registry.jsonshadcn add @8bitcn/[组件名称]Component Entry Pattern
组件条目格式
json
{
"name": "button",
"type": "registry:component",
"title": "8-bit Button",
"description": "A simple 8-bit button component",
"registryDependencies": ["button"],
"files": [
{
"path": "components/ui/8bit/button.tsx",
"type": "registry:component",
"target": "components/ui/8bit/button.tsx"
},
{
"path": "components/ui/8bit/styles/retro.css",
"type": "registry:component",
"target": "components/ui/8bit/styles/retro.css"
}
]
}json
{
"name": "button",
"type": "registry:component",
"title": "8-bit Button",
"description": "A simple 8-bit button component",
"registryDependencies": ["button"],
"files": [
{
"path": "components/ui/8bit/button.tsx",
"type": "registry:component",
"target": "components/ui/8bit/button.tsx"
},
{
"path": "components/ui/8bit/styles/retro.css",
"type": "registry:component",
"target": "components/ui/8bit/styles/retro.css"
}
]
}Block Entry Pattern
区块条目格式
For pre-built layouts like game UIs:
json
{
"name": "quest-log",
"type": "registry:block",
"title": "8-bit Quest Log",
"description": "An 8-bit quest and mission tracking system.",
"registryDependencies": ["card", "accordion"],
"categories": ["gaming"],
"files": [
{
"path": "components/ui/8bit/quest-log.tsx",
"type": "registry:block",
"target": "components/ui/8bit/quest-log.tsx"
},
{
"path": "components/ui/8bit/styles/retro.css",
"type": "registry:component",
"target": "components/ui/8bit/styles/retro.css"
}
]
}对于游戏UI这类预构建布局:
json
{
"name": "quest-log",
"type": "registry:block",
"title": "8-bit Quest Log",
"description": "An 8-bit quest and mission tracking system.",
"registryDependencies": ["card", "accordion"],
"categories": ["gaming"],
"files": [
{
"path": "components/ui/8bit/quest-log.tsx",
"type": "registry:block",
"target": "components/ui/8bit/quest-log.tsx"
},
{
"path": "components/ui/8bit/styles/retro.css",
"type": "registry:component",
"target": "components/ui/8bit/styles/retro.css"
}
]
}Required retro.css
必须包含retro.css
Always include in files array:
retro.cssjson
"files": [
{
"path": "components/ui/8bit/new-component.tsx",
"type": "registry:component",
"target": "components/ui/8bit/new-component.tsx"
},
{
"path": "components/ui/8bit/styles/retro.css",
"type": "registry:component",
"target": "components/ui/8bit/styles/retro.css"
}
]务必在files数组中包含:
retro.cssjson
"files": [
{
"path": "components/ui/8bit/new-component.tsx",
"type": "registry:component",
"target": "components/ui/8bit/new-component.tsx"
},
{
"path": "components/ui/8bit/styles/retro.css",
"type": "registry:component",
"target": "components/ui/8bit/styles/retro.css"
}
]Categories
分类
Use gaming-specific categories for game components:
json
"categories": ["gaming"]Available categories: , , , , , , .
gaminglayoutformdata-displayfeedbacknavigationoverlay游戏类组件请使用游戏专属分类:
json
"categories": ["gaming"]可用分类:, , , , , , 。
gaminglayoutformdata-displayfeedbacknavigationoverlayRegistry Dependencies
注册表依赖
List base shadcn dependencies (not 8-bit versions):
json
"registryDependencies": ["button", "dialog", "progress"]For blocks with multiple components:
json
"registryDependencies": ["card", "button", "progress", "tabs"]列出基础shadcn依赖项(而非8-bit版本):
json
"registryDependencies": ["button", "dialog", "progress"]对于包含多个组件的区块:
json
"registryDependencies": ["card", "button", "progress", "tabs"]Type Selection
类型选择
registry:component - Single reusable component:
json
{
"type": "registry:component",
"files": [...]
}registry:block - Pre-built layout or feature:
json
{
"type": "registry:block",
"categories": ["gaming"],
"files": [...]
}registry:component - 单个可复用组件:
json
{
"type": "registry:component",
"files": [...]
}registry:block - 预构建布局或功能模块:
json
{
"type": "registry:block",
"categories": ["gaming"],
"files": [...]
}Complete Example
完整示例
json
{
"name": "health-bar",
"type": "registry:component",
"title": "8-bit Health Bar",
"description": "An 8-bit health bar component for game UI.",
"registryDependencies": ["progress"],
"files": [
{
"path": "components/ui/8bit/health-bar.tsx",
"type": "registry:component",
"target": "components/ui/8bit/health-bar.tsx"
},
{
"path": "components/ui/8bit/progress.tsx",
"type": "registry:component",
"target": "components/ui/8bit/progress.tsx"
},
{
"path": "components/ui/8bit/styles/retro.css",
"type": "registry:component",
"target": "components/ui/8bit/styles/retro.css"
}
]
}json
{
"name": "health-bar",
"type": "registry:component",
"title": "8-bit Health Bar",
"description": "An 8-bit health bar component for game UI.",
"registryDependencies": ["progress"],
"files": [
{
"path": "components/ui/8bit/health-bar.tsx",
"type": "registry:component",
"target": "components/ui/8bit/health-bar.tsx"
},
{
"path": "components/ui/8bit/progress.tsx",
"type": "registry:component",
"target": "components/ui/8bit/progress.tsx"
},
{
"path": "components/ui/8bit/styles/retro.css",
"type": "registry:component",
"target": "components/ui/8bit/styles/retro.css"
}
]
}Key Principles
核心原则
- Type - Use for single,
registry:componentfor layoutsregistry:block - retro.css required - Always include in files array
- Target path - Same path for source and target
- Categories - Use for retro-themed blocks
gaming - Dependencies - List base shadcn/ui components (not 8-bit)
- Description - Clear, concise for CLI output
- Files order - Component first, retro.css last
- 类型 - 单个组件使用,布局使用
registry:componentregistry:block - 必须包含retro.css - 务必在files数组中包含该文件
- 目标路径 - 源路径与目标路径保持一致
- 分类 - 复古主题区块使用分类
gaming - 依赖项 - 列出基础shadcn/ui组件(而非8-bit版本)
- 描述 - 清晰简洁,适配CLI输出
- 文件顺序 - 组件文件在前,retro.css在后
Adding a New Component
添加新组件的步骤
- Create component in
components/ui/8bit/component.tsx - Create documentation in
content/docs/components/component.mdx - Add entry to :
registry.json- Copy existing component as template
- Update name, title, description
- Set correct registryDependencies
- Include retro.css in files
- Test:
pnpm dlx shadcn@latest add @8bitcn/component
- 在路径下创建组件
components/ui/8bit/component.tsx - 在路径下创建文档
content/docs/components/component.mdx - 向中添加条目:
registry.json- 复制现有组件作为模板
- 更新名称、标题、描述
- 设置正确的registryDependencies
- 在files中包含retro.css
- 测试:执行
pnpm dlx shadcn@latest add @8bitcn/component
Reference
参考资料
- - Full component registry
registry.json - - Component documentation
content/docs/components/*.mdx
- - 完整组件注册表
registry.json - - 组件文档
content/docs/components/*.mdx