sveltelean
Version v0.18.0

Three modes

Behavior reads and writes attributes (aria-selected, hidden), never class names, so it works the same in every mode.

ModeYou writeFrom the package
1 · Your own CSSSelectors on data-slean, ARIA and native stateNothing
2 · Package CSSImports, token overridesTokens, base, one file per primitive
3 · Owned stylesA copied stylesheet you editTokens; behavior stays in the package

Mode 1: your own CSS

app.css
/* Mode 1: your own CSS. Target the protocol attributes and platform state directly;
 * nothing from @svelte-lean/styles is required. */
[data-slean='button'] {
	padding: 0.5rem 1rem;
	border: 1px solid currentColor;
	border-radius: 4px;
}

[data-slean='button'][data-variant='outline'] {
	background: transparent;
}

[data-slean='tabs'] [role='tab'][aria-selected='true'] {
	border-bottom: 2px solid currentColor;
}

[data-slean='dialog']::backdrop {
	background: rgb(0 0 0 / 0.4);
}

Mode 2: package CSS

The default, and what this site uses. Import only the files your markup needs.

+layout.svelte
// Mode 2: the package, one file per primitive. tokens.css and base.css are required by every
// primitive file; import only the primitives your markup uses. A file that builds on another
// imports it itself: menu.css brings popover.css, select.css brings control.css.
import '@svelte-lean/styles/tokens.css';
import '@svelte-lean/styles/base.css';
import '@svelte-lean/styles/button.css';
import '@svelte-lean/styles/dialog.css';
import '@svelte-lean/styles/menu.css';
+layout.svelte
// Everything, for a prototype or when most primitives are in use. Not the primary path.
import '@svelte-lean/styles';

Entry points

  • Every primitive file needs tokens.css and base.css; a file that builds on another imports it itself (Imports column).
  • A file imported twice is harmless: a bundler includes it once, and otherwise the copy sits in an earlier layer.
ImportContentsImportsgzipbrotli
@svelte-lean/styles/index.cssEverything below, each file once (convenience entry)(measured with every import resolved)–31502 B25024 B
@svelte-lean/styles/tokens.css--slean-* custom properties: light and dark palettes, aliases, forced colors, reduced motion, coarse pointer–4080 B3400 B
@svelte-lean/styles/base.cssLayer order, a reset scoped to [data-slean] elements, the shared focus ring, icon sizing–669 B563 B
One file per primitive (51 files)
ImportContentsImportsgzipbrotli
@svelte-lean/styles/button.cssbutton (Tier 0)–1025 B871 B
@svelte-lean/styles/dialog.cssdialog (Tier 0, native <dialog>), in three shapes (ADR 0011 §1.4): centered by default; a drawer with data-slean-side="right|left|top|bottom" (physical edges); an alert dialog with role="alertdialog" (narrower, the question and its answers)–1792 B1537 B
@svelte-lean/styles/popover.csspopover (Tier 0, native [popover])–1004 B845 B
@svelte-lean/styles/checkbox.csscheckbox (Tier 0, native <input type="checkbox">), ADR 0011 §1.11–1183 B1001 B
@svelte-lean/styles/checkbox-group.csscheckbox group (Tier 1; the select-all box comes from @svelte-lean/primitives/checkbox-group)–458 B364 B
@svelte-lean/styles/radio-group.cssradio group (Tier 0, native <input type="radio"> sharing a name)–1853 B1615 B
@svelte-lean/styles/tabs.csstabs (Tier 1; keyboard behavior comes from @svelte-lean/primitives/tabs)–908 B745 B
@svelte-lean/styles/menu.cssmenu (Tier 1; roles, keyboard and activation come from @svelte-lean/primitives/menu)popover.css1182 B993 B
@svelte-lean/styles/listbox.csslistbox (Tier 1; keyboard behavior comes from @svelte-lean/primitives/listbox)–918 B747 B
@svelte-lean/styles/control.csscontrol shell (ADR 0007)–2726 B2383 B
@svelte-lean/styles/calendar.csscalendar (Tier 1, role="grid" of day buttons)–1712 B1486 B
@svelte-lean/styles/date-picker.cssdate picker (Tier 2; behavior comes from @svelte-lean/primitives/date-picker)control.css,calendar.css1411 B1225 B
@svelte-lean/styles/input.cssinput (ADR 0011 §1.9)–2876 B2527 B
@svelte-lean/styles/field.cssfield (Tier 0: a layout for a label, a control, a description and an error)–699 B590 B
@svelte-lean/styles/select.cssselectcontrol.css2386 B2105 B
@svelte-lean/styles/rating.cssrating (Tier 0, native <input type="radio"> sharing a name)–983 B794 B
@svelte-lean/styles/slider.cssslider (ADR 0011 §1.12)–1251 B1047 B
@svelte-lean/styles/autocomplete.cssautocompletecontrol.css1010 B867 B
@svelte-lean/styles/accordion.cssaccordion (Tier 0, native <details> items, no wrapper)–970 B817 B
@svelte-lean/styles/card.csscard (Tier 0, <article>)–1208 B1007 B
@svelte-lean/styles/separator.cssseparator (Tier 0, <hr> or role="separator")–285 B219 B
@svelte-lean/styles/avatar.cssavatar (Tier 0, an <img> with initials behind it)–579 B464 B
@svelte-lean/styles/badge.cssbadge (Tier 0, <span> with an optional remove <button>)–922 B763 B
@svelte-lean/styles/kbd.csskbd (Tier 0, native <kbd>)–374 B298 B
@svelte-lean/styles/carousel.csscarousel (Tier 0, scroll snapping and CSS carousels)–979 B839 B
@svelte-lean/styles/alert.cssalert (Tier 0, a message block; role="status" or role="alert" only for a message the application writes after the page loaded)–983 B814 B
@svelte-lean/styles/progress.cssprogress (Tier 0, native <progress>)–865 B723 B
@svelte-lean/styles/meter.cssmeter (Tier 0, native <meter>)–489 B392 B
@svelte-lean/styles/skeleton.cssskeleton (Tier 0, aria-hidden placeholders)–568 B481 B
@svelte-lean/styles/breadcrumb.cssbreadcrumb (Tier 0, <nav> + <ol> + aria-current="page")–647 B532 B
@svelte-lean/styles/nav.cssnav (Tier 0, <nav> + <ul> of links + <details name> groups)–1778 B1521 B
@svelte-lean/styles/pagination.csspagination (Tier 0, <nav> + a list of links + aria-current="page")–967 B824 B
@svelte-lean/styles/steps.csssteps (Tier 0, <ol> + aria-current="step")–1100 B930 B
@svelte-lean/styles/toggle.csstoggle (Tier 1; the click behavior comes from @svelte-lean/primitives/toggle)–915 B766 B
@svelte-lean/styles/toggle-group.csstoggle-group (Tier 1; keyboard and pressing come from @svelte-lean/primitives/toggle-group)–879 B726 B
@svelte-lean/styles/toolbar.csstoolbar (Tier 1; roving focus comes from @svelte-lean/primitives/toolbar)toggle.css,toggle-group.css481 B399 B
@svelte-lean/styles/tree.csstree (Tier 1; keyboard behavior comes from @svelte-lean/primitives/tree)–854 B722 B
@svelte-lean/styles/toast.csstoast (Tier 2; a popover="manual" region with a live list)–1254 B1073 B
@svelte-lean/styles/button-group.cssbutton-group (Tier 0, buttons in role="group")button.css505 B405 B
@svelte-lean/styles/scroll-area.cssscroll-area (Tier 0, a focusable scrolling region)–859 B738 B
@svelte-lean/styles/descriptions.cssdescriptions (Tier 0, a <dl> of label and value pairs)–553 B450 B
@svelte-lean/styles/timeline.csstimeline (Tier 0, <ol> of dated events)–715 B599 B
@svelte-lean/styles/empty.cssempty (Tier 0, an empty state: content with a layout)–687 B583 B
@svelte-lean/styles/splitter.csssplitter (Tier 2; the keyboard and the drag come from @svelte-lean/primitives/splitter)–788 B658 B
@svelte-lean/styles/sortable.csssortable (Tier 2; the drag, keys and buttons come from @svelte-lean/primitives/sortable)–978 B801 B
@svelte-lean/styles/file-drop.cssfile drop (Tier 1; the drag mark, the checks and the file list come from @svelte-lean/primitives/file-drop)–1886 B1640 B
@svelte-lean/styles/hover-card.csshover card (Tier 1 where interest invokers are missing; the card shows on hover or keyboard focus of a trigger)popover.css385 B315 B
@svelte-lean/styles/menubar.cssmenubar (Tier 1; the keys between menus come from @svelte-lean/primitives/menubar)–600 B489 B
@svelte-lean/styles/hint.csshint (Tier 1 attribute primitive; role="tooltip" + popover="manual")–630 B517 B
@svelte-lean/styles/copy.csscopy (Tier 1 attribute primitive; navigator.clipboard.writeText)–361 B279 B
@svelte-lean/styles/findable.cssfindable (Tier 1 attribute primitive; hidden="until-found" + beforematch)–425 B343 B

