Compose Svelted requires Svelte 5 as a peer dependency and ships as an ES module. The setup has three steps: install the package, import a CSS baseline, and wrap your app with the theme and root providers. The whole process takes about two minutes.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/danielitoCode/compose_svelted/llms.txt
Use this file to discover all available pages before exploring further.
Install the package
Compose Svelted is published to the GitHub npm registry under The package’s only peer dependency is
@danielito1996/compose-svelted. Install it alongside its peer dependency on Svelte 5.svelte ^5.0.0. All other dependencies — including the Tailwind CSS that the library uses internally — are bundled and do not require any configuration from you.Import the CSS baseline
Compose Svelted does not inject any global CSS automatically. You must explicitly import a baseline that establishes the layout contract the library depends on. There are two package exports and one manual fallback to choose from.Option A — Strict baseline (recommended for new projects)The strict baseline (Option B — Safe baseline (recommended for projects with existing styles)The safe baseline (Path B — Manual This satisfies the layout contract that
baseline.css) applies border-box sizing universally, sets html, body, and #app to 100% width and height with no margin or padding, and locks overflow: hidden at the root. This mirrors Jetpack Compose’s model where the viewport is the layout root and scroll is always explicit.baseline-safe.css) applies the same border-box and 100% root sizing but does not lock overflow globally, making it less likely to conflict with existing stylesheets.app.css approach (full control)If you manage your own global stylesheet and want no package-level CSS at all, ensure your app.css includes at minimum:Column, Row, Box, Surface, and Scaffold depend on.Wrap your app with ComposeTheme and AppRoot
ComposeTheme injects Material 3 CSS design tokens (colors, typography, elevation, shapes) into the component tree. AppRoot is the top-level layout container that fills the viewport. Both must be present for the rest of the library to function correctly.ComposeTheme accepts a mode prop with three values:| Value | Behavior |
|---|---|
"system" | Follows the OS light/dark preference via prefers-color-scheme |
"light" | Always uses the light theme |
"dark" | Always uses the dark theme |
light and dark theme objects to override the default Material 3 color scheme:Playground import path
The Compose Svelted playground aliases@danielito1996/compose-svelted directly to the library’s source (src/lib/index.ts) via vite.config.ts. All example code in this documentation uses @danielito1996/compose-svelted as the import path — exactly as it appears when consumed from npm — so playground and production code are identical.