mcpField
S
shadcn-svelte

shadcn-svelte

github.com/antstanleyデザイン・UI675 回インストール38 週間前に更新
リポジトリ

shadcn-svelte について

Bits UIとTailwind CSSを基盤とする、Svelte 5およびSvelteKit向けのshadcn/ui移植コンポーネントライブラリです。アクセシブルなUIコンポーネントに加え、セットアップ、フォーム、テーマ、利用方法のドキュメントを提供します。

主な機能

  1. 01Svelte 5とSvelteKit向けコンポーネント
  2. 02アクセシブルなUIコンポーネント
  3. 03Bits UIとTailwind CSS
  4. 04CLIによるコンポーネント導入
  5. 05フォームとテーマのガイド

活用シーン

  1. 01SvelteKitのインターフェースを構築
  2. 02ダイアログ、ボタン、カードを追加
  3. 03バリデーション付きフォームを実装
  4. 04テーマとダークモードを設定

インストール

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

$npx skills add https://github.com/antstanley/shadcn-svelte-skill --skill shadcn-svelte

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

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

references/
about.md
changelog.md
cli.md
components-json.md
references/components/
accordion.md
alert-dialog.md
alert.md
aspect-ratio.md
avatar.md
badge.md
breadcrumb.md
button-group.md
button.md
calendar.md
card.md
carousel.md
chart.md
checkbox.md
collapsible.md
combobox.md
command.md
context-menu.md
data-table.md
date-picker.md
dialog.md
drawer.md
dropdown-menu.md
empty.md
field.md
form.md

詳細

shadcn-svelte

shadcn/ui を Svelte 5 / SvelteKit 向けに移植したもので、Bits UI と Tailwind CSS を使って、美しくデザインされたアクセシブルなコンポーネントを提供します。

クイックスタート

インストール
# SvelteKit
pnpm dlx shadcn-svelte@latest init

# Add components
pnpm dlx shadcn-svelte@latest add button card dialog
基本的な使い方

コンポーネントは名前空間インポートを使います。

<script lang="ts">
  import * as Card from "$lib/components/ui/card/index.js";
  import { Button } from "$lib/components/ui/button/index.js";
</script>

<Card.Root>
  <Card.Header>
    <Card.Title>Title</Card.Title>
    <Card.Description>Description</Card.Description>
  </Card.Header>
  <Card.Content>Content here</Card.Content>
  <Card.Footer>
    <Button>Action</Button>
  </Card.Footer>
</Card.Root>

主なパターン

コンポーネントのインポートパターン

import * as Dialog from "$lib/components/ui/dialog/index.js";


import { Button } from "$lib/components/ui/button/index.js";
import { Input } from "$lib/components/ui/input/index.js";
フォームの実装

フォームには Superforms と Formsnap を使います。

<script lang="ts">
  import * as Form from "$lib/components/ui/form/index.js";
  import { superForm } from "sveltekit-superforms";

  let { data } = $props();
  const form = superForm(data.form);
</script>

<form method="POST" use:form.enhance>
  <Form.Field {form} name="email">
    <Form.Control>
      {#snippet children({ props })}
        <Input {...props} type="email" />
      {/snippet}
    </Form.Control>
    <Form.FieldErrors />
  </Form.Field>
</form>
ダークモード

<script lang="ts">
  import { ModeWatcher } from "mode-watcher";
</script>

<ModeWatcher />
{@render children()}

mode-watcher の toggleMode()、setMode("dark")、または resetMode() で切り替えます。

リファレンスドキュメント

詳細なドキュメントは references/ にまとめられています。

  • 概要:about.md、cli.md、components-json.md、theming.md
  • インストール:installation/sveltekit.md、installation/astro.md、installation/vite.md
  • コンポーネント:components/[name].md — 59 件のコンポーネントガイド
  • ダークモード:dark-mode/svelte.md、dark-mode/astro.md
  • 移行:migration/svelte-5.md、migration/tailwind-v4.md
  • レジストリ:registry/getting-started.md — カスタムレジストリの作成
コンポーネントのドキュメントを探す

コンポーネントのドキュメントを確認するには、references/components/[component-name].md を参照してください。

  • Button → references/components/button.md
  • Dialog → references/components/dialog.md
  • Data Table → references/components/data-table.md

よくあるタスク

タスクリファレンス
コンポーネントを追加するpnpm dlx shadcn-svelte@latest add [name]
フォームのバリデーションreferences/components/form.md
データテーブルreferences/components/data-table.md
テーマ/カラーreferences/theming.md
ダークモードreferences/dark-mode/svelte.md
カスタムレジストリreferences/registry/getting-started.md

コメント