一键导入
update-doc
Add or update ink-ui component documentation pages in content/docs/components/. Triggered when the user says "add/update documentation for <component>".
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Add or update ink-ui component documentation pages in content/docs/components/. Triggered when the user says "add/update documentation for <component>".
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | update-doc |
| description | Add or update ink-ui component documentation pages in content/docs/components/. Triggered when the user says "add/update documentation for <component>". |
This skill describes the full procedure for documenting a UI component on the ink-ui docs site.
A component doc page has these pieces:
registry/default/ui/<component>.tsx - styled wrapper around Base UI primitivesregistry/default/examples/<component>-<example-name>-example.tsx - one exported React function per fileregistry.json - shadcn registry metadata for the component and each atomic examplecontent/docs/components/<component>.mdx - MDX page with frontmatter, examples, installation, and API referencesrc/lib/props-registry.ts - entries for <PropsTable>content/docs/components/meta.json - add the page slug to pagesGenerated output:
public/r/ is generated by pnpm registry:build; do not edit files there by hand..source/ is generated by pnpm typegen; do not edit files there by hand.src/routeTree.gen.ts is generated by TanStack Router; do not edit it by hand.The wrapper at registry/default/ui/<component>.tsx must exist and export named components. Read it to understand which sub-components are exported.
Create or update atomic files in registry/default/examples/. Each file must contain exactly one exported example function.
Rules:
<component>-<example-name>-example.tsx, e.g. button-loading-example.tsx, menu-with-icons-example.tsxdefault as the example name for the primary/basic example, e.g. button-default-example.tsxexport function ComponentExample() { ... }<Feature><Component>Example, e.g. LoadingButtonExample, MenuWithIconsExampleregistry/default/ui/<component> and @phosphor-icons/react for icons<div className="flex flex-wrap items-center gap-4">client:* directives.Docs pages import each atomic example file with ?raw and pass that file's source to the matching <ComponentSource>, so each code snippet shows only the example being previewed.
registry.jsonAdd or update two registry items:
registry:ui item named <component> that points at registry/default/ui/<component>.tsx.registry:component item for each atomic example, named <component>-<example-name>-example, that points at registry/default/examples/<component>-<example-name>-example.tsx.Example:
{
"name": "component-name",
"type": "registry:ui",
"title": "Component Name",
"description": "Ink UI Component Name component.",
"files": [
{
"path": "registry/default/ui/component-name.tsx",
"type": "registry:ui",
"target": "components/ui/component-name.tsx"
}
],
"registryDependencies": ["utils", "theme"],
"dependencies": ["@base-ui/react"]
}
Add any actual runtime dependencies and registry dependencies the component uses. After changing registry.json, run pnpm registry:build to regenerate public/r/.
Create content/docs/components/<component>.mdx with this structure:
---
title: ComponentName
description: Short description of what this component does.
component: ComponentName
registry: component-name
---
import { Component, SubComponent } from "registry/default/ui/component-name";
import { ComponentExample } from "registry/default/examples/component-name-default-example";
import componentExampleSource from "registry/default/examples/component-name-default-example.tsx?raw";
import { VariantExample } from "registry/default/examples/component-name-variant-example";
import variantExampleSource from "registry/default/examples/component-name-variant-example.tsx?raw";
import componentSource from "registry/default/ui/component-name.tsx?raw";
<ComponentSection>
<ComponentTabs>
<ComponentPreview name="ComponentExample">
<ComponentExample />
</ComponentPreview>
<ComponentSource
code={componentExampleSource}
language="tsx"
title="component-name-default-example.tsx"
/>
</ComponentTabs>
</ComponentSection>
## Examples
### Variant name
Brief description of what this example demonstrates.
<ComponentSection>
<ComponentTabs>
<ComponentPreview name="VariantExample">
<VariantExample />
</ComponentPreview>
<ComponentSource
code={variantExampleSource}
language="tsx"
title="component-name-variant-example.tsx"
/>
</ComponentTabs>
</ComponentSection>
## Installation
Copy the source code below into your project:
<CodeBlock code={componentSource} language="tsx" />
## API Reference
### Component
<PropsTable component="Component" />
### SubComponent
<PropsTable component="SubComponent" />
Key notes:
src/components/mdx/mdx-components.tsx; do not import ComponentSection, ComponentTabs, ComponentPreview, ComponentSource, CodeBlock, or PropsTable in each page.component and registry frontmatter to connect the doc page to the component and registry item.<ComponentTabs> with <ComponentPreview> and <ComponentSource> for examples.?raw source from its own atomic example file.?raw import to show the full wrapper source.content/docs/components/, not src/pages/.Add entries to src/lib/props-registry.ts for each exported sub-component.
Registry rules:
variant, size, positionerProps) - NOT inherited Base UI props.extends to link to the Base UI API reference for inherited props. Check the Base UI docs for primitive props. The docs link is usually https://base-ui.com/react/components/{componentName}.extends is set but props is empty, the table shows a link to Base UI docs instead of an empty tableExample entry:
MenuItem: {
extends: {
name: "Base UI Menu.Item",
href: "https://base-ui.com/react/components/menu#api-reference",
},
props: [
{
name: "variant",
type: '"default" | "destructive"',
defaultValue: '"default"',
description: "Visual style of the menu item.",
},
],
},
Add the new component slug to content/docs/components/meta.json:
{
"title": "Components",
"pages": ["button", "component-name", "menu"]
}
Keep the list alphabetically sorted.
Run these commands to check the build:
pnpm typegen # Regenerate fumadocs-mdx types if docs content changed
pnpm registry:build
pnpm typecheck # TypeScript validation
pnpm lint
pnpm build
Check the dev server at http://localhost:3000/docs/components/component-name to verify: