Scripts2026年7月3日·1 分钟阅读

shadcn-svelte — shadcn/ui for the Svelte Ecosystem

A Svelte port of shadcn/ui that lets you copy accessible, Tailwind-styled components directly into your SvelteKit project.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
shadcn-svelte
直接安装命令
npx -y tokrepo@latest install c4c53fe4-7695-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

Introduction

shadcn-svelte adapts the shadcn/ui model for Svelte and SvelteKit. Components are copied into your project as source files rather than installed as a package, giving you complete control over markup, styling, and behavior.

What shadcn-svelte Does

  • Ports the shadcn/ui component catalog to Svelte 5 and SvelteKit
  • Uses Bits UI primitives for accessible, headless component logic
  • Styles components with Tailwind CSS and configurable CSS variables
  • Provides a CLI for scaffolding, adding components, and managing dependencies
  • Ships TypeScript definitions for every component and utility

Architecture Overview

Each component wraps a Bits UI primitive (which handles keyboard navigation, ARIA attributes, and focus management) with Tailwind CSS classes. The CLI reads a components.json configuration that specifies paths, style options, and alias settings. Components land in your src/lib/components/ui directory as plain .svelte files you can freely edit.

Self-Hosting & Configuration

  • Run npx shadcn-svelte@latest init in a SvelteKit project to set up configuration
  • The CLI configures Tailwind, path aliases, and component output directories
  • Add components individually or in bulk with the add command
  • Customize themes by overriding CSS variables in your global CSS file
  • Compatible with SvelteKit, Vite, and standard Svelte setups

Key Features

  • Svelte 5 support with runes-based reactivity
  • Full WAI-ARIA compliance through Bits UI primitives
  • Light and dark mode via CSS custom properties
  • No runtime dependency on the library after components are copied
  • Active development tracking the React shadcn/ui component catalog

Comparison with Similar Tools

  • shadcn/ui (React) — the original project; shadcn-svelte mirrors its component set for Svelte
  • shadcn-vue — the Vue port; shadcn-svelte targets Svelte specifically
  • Skeleton UI — Svelte component library installed as a package; shadcn-svelte copies source code
  • Flowbite Svelte — Tailwind component library with Svelte bindings; shadcn-svelte offers code ownership
  • Melt UI — headless Svelte primitives; shadcn-svelte builds styled components on top of Bits UI

FAQ

Q: Does shadcn-svelte require SvelteKit? A: SvelteKit is recommended for the best experience, but components work in any Svelte project with the right build configuration.

Q: How do I update components after copying them? A: Re-run the CLI add command. It will prompt before overwriting existing files.

Q: Can I use shadcn-svelte with Svelte 4? A: The latest version targets Svelte 5. Earlier releases supported Svelte 4, but active development has moved forward.

Q: Is there a Figma design kit? A: The project does not maintain an official Figma kit, but community-contributed design files exist.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产