Buy me a coffee

Svelte 5Vue 3 · Plain CSS · No Tailwind

Scoped CSS, the way SvelteVue intended.

distill-ui is a set of accessible components you copy into your SvelteVue project and style with a normal <style><style scoped> block: pure CSS, the way it was meant to be written. No utility classes, no :global():deep(), no workarounds.

Why this exists

Component libraries stopped writing CSS.

Most SvelteVue component libraries are built on Tailwind. That works for a lot of people. But if you'd rather write CSS, you're left with headless libraries that render their parts somewhere your scoped styles can't reach. The usual fixes are band-aids, not solutions. distill-ui is for people who want control, clean separation, and scoped SvelteVue styles without the workarounds.

  1. Svelte, used the way it was designedVue, used the way it was designed

    Svelte scopes the CSS in each component for you. distill-ui leans on that instead of working around it: no :global(), no child snippets, no build plugin.Vue scopes the CSS in each component with <style scoped>. distill-ui leans on that instead of working around it: no unscoped style blocks, no :deep() from a wrapper, no build plugin.

  2. Markup in the markup, styles in the style block

    Your template says what the thing is. The style block says what it looks like. Neither one is buried in the other.

  3. Readable by anyone who knows CSS

    background: var(--dui-color-primary) reads like what it does. There is no class vocabulary to learn and nothing to decode.

  4. Yours to change

    Components are copied into your project, not hidden in node_modules. Change a token, set an option from a parent, or rewrite the whole style block.

Readable

No more class soup.

Plain CSS you can read at a glance: one property per line, one rule per state, and nothing extra in your markup. No wall of classes to decode.

Utility classes

A button styled with utility classes
<button
	class="inline-flex items-center justify-center gap-2
	whitespace-nowrap rounded-md text-sm font-medium
	transition-all disabled:pointer-events-none
	disabled:opacity-50 bg-primary text-primary-foreground
	shadow-xs hover:bg-primary/90 h-9 px-4 py-2
	has-[>svg]:px-3 outline-none focus-visible:border-ring
	focus-visible:ring-ring/50 focus-visible:ring-[3px]"
>
	Save
</button>

distill-ui

distill-ui's button, shortened
<button class="button">Save</button>

<style>
	.button {
		height: 2.25rem;
		padding-inline: var(--dui-space-2-5);
		border-radius: var(--dui-radius-md);
		background: var(--dui-color-primary);
		color: var(--dui-color-primary-foreground);

		&:hover {
			background: var(--dui-color-primary-hover);
		}

		&:disabled {
			opacity: 0.5;
		}
	}
</style>
distill-ui's button, shortened
<template>
	<button class="button">Save</button>
</template>

<style scoped>
.button {
	height: 2.25rem;
	padding-inline: var(--dui-space-2-5);
	border-radius: var(--dui-radius-md);
	background: var(--dui-color-primary);
	color: var(--dui-color-primary-foreground);

	&:hover {
		background: var(--dui-color-primary-hover);
	}

	&:disabled {
		opacity: 0.5;
	}
}
</style>

Scoped

Your selector reaches the element.

Headless libraries render each part inside their own components, so Svelte never sees the element your selector is aimed at. The fixes are :global(), which leaks your styles to the whole app, or a child snippet around every part you want to style. distill-ui writes every element in the component's own file, already styled. To change it, update the styles directly in the component's source file.

Headless libraries render each part inside their own components, and teleport menus and dialogs to the end of the page, so a scoped selector often can't reach the element it's aimed at. The fixes are an unscoped <style> block, which leaks your styles to the whole app, or :deep() from a wrapper, which still misses anything teleported. distill-ui writes every element in the component's own file, already styled. To change it, update the styles directly in the component's source file.

Headless library

Styling another library's button
<!-- Workaround 1: leak the style to the
     whole app with :global(). -->
<Button class="save">Save</Button>

<style>
	:global(.save) {
		border-radius: 9999px;
	}
</style>

<!-- Workaround 2: render the button yourself
     with a child snippet, so a scoped .save rule
     reaches it. Repeat everywhere you use one. -->
<Button>
	{#snippet child({ props })}
		<button {...props} class="save">Save</button>
	{/snippet}
</Button>
Styling another library's select menu
<!-- The menu is teleported to <body>, so a
     scoped rule never reaches it. -->
<SelectContent class="menu">...</SelectContent>

<!-- Workaround 1: an unscoped style block,
     which leaks to the whole app. -->
<style>
.menu {
	border-radius: 9999px;
}
</style>

<!-- Workaround 2: :deep() from a wrapper. It only
     reaches parts rendered inside the wrapper,
     so the teleported menu still misses out. -->
<style scoped>
.picker :deep(.menu) {
	border-radius: 9999px;
}
</style>

distill-ui

Styling a distill-ui button
<!-- In your app -->
<Button>Save</Button>

<!-- In button.svelte, which lives in your project -->
<button class="button">
	{@render children?.()}
</button>

<style>
	/* Change the scoped style here. It just works. */
	.button {
		border-radius: 9999px;
	}
</style>
Styling a distill-ui button
<!-- In your app -->
<Button>Save</Button>

<!-- In Button.vue, which lives in your project -->
<template>
	<button class="button">
		<slot />
	</button>
</template>

<style scoped>
/* Change the scoped style here. It just works. */
.button {
	border-radius: 9999px;
}
</style>

Try it

Three variables. Every component.

Colors, corners and spacing are CSS custom properties. Drag a slider and the whole card follows, because every part reads the same tokens.

:root {
	--dui-primary: var(--dui-cyan);
	--dui-radius: 0.625rem;
}
Create an account

Every part of this card is a distill-ui component.

New

20 components

Buttons, forms, dialogs, menus, selects, tabs, toasts and more, with more on the way.

Accessible by default

Native elements where the browser does the job, Melt UIReka UI for dialogs, menus and selects. Checked with axe in light and dark.

Dark mode built in

Follows the system setting, or set it yourself with one attribute on the page.

Restyle from anywhere

Set --dui-button-bg on any parent, in your own scoped CSS, and it just applies.

Start in two commands

npx distill-ui init
npx distill-ui add button dialog

Read the installation guide or copy the files by hand.