Installation
Install Mielui into your project.
Prerequisites
- Svelte 5.56 or newer, with or without SvelteKit
- Tailwind CSS v4
Package import
Install the library and import components from @mielui/svelte.
Copy code
npm i @mielui/svelteyarn add @mielui/sveltebun add @mielui/svelteImport the stylesheet once in src/app.css. It already includes Tailwind, so remove any existing @import 'tailwindcss' line.
@import '@mielui/svelte/ui.css';Use a component:
<script>
import { Button } from '@mielui/svelte';
</script>
<Button>Get started</Button>Compound components expose named parts. Import Dialog and compose Dialog.Root with Dialog.Content and the other parts you need.
CLI source copy
The CLI copies source into your project. The package name is @mielui/svelte; the binary is mielui.
1. Create a project
Skip project creation and Tailwind setup if your app already has both.
Copy code
pnpm dlx sv create my-appnpx sv create my-appyarn dlx sv create my-appbunx sv create my-app2. Add Tailwind v4
Copy code
cd my-app
pnpm dlx sv add tailwindcsscd my-app
npx sv add tailwindcsscd my-app
yarn dlx sv add tailwindcsscd my-app
bunx sv add tailwindcss3. Initialize Mielui
Run this from the project root to create src/lib/mielui/ for styles and utilities, plus mielui.json.
Copy code
pnpm dlx @mielui/svelte init -ynpx @mielui/svelte init -yyarn dlx @mielui/svelte init -ybunx @mielui/svelte init -y4. Import the stylesheet
The copied stylesheet already includes Tailwind. Replace the @import 'tailwindcss' line that the Tailwind setup added.
/* src/app.css */
@import './lib/mielui/ui.css';5. Add components
Copy code
pnpm dlx @mielui/svelte add button
pnpm dlx @mielui/svelte listnpx @mielui/svelte add button
npx @mielui/svelte listyarn dlx @mielui/svelte add button
yarn dlx @mielui/svelte listbunx @mielui/svelte add button
bunx @mielui/svelte list6. Use them
<script>
import { Button } from '$lib/mielui/components/button';
</script>
<Button>Get started</Button>Notes
- Tailwind v3 Not supported. Mielui needs v4
@themeandcolor-mix. - Dark mode Uses a
.darkclass on<html>. - Theme presets Install with
pnpm dlx @mielui/svelte add theme <slug>. Usedefaultfor the default preset.
pnpm add @mielui/svelte