# WovenUI LLM Guide v2
**For @wovenui/core 2.2 and later.**
**Purpose**: Drop this file into a project so an AI assistant writes correct WovenUI 2.x code.
**Source of truth**: `core/src/styles` (SCSS). When this guide and the source disagree, the source wins.
**Companion docs in the repository**: `core/docs/TOKENS.md` (every token and value, generated), `core/CHANGELOG.md`.
---
## Table of Contents
1. [What WovenUI Is](#what-wovenui-is)
2. [Install and Configure](#install-and-configure)
3. [The Token System](#the-token-system)
4. [token() vs get-color() vs var()](#token-vs-get-color-vs-var)
5. [Theming](#theming)
6. [The Law: Syntax Rules](#the-law-syntax-rules)
7. [Utility Classes](#utility-classes)
8. [Complete Mixin Reference](#complete-mixin-reference)
9. [Configuration Maps and Defaults](#configuration-maps-and-defaults)
10. [Validation and Errors](#validation-and-errors)
11. [Anti-Patterns](#anti-patterns)
12. [Anti-Hallucination Table](#anti-hallucination-table)
13. [Common Patterns](#common-patterns)
---
## What WovenUI Is
WovenUI core is a **human-readable, utility-first SCSS framework** and the foundation layer of the WovenUI design system.
### Philosophy
1. **Human-readable names**: `between` not `justify-between`, `x-center` not `items-center`, `z-modal` not `z-50`, `bg-surface` not `bg-white`.
2. **SCSS only, no JavaScript**: real Sass modules (`@use`), compiled by Dart Sass. No runtime, no HTML scanning, no PostCSS plugin.
3. **`apply()` is the core feature**: every utility is also a mixin, called through `@include apply(...)` with state and breakpoint modifiers.
4. **Design system foundations**: colors, spacing, radii, type, shadows, z-index and motion are design tokens emitted as `--wu-*` CSS custom properties. Classes and mixins output those tokens, so everything follows the active theme.
5. **Config-driven**: every utility class is generated from a configuration map. Custom values are written in SCSS (`p(1.5rem)`), never in HTML.
### Package layers
- `@wovenui/core`: foundations (this guide). SCSS only.
- Component packages build on core and use component variables named with `__` or `--` (see [Naming grammar](#naming-grammar)).
### Three ways to style
```html
Item
```
```scss
@use "@wovenui/core" as *;
// 2. apply(): classes as mixins, plus custom values, states and breakpoints
.card {
@include apply(flex, between, x-center, p(4), bg(surface), text-color(regular), rounded(md), shadow(md) hover, p(6) lg);
}
```
```scss
@use "@wovenui/core" as woven;
// 3. Plain SCSS with tokens and functions
.card {
padding: woven.token(space-4);
background: woven.token(bg-surface);
@include woven.media-up(md) {
padding: woven.token(space-6);
}
}
```
---
## Install and Configure
Requires Dart Sass `>=1.79.0 <2` (peer dependency). Without a bundler that reads the package `sass` export, load it as `@use "pkg:@wovenui/core"` with the Node package importer.
```html
```
### SCSS entry and `with()`
`@use "@wovenui/core"` resolves to `src/styles/index.scss`. Configure once, in the first `@use` of the module, with `with()`.
```scss
@use "@wovenui/core" as * with (
$brand: #4361ee,
$generate-utility-classes: true,
$breakpoints: (
"sm": 640px,
"md": 768px,
"lg": 1024px,
)
);
```
What the entry emits:
| Output | When |
| --- | --- |
| `@layer reset, components` (reset, tooltips) | Always (tooltips follow the `tooltips` flag alone, independent of `$generate-utility-classes`) |
| `@layer base` (base element styles, `.sr-only`) | `base` feature flag on (default), independent of `$generate-utility-classes` |
| `@property` registrations (transform variables, `--wu-gap`, transition group variables) | Always, independent of feature flags |
| Tokens (`:root` fixed block, light block, dark block, inverse blocks, dark fallback, high-contrast twins when set) | `theme` feature flag on (default), independent of `$generate-utility-classes` |
| Utility classes | `$generate-utility-classes: true` (default `false` in `index.scss`) and the feature flag on |
Mixin-only projects keep `$generate-utility-classes: false` and still get every token.
Every compiled entry that `@use`s `@wovenui/core` emits all of the above except the classes (about 42 KB compressed). Load it once, in the global stylesheet.
### Package entries
| Entry | File | Output |
| --- | --- | --- |
| `@wovenui/core` (`sass` condition), `@wovenui/core/scss` | `src/styles/index.scss` | The API plus the CSS in the table above |
| `@wovenui/core/mixins` (`sass` condition) | `src/styles/mixins/index.scss` | The same API (`apply()`, every mixin, `token()`, `get-color()`, variables, maps, `with()` configuration) and no CSS. Mixins used in a rule output their declarations; animation mixins still add their keyframes |
| `@wovenui/core/css`, `@wovenui/core/min.css`, `@wovenui/core` (`style`, `default`) | `dist/wovenui.css`, `dist/wovenui.min.css` | Prebuilt CSS |
| `@wovenui/core/sassdoc.json` | `dist/sassdoc.json` | SassDoc data of every documented mixin, function and variable, for editor tooling (file paths relative to `src/styles`) |
### Component styles (CSS modules, Vue, Svelte, Astro)
Each CSS module or component `