21st-registry
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePublish & manage on the 21st registry
在21st注册表中发布与管理
Publish components, themes and templates to 21st.dev, and manage what you've
already published, all through the unified CLI ().
21st@21st-dev/cli通过统一的 CLI(),将组件、主题和模板发布到21st.dev,并管理你已发布的所有内容。
21st@21st-dev/cliPre-flight (always)
事前准备(必做)
- Auth needs a real API key. Publish, edit and delete are management
endpoints: they accept a key only, not a
21st_sk_…session token. Get one at https://21st.dev/mcp (or https://21st.dev/settings/api-keys) and pass it via21st loginor the--api-key 21st_sk_…/TWENTYFIRST_TOKENenv var. If the user has no key, point them there.API_KEY_21ST - The CLI is the unified (bin
@21st-dev/cli). Don't reinvent — use it.21st - Search before publishing () so you don't add a duplicate to the library.
21st search "<query>"
- 认证需要真实的API密钥。发布、编辑和删除属于管理端点:它们仅接受密钥,不支持
21st_sk_…会话令牌。请前往**https://21st.dev/mcp**(或**https://21st.dev/settings/api-keys**)获取密钥,并通过`--api-key 21st_sk_…21st loginTWENTYFIRST_TOKEN或API_KEY_21ST`环境变量传入。如果用户没有密钥,请指引他们前往上述地址。/ - CLI工具为统一的(二进制文件名为
@21st-dev/cli)。不要自行开发——直接使用它。21st - 发布前先搜索(),避免向库中添加重复内容。
21st search "<query>"
Publish a component
发布组件
The positional file path triggers auto-detection — name from the default export,
slug from the filename, tags from imports, demo auto-found or synthesised. In
~95% of cases this is enough:
bash
21st publish ./path/to/Component.tsx \
--to default \
--description "1-2 sentences: what it does and when to use it"传入文件路径将触发自动检测:从默认导出中提取名称、从文件名生成slug、从导入内容提取标签、自动查找或合成演示示例。在约95%的情况下,以下命令足够:
bash
21st publish ./path/to/Component.tsx \
--to default \
--description "1-2句话:说明组件功能及适用场景"Decide visibility — default to unlisted
选择可见性——默认设为未列出
| User says… | Flag |
|---|---|
| "share with team", "залей нам", default for any unqualified ask | (none — defaults to |
| "shareable link but not listed" | |
| "publish publicly", "make it public on 21st" | |
| "restrict to the team library", "keep it internal" | |
Never use without an explicit "publish publicly". Public
components go through admin moderation and appear in the 21st library.
--public| 用户指令… | 参数 |
|---|---|
| "share with team"、"上传给我们"、任何未明确说明的默认请求 | (无参数——默认设为 |
| "生成可分享链接但不列入列表" | |
| "公开发布"、"在21st上公开" | |
| "限制在团队库内"、"保持内部可用" | |
除非用户明确要求"公开发布",否则绝不要使用参数。公开组件需要经过管理员审核,并会出现在21st库中。
--publicFlag reference
参数参考
| Flag | When to use |
|---|---|
| Required, 10+ chars: what it does + when to use it. Never fabricate — read the code or ask the user. |
| Override auto-detected name / URL slug / 1-5 tags. |
| Demo file. Auto-found ( |
| Optional static thumbnail (png/jpg/webp); the library also renders a live iframe. |
| Target sub-registry (default |
| Target team library (e.g. |
| Repeatable. A shadcn dep by bare name, URL, or |
| Visibility (default |
The command prints the component URL and the install line
().
npx @21st-dev/cli add @<handle>/<slug>| 参数 | 使用场景 |
|---|---|
| 必填,长度10字符以上:说明组件功能及适用场景。绝不要编造内容——请阅读代码或询问用户。 |
| 覆盖自动检测的名称/URL slug/1-5个标签。 |
| 演示文件。会自动查找( |
| 可选的静态缩略图(png/jpg/webp格式);库中也会渲染实时iframe预览。 |
| 目标子注册表(默认 |
| 目标团队库(例如 |
| 可重复使用。通过裸名称、URL或 |
| 可见性(默认 |
命令执行后会输出组件URL和安装命令()。
npx @21st-dev/cli add @<handle>/<slug>Updating vs a new component
更新组件 vs 发布新组件
Re-run with the same slug → upsert (prints "Updated"). Teammates always get
the latest; no version flag. If the user meant a NEW component but the slug
collides, confirm before overwriting and suggest a different .
--slug使用相同的slug重新运行命令→更新(输出"Updated")。团队成员始终获取最新版本;无需版本参数。如果用户本意是发布新组件但slug冲突,请在覆盖前确认,并建议使用不同的。
--slugHard rules for agents
代理程序必须遵守的规则
- ❌ Never without an explicit instruction.
--public - ❌ Never fabricate a description; never publish a file with API keys, secrets, or unsaved edits (flush first).
- ✅ Always search first; always ship a useful demo when you can.
- ❌ 除非有明确指令,否则绝不要使用参数。
--public - ❌ 绝不要编造描述内容;绝不要发布包含API密钥、机密信息或未保存编辑的文件(请先保存)。
- ✅ 始终先进行搜索;尽可能附带实用的演示示例。
Publish a theme
发布主题
A theme is a CSS file that must define both a and a block of
token values. It publishes as a public community theme.
:root.darkbash
21st publish-theme ./my-theme.css --name "Midnight" [--tags dark,minimal]To generate that CSS from the current project's design tokens instead of writing
it by hand, use the skill.
21st-design-sync主题是一个CSS文件,必须同时定义和代码块的令牌值。主题将作为公开的社区主题发布。
:root.darkbash
21st publish-theme ./my-theme.css --name "Midnight" [--tags dark,minimal]如果不想手动编写CSS,可使用技能,从当前项目的设计令牌生成主题CSS。
21st-design-syncPublish a template
发布模板
A template is a metadata listing (URLs, not files). It lands in for
moderation.
draftbash
21st publish-template "SaaS Starter" \
--site https://demo.example.com \
--preview https://example.com/thumb.png \
[--description "…"] [--price 49] [--buy-url https://…] [--video https://…] [--tags 1,2]模板是元数据列表(仅包含URL,不包含文件)。发布后会处于状态,等待审核。
draftbash
21st publish-template "SaaS Starter" \
--site https://demo.example.com \
--preview https://example.com/thumb.png \
[--description "…"] [--price 49] [--buy-url https://…] [--video https://…] [--tags 1,2]Edit & delete your published items
编辑与删除已发布项目
bash
undefinedbash
undefinedUpdate YOUR OWN item (owner-only; 404 otherwise).
更新你自己的项目(仅所有者可用;否则返回404)。
21st edit <slug> --type component --visibility public|unlisted|private
[--description "…"] [--tags a,b] 21st edit <theme-id> --type theme [--visibility public|private] [--name "New Name"] [--tags a,b] 21st edit <template-id> --type template [--name N] [--description D] [--tags 1,2]
[--description "…"] [--tags a,b] 21st edit <theme-id> --type theme [--visibility public|private] [--name "New Name"] [--tags a,b] 21st edit <template-id> --type template [--name N] [--description D] [--tags 1,2]
21st edit <slug> --type component --visibility public|unlisted|private
[--description "…"] [--tags a,b] 21st edit <theme-id> --type theme [--visibility public|private] [--name "New Name"] [--tags a,b] 21st edit <template-id> --type template [--name N] [--description D] [--tags 1,2]
[--description "…"] [--tags a,b] 21st edit <theme-id> --type theme [--visibility public|private] [--name "New Name"] [--tags a,b] 21st edit <template-id> --type template [--name N] [--description D] [--tags 1,2]
Remove an item. ALWAYS requires --yes. Semantics differ by type:
删除项目。必须使用--yes参数。不同类型项目的语义不同:
component -> unpublished (visibility set to private; reversible via edit/re-publish)
component -> 取消发布(可见性设为private;可通过编辑/重新发布恢复)
theme -> unpublished (removed from the marketplace; reversible)
theme -> 取消发布(从市场移除;可恢复)
template -> PERMANENT hard delete
template -> 永久硬删除
21st delete <id|slug> --type component|theme|template --yes
Notes: template visibility is moderation-controlled (`--visibility` is ignored
for templates). Themes rename via `--name` and only support `public|private`.
Anything the CLI can't do, point the user to their studio at
`https://21st.dev/studio/<username>`.
---21st delete <id|slug> --type component|theme|template --yes
注意:模板的可见性由审核控制(`--visibility`参数对模板无效)。主题可通过`--name`重命名,仅支持`public|private`可见性。任何CLI无法完成的操作,请指引用户前往其工作室:`https://21st.dev/studio/<username>`。
---Manage your profile page (bento board)
管理个人资料页面(bento面板)
Your public profile at can show a bento-style board of blocks
instead of the classic layout. is a FULL REPLACE (like on
) — read the current board first if you want to keep existing content.
21st.dev/@youset--tagseditbash
21st profile get [--json] # read your current board (as blocks)
21st profile set --file board.json # replace it (JSON array, or pipe it via stdin)
21st profile set --clear # revert to the classic (non-bento) profile
21st profile upload ./cover.png # upload a png/jpg/gif/webp, prints a urlboard.jsonjson
[
{ "type": "component", "demoId": 143 },
{ "type": "social", "url": "https://x.com/you" },
{ "type": "note", "text": "Building UI for 21st.dev" },
{ "type": "hire", "headline": "Work with me", "url": "https://cal.com/you" },
{ "type": "divider" },
{ "type": "image", "mediaUrl": "<url from `profile upload`>" }
]Block types: (your OWN demoId — from or
), (a link card, icon auto-detected from the domain),
(text), / / (headline/body/url/email/cta),
( from — a foreign url is dropped, not an
error), (splits the board into a new section). Every block accepts
optional / (grid units, 1-3 wide / 1-2 tall) to size it.
component21st search --mine21st getsocialnotehireprosupportimagemediaUrlprofile uploaddividerwhReordering = re-post the blocks array in the order you want; the board packs
top-to-bottom, left-to-right in array order.
你的公开个人资料页面可以展示bento风格的模块面板,替代经典布局。命令会完全替换现有内容(类似命令中的参数)——如果要保留现有内容,请先读取当前面板。
21st.dev/@yousetedit--tagsbash
21st profile get [--json] # 读取当前面板(以模块形式展示)
21st profile set --file board.json # 替换面板内容(JSON数组,或通过标准输入传入)
21st profile set --clear # 恢复为经典(非bento)个人资料
21st profile upload ./cover.png # 上传png/jpg/gif/webp格式图片,输出图片URLboard.jsonjson
[
{ "type": "component", "demoId": 143 },
{ "type": "social", "url": "https://x.com/you" },
{ "type": "note", "text": "Building UI for 21st.dev" },
{ "type": "hire", "headline": "Work with me", "url": "https://cal.com/you" },
{ "type": "divider" },
{ "type": "image", "mediaUrl": "<url from `profile upload`>" }
]模块类型:(你自己的demoId——来自或)、(链接卡片,图标会根据域名自动检测)、(文本)、//(标题/正文/URL/邮箱/号召性用语)、(来自——外部URL会被忽略,不会报错)、(将面板分割为新区域)。每个模块都可选择传入/参数(网格单位,宽度1-3 / 高度1-2)来调整尺寸。
component21st search --mine21st getsocialnotehireprosupportimagemediaUrlprofile uploaddividerwh重新排序模块=按所需顺序重新提交模块数组;面板会按数组顺序从上到下、从左到右排列模块。
Teams & config
团队与配置
bash
21st teams # your teams
21st team <teamId> # a team's libraries
21st team-lists <teamId> # a team's shared bookmark lists
21st team-components <teamId> [--library <id>]
21st init --client cursor|claude|codex|vscode|windsurf [--write] # write MCP configbash
21st teams # 查看你的团队
21st team <teamId> # 查看团队的库
21st team-lists <teamId> # 查看团队的共享书签列表
21st team-components <teamId> [--library <id>]
21st init --client cursor|claude|codex|vscode|windsurf [--write] # 写入MCP配置