Skip to content

Introduction

WovenUI core is a human-readable, utility-first CSS framework written in SCSS, and the foundation layer of a design system: design tokens, light, dark, inverse and high-contrast themes, utility classes, the same utilities as apply() mixins, and a compiler that stops on mistakes. SCSS goes in, plain CSS comes out, and no JavaScript ships to the browser.

The same card, written three ways. All three render the same, and every value is a --wu-* token, so the card follows the active theme without extra code.

Utility classes in the HTML
<article class="p-4 p-6@md bg-surface text-regular border rounded-lg shadow-sm hover:shadow-md">
<h3 class="text-lg font-semibold">Invoice #1042</h3>
<p class="mt-2 text-muted">Due in 5 days. Hover the card for a deeper shadow.</p>
</article>

Every class is also a mixin. apply() takes them in one call, with the state or breakpoint written after the utility.

@use "@wovenui/core" as *;
.card {
@include apply(p(4), p(6) md, bg(surface), text-color(regular), border(1), rounded(lg), shadow(sm), shadow(md) hover);
}
.card__title {
@include apply(font-size(lg), font(semibold));
}
.card__text {
@include apply(mt(2), text-color(muted));
}
.card {
padding: var(--wu-space-4);
background-color: var(--wu-bg-surface);
color: var(--wu-text-regular);
border-width: var(--wu-border-width-1);
border-style: var(--wu-border-style);
border-color: var(--wu-border-regular);
--wu-border-style: solid;
border-radius: var(--wu-radius-lg);
box-shadow: var(--wu-shadow-sm);
}
.card:hover {
box-shadow: var(--wu-shadow-md);
}
@media (min-width: 768px) {
.card {
padding: var(--wu-space-6);
}
}
.card__title {
font-size: var(--wu-font-size-lg);
font-weight: var(--wu-font-weight-semibold);
}
.card__text {
margin-top: var(--wu-space-2);
color: var(--wu-text-muted);
}

token() returns the custom property for a token name and checks the name at compile time.

@use "@wovenui/core" as *;
.card {
padding: token(space-4);
background-color: token(bg-surface);
color: token(text-regular);
border: token(border-width-1) solid token(border-regular);
border-radius: token(radius-lg);
box-shadow: token(shadow-sm);
&:hover {
box-shadow: token(shadow-md);
}
@include media-up(md) {
padding: token(space-6);
}
}
.card__title {
font-size: token(font-size-lg);
font-weight: token(font-weight-semibold);
}
.card__text {
margin-top: token(space-2);
color: token(text-muted);
}
.card {
padding: var(--wu-space-4);
background-color: var(--wu-bg-surface);
color: var(--wu-text-regular);
border: var(--wu-border-width-1) solid var(--wu-border-regular);
border-radius: var(--wu-radius-lg);
box-shadow: var(--wu-shadow-sm);
}
.card:hover {
box-shadow: var(--wu-shadow-md);
}
@media (min-width: 768px) {
.card {
padding: var(--wu-space-6);
}
}
.card__title {
font-size: var(--wu-font-size-lg);
font-weight: var(--wu-font-weight-semibold);
}
.card__text {
margin-top: var(--wu-space-2);
color: var(--wu-text-muted);
}

Use classes to prototype, apply() for semantic class names in your own stylesheets, and token() where you write plain CSS properties. They share one scale and one set of tokens.

Colors, spacing, radii, type, shadows, z-index and motion are --wu-* custom properties. Theme tokens are redefined per theme, so the same bg-surface is white in light and dark gray in dark.

:root, [data-theme=light] {
--wu-bg-surface: #fff;
--wu-text-regular: #1a1a1a;
}
[data-theme=dark], [data-theme=inverse] {
--wu-bg-surface: #2e2e2e;
--wu-text-regular: #f1f1f1;
}
  • Any element. data-theme="light" or data-theme="dark" re-themes that element and everything inside it.
  • Inverse. data-theme="inverse" is always the opposite of the page: dark on a light page, light on a dark page.
  • Operating system. Leave data-theme off the root and the tokens follow prefers-color-scheme.
  • High contrast. Set $high-contrast-light and $high-contrast-dark with the tokens to change; they apply under data-contrast="high".
