Documentation

Getting Started

Copy and paste beautiful components into your Svelte 5 project. No package to install — you own the code.

Built with shadcn-svelte patterns and bits-ui primitives.

1

Create Project

Set up a new SvelteKit project with Tailwind CSS and shadcn-svelte.

2

Set Up Structure

Create $lib/components/ui folder and add the cn() utility function.

3

Configure Theme

Copy our CSS variables for colors, spacing, and dark mode support.

4

Copy Components

Browse components and copy the ones you need into your project.

Step 1

Installation

Set up a new SvelteKit project with Tailwind CSS and all dependencies.

Option A

New Project (Recommended)

Create a new SvelteKit project with Tailwind CSS and shadcn-svelte:

Terminal
$ npx sv create my-app
$ cd my-app
$ npx sv add tailwindcss
$ npx shadcn-svelte@latest init
$ npm install @lucide/svelte
$ npx shadcn-svelte@latest add --all

This installs all required dependencies: bits-ui, tailwind-variants, clsx, tailwind-merge, and mode-watcher.

or
Option B

Existing Project

Add to an existing SvelteKit project with Tailwind CSS already configured:

Terminal
$ npm install bits-ui clsx tailwind-merge tailwind-variants mode-watcher @lucide/svelte
Reference

Dependencies

These packages are automatically installed by shadcn-svelte init. Here for reference.

bits-ui

Headless UI primitives for accessibility

tailwind-variants

Variant-based styling for components

clsx

Utility for constructing className strings

tailwind-merge

Merge Tailwind classes without conflicts

mode-watcher

Dark mode state management

@lucide/svelte

Beautiful SVG icons used in components

Optional

For Chart Components

If you want to use our Chart components, install LayerCake and D3:

Terminal
$ npm install layercake d3 d3-scale
Optional

For Map Components

If you want to use our Map components, install deck.gl:

Terminal
$ npm install @deck.gl/core @deck.gl/layers @deck.gl/geo-layers
Step 2

Add Utility Function

Create the cn() helper function for merging Tailwind classes.

Create the utils file

Create src/lib/utils.js with the cn() function:

src/lib/utils.js
import { clsx } from 'clsx';
import { twMerge } from 'tailwind-merge';

export function cn(...inputs) {
  return twMerge(clsx(inputs));
}

Project structure

Your project should look like this:

src/
lib/
utils.js
components/
ui/
button/
card/
...
routes/
+page.svelte
+layout.css

Components go in src/lib/components/ui/

Step 3

Configure Theme (Optional)

Add CSS variables for colors and styling. Copy our theme or customize your own.

Theme Variables

Add these CSS custom properties to your layout.css file. We use oklch colors for better color mixing.

@theme {
  --color-background: oklch(1 0 0);
  --color-foreground: oklch(0.145 0 0);
  --color-primary: oklch(0.205 0 0);
  --color-primary-foreground: oklch(0.985 0 0);
  /* ... more colors */
}
Usage

Use components in your code

After copying a component, import and use it like any other Svelte component.

  • Full TypeScript support included
  • Customize styles with Tailwind classes
  • Modify component logic as needed
  • No version lock-in or breaking changes
+page.svelte
<script>
  import { Button } from '$lib/components/elements/button';
  import { Badge } from '$lib/components/elements/badge';
</script>

<div class="p-6 border rounded-lg">
  <h2 class="text-xl font-bold mb-4">Hello</h2>
  <Badge>New</Badge>
  <Button>Click me</Button>
</div>
API

MCP API for AI Assistants

Use our API to search and retrieve component code programmatically. Perfect for AI assistants like Claude Desktop.

2,500+
Components
15+
Design Styles
130+
Categories
8
Endpoints

Lucide Icons API

Search for Lucide icons and get usage examples for Svelte 5. Includes sizing, colors, stroke width, filled styles, and global styling.

Search & Browse Icons

Terminal
# Search for arrow icons
curl "https://sveltoui.dev/api/mcp/lucide?q=arrow"

# Search within a specific category
curl "https://sveltoui.dev/api/mcp/lucide?q=home&category=navigation"

# Get all icon categories
curl "https://sveltoui.dev/api/mcp/lucide?action=categories"

# Get all icons in a category
curl "https://sveltoui.dev/api/mcp/lucide?category=user"

Get Icon Usage

Terminal
# Get detailed usage info for an icon
curl "https://sveltoui.dev/api/mcp/lucide?icon=Home"

# Get Lucide Svelte documentation
curl "https://sveltoui.dev/api/mcp/lucide?action=docs"

Available Categories

arrowscommunicationmediafileseditingnavigationshapesuserdevicesecommercesecurityactionssocialdevelopment

MCP Tools Available

When using SveltoUI via MCP, these Lucide icon tools are available:

search_lucide_icons

Search icons by name or keyword

get_lucide_icon_usage

Get detailed usage info for an icon

get_lucide_categories

List all icon categories

get_lucide_docs

Get Lucide Svelte documentation

Claude Integration

Add SveltoUI as an MCP server to search and retrieve components using natural language.

1

Add SveltoUI MCP Server

Choose the method that works best for you. No authentication required - the API is publicly accessible:

Recommended Claude Code CLI

Run this command in your terminal to add SveltoUI MCP server:

Terminal
claude mcp add -t http -s user sveltoui https://sveltoui.dev/api/mcp/sse
or
Alternative Claude Desktop Config File

Add to your claude_desktop_config.json:

macOS ~/Library/Application Support/Claude/claude_desktop_config.json
Linux ~/.config/Claude/claude_desktop_config.json
Windows %APPDATA%\Claude\claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "sveltoui": {
      "type": "http",
      "url": "https://sveltoui.dev/api/mcp/sse"
    }
  }
}

Note: The SveltoUI MCP API is publicly accessible - no API key or authentication required!

2

Restart Claude

For Claude Desktop, close and reopen the app. For Claude Code CLI, the server is immediately available. You should now see SveltoUI tools available.

Example Prompts for Claude

Once configured, you can ask Claude things like:

Components

"Find me a glassmorphism button component"

"Get the code for a neobrutalism input"

"Suggest components for a landing page"

"Show me cyberpunk-styled cards"

Lucide Icons

"Search for arrow icons in Lucide"

"How do I use the Home icon with a custom size?"

"Show me navigation icons from Lucide"

"How do I add filled style to a Lucide icon?"

Ready to start building?

Browse our component library and start copying components into your project.