Sizes from packages/styles/artifacts/size.json (yarn size: minified, gzip level 9, brotli quality 11).bytes = shipped source; minified = comments and redundant whitespace removed by scripts/check.mjs minify (a bundler minifier may be slightly smaller); gzip level 9 and brotli quality 11 of the minified text. standalone = the file with the files it @imports inlined. "index.css (resolved)" inlines every @import once, depth first, and carries the budget.

Layers and specificity

  • Every rule sits in a slean.* cascade layer and every selector in :where(): zero specificity, and import order does not matter.
  • Stylesheets that restyle another primitive (menu on popover, button group, toolbar, context menu, date picker) use slean.compositions, after slean.components; the shared field shell (control.css) sits in slean.components.shell, below the component files.
  • The reset touches only elements with data-slean or data-slean-part; content inside a dialog or a tab panel keeps the page's styles.
button.css (excerpt)
/* Every file starts with the same layer statement, so import order between primitive files
 * does not matter. Every rule sits inside its layer and every selector is wrapped in :where(). */
@layer slean.reset, slean.tokens, slean.base, slean.components, slean.compositions, slean.utilities;

@layer slean.components {
	:where([data-slean='button']) {
		min-block-size: var(--slean-control-height-md);
		border-radius: var(--slean-radius-md);
		background: var(--slean-primary-main);
	}
}

An unlayered rule of yours wins, whatever its specificity: no !important.

app.css
/* An unlayered rule in your application wins over the package, whatever its specificity. */
[data-slean='button'] {
	border-radius: 0;
}

What is not provided

  • No Tailwind dependency, CSS-in-JS or runtime style injection; it works next to Tailwind CSS.
  • No JavaScript and no Provider: a theme is token values (Themes).
  • No positioning engine: CSS anchor positioning, with the platform's default placement where it is unsupported.
  • No fonts: controls inherit the page font; --slean-font-sans is there to opt in.
  • No data-state copies: styles select on :checked, [open], :popover-open and ARIA (Variants).

Source: packages/styles/css · scripts/check.mjs · README