One set of classes in three theme sections
Light
Dark
Inverse
<div class="flex wrap gap-4">
<div data-theme="light" class="grow p-4 bg-surface text-regular border rounded-lg">Light</div>
<div data-theme="dark" class="grow p-4 bg-surface text-regular border rounded-lg">Dark</div>
<div data-theme="inverse" class="grow p-4 bg-surface text-regular border rounded-lg">Inverse</div>
</div>

A unitless number is a configured key; a value with a unit is used as written. States and breakpoints follow the utility.

@use "@wovenui/core" as *;
.hero {
@include apply(p(1.5rem), max-width(42rem), rounded(12px), bg(brand-subtle), shadow(md) hover, p(3rem) lg);
}
.hero {
padding: 1.5rem;
max-width: 42rem;
border-radius: 12px;
background-color: var(--wu-brand-subtle);
}
.hero:hover {
box-shadow: var(--wu-shadow-md);
}
@media (min-width: 1024px) {
.hero {
padding: 3rem;
}
}

Core checks keys, colors, tokens and modifiers at compile time. The error names the valid options instead of writing broken CSS.

.card { @include apply(p(7)); }
Error: "p: 7 is not a configured key. Valid keys: 0, 1, 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24, 32, 40, 48, 56, 64. Write a unit for a custom value (7px, 7rem)."
.card { @include apply(bg(primary)); }
Error: "bg(primary): unknown color. Use a role (brand, success, danger, warning, info), a palette name (gray, red, blue, green, yellow, purple, pink), a theme word (base, surface, alternate, raised, hover, selected, disabled), a hex color, a CSS color name, a color function (rgb(), hsl(), hwb(), lab(), lch(), oklab(), oklch(), color(), color-mix(), light-dark()), a keyword (currentcolor, inherit, initial, unset, revert, revert-layer) or var()."

Each CSS module or component <style> block is a separate compile. Load @wovenui/core/mixins there: it has the same apply(), mixins, functions and configuration, and outputs no CSS of its own. Load @wovenui/core once, in the global stylesheet, for the tokens and base styles.

@use "@wovenui/core/mixins" as *;
.card {
@include apply(p(4), p(6) md, bg(surface), text-color(regular), border(1), rounded(lg), shadow(sm), shadow(md) hover);
}
Same .card, compiled through Expanded Compressed
@wovenui/core/mixins 467 bytes 403 bytes
@wovenui/core 49,173 bytes 43,390 bytes

The mixins output is the .card rules shown in apply() and nothing else.

Logical utilities (ps, me, ms-auto, border-start, text-start) write inline-start and inline-end properties, so one rule mirrors with dir="rtl".

The same markup, left to right and right to left
LTR
Inbox 12
RTL
Inbox 12
<div class="flex x-center gap-2 ps-4 py-2 border-s-4 border-brand text-start">
<span>Inbox</span>
<span class="ms-auto">12</span>
</div>
  • Focus ring. Base buttons and fields show an outline on :focus-visible, from the focus tokens.
  • Screen reader text. .sr-only hides text visually and keeps it in the accessibility tree.
  • Contrast. text-on-{role} picks the higher-contrast text color for each role fill, and warns at compile time when it falls below 4.5:1.
@layer base {
button:focus-visible,
input[type=submit]:focus-visible,
input[type=button]:focus-visible,
input[type=reset]:focus-visible {
outline: var(--wu-border-focus-width) solid var(--wu-border-focus);
outline-offset: var(--wu-border-focus-offset);
}
}
<button><svg aria-hidden="true"></svg><span class="sr-only">Close</span></button>

The WovenUI extension for VS Code adds completion, hover documentation, color swatches and diagnostics with quick fixes for apply(), utility classes and tokens, read from the core version installed in your project. See VS Code extension.

/llms-full.txt is the complete WovenUI guide in one file: every mixin, the token system, configuration, errors and a table of wrong and correct names. Drop it into a project so an AI assistant writes valid WovenUI code.

Terminal window
npm install -D sass @wovenui/core

Core requires Sass 1.79 or later, below 2.0. Installation covers loading, configuration and the prebuilt CSS.