# 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`.

~~~~sh
pnpm add @mielui/svelte
~~~~

Import the stylesheet once in `src/app.css`. It already includes Tailwind, so remove any existing `@import 'tailwindcss'` line.

~~~~css
@import '@mielui/svelte/ui.css';
~~~~

Use a component:

~~~~svelte
<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 this and the next step if your app already has Svelte and Tailwind.

~~~~sh
pnpm dlx sv create my-app
~~~~

2. Add Tailwind v4.

~~~~sh
cd my-app
pnpm dlx sv add tailwindcss
~~~~

3. Initialize Mielui from the project root. This creates `src/lib/mielui/` for styles and utilities, plus `mielui.json`.

~~~~sh
pnpm dlx @mielui/svelte init -y
~~~~

4. Import the stylesheet. The copied stylesheet already includes Tailwind, so replace the `@import 'tailwindcss'` line that the Tailwind setup added.

~~~~css
/* src/app.css */
@import './lib/mielui/ui.css';
~~~~

5. Add components.

~~~~sh
pnpm dlx @mielui/svelte add button
pnpm dlx @mielui/svelte list
~~~~

6. Use them.

~~~~svelte
<script>
  import { Button } from '$lib/mielui/components/button';
</script>

<Button>Get started</Button>
~~~~

## Notes

- Tailwind v3 is not supported. Mielui needs v4 `@theme` and `color-mix`.
- Dark mode uses a `.dark` class on `<html>`.
- Built-in theme presets install with `pnpm dlx @mielui/svelte add theme <slug>`. Use `default` to start with the default preset.

## Next

- [Theming](/docs/theming.md): Apply your brand with a preset or your own tokens.
- [Components](/docs/components.md): Browse live examples and APIs.
