Live playground + per-component API reference at sveltastic-ui-docs.
Svelte 5 (runes) + Tailwind v4 component library. 26 components, one barrel import, every visual token overridable with one CSS line.
npm install sveltastic-ui svelte@^5 tailwindcss@^4 @tailwindcss/vite@^4 phosphor-svelte@^3
// vite.config.ts
import tailwindcss from '@tailwindcss/vite';
import { sveltekit } from '@sveltejs/kit/vite';
export default {
plugins: [tailwindcss(), sveltekit()]
};
<!-- src/routes/+layout.svelte -->
<script>
import 'sveltastic-ui/styles';
</script>
Drop this inline script into <head> in src/app.html so the dark theme applies before the first paint — no white flash on dark-mode devices:
<!-- src/app.html, inside <head>, BEFORE %sveltekit.head% -->
<script>
(function () {
try {
var saved = localStorage.getItem('sveltastic-ui:theme');
var resolved =
saved === 'light' || saved === 'dark'
? saved
: window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
? 'dark'
: 'light';
document.documentElement.setAttribute('data-theme', resolved);
} catch (_) {}
})();
</script>
Then call theme.hydrate() once in your root layout onMount so the kit's reactive state reflects the attribute the script already set:
<script>
import { onMount } from 'svelte';
import { theme } from 'sveltastic-ui';
onMount(() => theme.hydrate());
</script>
<script lang="ts">
import { Button, notify, NotificationsHost } from 'sveltastic-ui';
</script>
<NotificationsHost />
<Button
color="primary"
onclick={() => notify({ title: 'Saved', color: 'success' })}
>
Save
</Button>
ButtonGroup)ListItem, ListGroup, ListDivider)CollapseGroup)Tab, TabList, TabPanel)AvatarGroup)notify(...) + <NotificationsHost /> — toast notifications<ScrollbarHost /> — kit-wide auto-hiding scrollbaruse:ripple — material-style click rippleEvery visual constant is a CSS variable in @theme. Rebrand with one rule:
@import 'sveltastic-ui/styles';
:root {
--primary: 21 94 117; /* R G B triplets — enables rgb(var(--primary) / 0.4) */
--radius: 10px;
--background: 250 250 250;
}
[data-theme='dark'] {
--background: 18 18 22;
}
Dark mode: set data-theme="dark" on <html>. The kit picks it up automatically.
color, size, variant, shape, disabled, loading mean the same thing across every component.Card { header }), compound subcomponents (Tabs.Tab), or imperative (notify(...)). Never mixed.createEventDispatcher, no svelte/store, no <svelte:component>. Runes + callback props + actions.import { Button } ships only Button.destroy, every observer disconnects, every timer is cancellable. No leaks at 50 mount/unmount cycles.| Package | Range |
|---|---|
svelte |
^5 |
tailwindcss |
^4 |
phosphor-svelte |
^3 |
MIT © vdgmstd