Skip to main content

Starwind UI v3.0 is now available! Migration guide

Vite Svelte Installation

Use Svelte 5.29 or newer within Svelte 5.

Use Node.js 22.12 or newer, or a newer version if your starter requires it. Starwind uses Tailwind CSS 4. Starwind Pro does not yet support Svelte.

Create a Vite Svelte Project

Use the official Vite Svelte starter. Skip this step for an existing app.

Set the Svelte Version

Install a supported Svelte version before running Starwind:

Install with the CLI

Keep the starter’s src/App.svelte and src/main.ts or src/main.js. Your Vite config should use defineConfig({ ... }), with the Svelte plugin listed directly in plugins.

The CLI installs the Svelte package, adds the Tailwind Vite plugin, and imports src/styles/starwind.css from src/main.*. It adds the @ alias to the Vite config and to tsconfig.app.json, so the docs imports such as @/components/starwind/button work. It also adds the theme script plugin to the Vite config. It sets framework: "svelte" in starwind.config.json. Styled files go into src/components/starwind; utilities go into src/lib/utils.

Add and Render Button

src/App.svelte
<script lang="ts">
import { Button } from "./components/starwind/button";
</script>
<Button>Hello from Svelte</Button>

Review starter CSS in src/app.css if it changes page width, button styles, or inherited text. Starwind’s theme styles are in src/styles/starwind.css.

Manual Setup

To set up Starwind by hand, follow Manual Setup and select Svelte for the packages and starwind.config.json. The Svelte package is @starwind-ui/svelte@beta. Use the paths listed above.

Docs examples use @/components/starwind in imports. Keep the Svelte plugin in vite.config.ts, add the Tailwind plugin, and add the @ alias to Vite as shown below. Keep your existing plugins.

vite.config.ts
import { fileURLToPath } from "node:url";
import tailwindcss from "@tailwindcss/vite";
import { svelte } from "@sveltejs/vite-plugin-svelte";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [svelte(), tailwindcss()],
resolve: {
alias: { "@": fileURLToPath(new URL("./src", import.meta.url)) },
},
});

Add "@/*": ["./src/*"] to compilerOptions.paths in tsconfig.app.json. Keep the starter’s other compiler options. Import ./styles/starwind.css from src/main.ts or src/main.js. The CLI handles the Tailwind plugin, the alias, and the stylesheet import when you use init.

Dark Mode

init adds the theme script, so a saved dark theme applies before the first paint. To add a theme control or set up the script by hand, use the Svelte dark mode guide.

Use Svelte Components

See Svelte usage for more examples. On component pages, choose the Svelte tab for installation commands and code you can copy.