mcpField
F
fumadocs-component-docs

fumadocs-component-docs

github.com/theorcdev開発2.1k130 回インストール2 日前に更新
リポジトリ

fumadocs-component-docs について

fumadocs-component-docs は、8-bit コンポーネントのドキュメント作成パターンです。コンポーネントページを整備する開発者向けに、プレビュー、使用例、インポート、Props 表の構成を示します。

主な機能

  1. 01プレビューを先に示すページ構成
  2. 02単純・複合コンポーネントの例
  3. 03インポートとPropsの記載パターン
  4. 04実際的なデータによるバリアント表示
  5. 05統一されたTypeScriptコードブロック

活用シーン

  1. 018-bit Buttonのドキュメント作成
  2. 02複数のサブコンポーネントを持つ要素の説明
  3. 03Propsのバリアントとデータ例の表示

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/theorcdev/8bitcn-ui --skill fumadocs-component-docs

インストール後、Claude Code で/fumadocs-component-docsを入力して読み込まれたか確認します。

詳細

コンポーネントのドキュメント作成パターン

標準的な構成に従って、8ビットコンポーネントの包括的なドキュメントを作成します。

コンポーネントプレビューの構成

リアルなデータを使ったコンポーネントの例をComponentPreviewで囲みます。

<ComponentPreview title="8-bit ComponentName component" name="component-name">
  <div className="md:min-w-[300px] min-w-[200px] flex flex-col gap-8">
    <div>
      <p className="text-sm text-muted-foreground mb-2">
        Description of first variant
      </p>
      <ComponentName prop={value} />
    </div>
    <div>
      <p className="text-sm text-muted-foreground mb-2">
        Description of second variant
      </p>
      <ComponentName prop={value} variant="retro" />
    </div>
  </div>
</ComponentPreview>
シンプルなコンポーネントの例

Buttonのような基本的なコンポーネントの場合:

<ComponentPreview title="8-bit button component" name="button">
  <Button>Button</Button>
</ComponentPreview>
複雑なコンポーネントの例

Sheetのように複数のサブコンポーネントを持つコンポーネントの場合:

<ComponentPreview title="8-bit Sheet component" name="sheet">
  <Sheet>
    <SheetTrigger asChild>
      <Button variant="outline">Open</Button>
    </SheetTrigger>
    <SheetContent>
      <SheetHeader>
        <SheetTitle>Edit profile</SheetTitle>
        <SheetDescription className="text-xs">
          Make changes to your profile here.
        </SheetDescription>
      </SheetHeader>
      <div className="p-4 flex flex-col gap-4">
        <Label>Name</Label>
        <Input placeholder="Project name" />
      </div>
      <SheetFooter className="flex-row-reverse">
        <SheetClose asChild>
          <Button size="sm">Save changes</Button>
        </SheetClose>
      </SheetFooter>
    </SheetContent>
  </Sheet>
</ComponentPreview>
使用方法セクションのパターン

単一のインポート(シンプルなコンポーネント):

```tsx
import { Button } from "@/components/ui/8bit/button"

**Multiple imports** (complex components):

```mdx
```tsx
import {
  Sheet,
  SheetContent,
  SheetDescription,
  SheetHeader,
  SheetTitle,
  SheetTrigger,
} from "@/components/ui/8bit/sheet"

### Props Documentation

For components with props tables, use tables:

```mdx
### Props

| Prop | Type | Default | Description |
|------|------|---------|-------------|
| variant | `string` | `"default"` | Visual style variant |
| size | `string` | `"default"` | Size of the button |
| asChild | `boolean` | `false` | Whether to merge props onto child |
バリアントの例

プレビューで複数のバリアントを表示します。

<ComponentPreview title="8-bit Health Bar component" name="health-bar">
  <div className="md:min-w-[300px] min-w-[200px] flex flex-col gap-8">
    <div>
      <p className="text-sm text-muted-foreground mb-2">
        Default health bar
      </p>
      <HealthBar value={75} />
    </div>
    <div>
      <p className="text-sm text-muted-foreground mb-2">
        Retro health bar
      </p>
      <HealthBar value={45} variant="retro" />
    </div>
  </div>
</ComponentPreview>
コピーコマンドボタン

ComponentPreviewの前に配置します。

<div className="flex flex-col md:flex-row items-center justify-end gap-2 mb-2">
  <CopyCommandButton
    copyCommand="pnpm dlx shadcn@latest add @8bitcn/component-name"
    command="pnpm dlx shadcn@latest add @8bitcn/component-name"
  />
</div>
主な原則
  1. プレビューを先に表示 - 説明の前にコンポーネントを表示します
  2. 複数のバリアント - 異なるプロパティの組み合わせを紹介します
  3. リアルなデータ - 例では意味のある値を使用します
  4. インポートを漏れなく記載 - 使用するインポートをすべて含めます
  5. コードブロックのラベル - TypeScriptには```tsxを使用します
  6. 8ビットコンポーネント - @/components/ui/8bit/からインポートします
  7. 一貫した間隔 - gap-4、p-4、mb-2のパターンを使用します
参考例
  • content/docs/components/button.mdx - シンプルなコンポーネントのパターン
  • content/docs/components/health-bar.mdx - バリアントの例
  • content/docs/components/sheet.mdx - 複雑なサブコンポーネントのパターン

コメント