One class = one decision
Each class is a complete visual contract. x-card isn't just "background + border" — it's a self-responsive container with adaptive padding, implicit child styling, and theme integration.
Everything you need to build with Xandra. ~85 classes. Zero JavaScript. One philosophy: constraint breeds consistency.
npm install xandra
Then import in your HTML, build tool, or framework:
<!-- HTML -->
<link rel="stylesheet" href="node_modules/xandra/dist/xandra.css">
/* CSS / PostCSS / Vite */
@import 'xandra';
/* JavaScript bundler */
import 'xandra';
<link rel="stylesheet" href="https://unpkg.com/xandra/dist/xandra.min.css">
<!DOCTYPE html>
<html lang="en" class="x-theme-dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="xandra.css">
</head>
<body class="x-bg-base x-text-primary">
<main class="x-block-1 x-stack x-pad-5">
<h1 class="x-h1">Hello Xandra</h1>
<p class="x-body">You're up and running.</p>
<button class="x-btn">Get Started</button>
</main>
</body>
</html>
Xandra is not a utility framework. It's a standardization contract.
Each class is a complete visual contract. x-card isn't just "background + border" — it's a self-responsive container with adaptive padding, implicit child styling, and theme integration.
You can't write x-flex or x-justify-center. Xandra gives you compositions (x-row, x-between) not CSS property wrappers. Fewer choices, faster decisions.
When you need something outside the standard, you mark it with [ns]. Every deviation is tracked, audited, and eventually promoted into a new standard class.
CSS custom properties, container queries, and modern selectors handle everything. No runtime. No hydration. No bundle size.
All type classes use clamp() for fluid responsive sizing. One class per element — no stacking type classes.
x-display
clamp(2.5rem, 6vw + 1rem, 4.5rem) / 800x-lead — Emphasized intro paragraph
color: secondaryx-body — Standard body text
color: secondaryx-small — Fine print, disclaimers
color: mutedx-caption — Captions, metadata
color: mutedx-label — Labels, smallest text
uppercase / wide trackingx-mono — Monospace content
font-family: mono / 0.9em<h1 class="x-h1">Page Title</h1>
<p class="x-lead">Intro paragraph with larger text.</p>
<p class="x-body">Standard body content.</p>
<p class="x-caption">Posted on March 28, 2026</p>
Flexbox and grid compositions with container queries. Components adapt to their container, not the viewport.
Vertical flex column with gap
display: flex
flex-direction: column
gap: var(--x-space-4)
Horizontal flex with wrap and gap
display: flex
flex-wrap: wrap
align-items: center
gap: var(--x-space-4)
Space-between, stacks below 400px container width
justify-content: space-between
@container (<400px) → column
Center content on both axes
justify-content: center
align-items: center
Responsive grids powered by container queries. Columns collapse based on the container's width, not the viewport.
x-block-1
max-width: 1200px, centered
x-block-prose
max-width: 65ch, optimized for reading
x-block-wide
max-width: 1400px, centered
x-block-full
100% width with inline padding
x-block-2
2-col grid → 1-col below 500px
x-block-3
3-col → 2-col below 768px → 1-col below 500px
x-block-4
4-col → 2-col below 900px → 1-col below 500px
<main class="x-block-1 x-stack x-pad-5">
<div class="x-block-3">
<article class="x-card">...</article>
<article class="x-card">...</article>
<article class="x-card">...</article>
</div>
</main>
x-hidden
display: none
x-sr-only
Visually hidden, accessible to screen readers
All spacing uses CSS custom properties from a 4px base scale. Density modifiers override the entire scale locally.
All sides. x-pad-1 through x-pad-6
Flex/grid gap. x-gap-1 through x-gap-6
Vertical rhythm. x-mt-1 through x-mt-6
Spacing after. x-mb-1 through x-mb-6
One class on a parent. The entire subtree adapts. No size variants needed.
x-dense and x-spacious override the spacing custom properties locally, so every component inside (buttons, cards, gaps, padding) scales automatically.
Standard spacing.
Everything tightens up.
Extra breathing room.
<!-- Apply to any container -->
<div class="x-card x-stack x-dense">
<!-- Everything inside is compact -->
</div>
<!-- Or an entire section -->
<section class="x-spacious">
<!-- All descendants get wider spacing -->
</section>
Density classes override --x-space-1 through --x-space-6 locally. Since every Xandra component uses these tokens for padding, gap, and margin, the entire subtree adapts.
.x-dense {
--x-space-1: 0.125rem; /* 2px instead of 4px */
--x-space-2: 0.25rem; /* 4px instead of 8px */
--x-space-3: 0.5rem; /* 8px instead of 12px */
--x-space-4: 0.75rem; /* 12px instead of 16px */
--x-space-5: 1rem; /* 16px instead of 24px */
--x-space-6: 1.5rem; /* 24px instead of 32px */
}
Semantic color tokens — every color has a purpose. All theme-aware via CSS custom properties.
x-bg-base
Page background
x-bg-surface
Cards, sections
x-bg-elevated
Dropdowns, hovers
x-bg-primary
Primary actions
x-bg-success
Muted green background
x-bg-warning
Muted amber background
x-bg-error
Muted red background
x-text-primary — Main content text
x-text-secondary — Supporting text
x-text-muted — Dimmed, tertiary text
x-text-inverse — Inverted (on primary bg)
x-accent — Interactive/emphasis color
x-text-success — Success state
x-text-warning — Warning state
x-text-error — Error state
x-border-subtlex-borderx-border-strongx-round-sm (4px), x-round-md (8px), x-round-lg (12px), x-round-full (pill)
Theme-aware shadows using --x-shadow-color and --x-shadow-strength
x-overflow-auto
overflow: auto — for scrollable containers
Three variants. Works on <button> and <a> elements.
<button class="x-btn">Primary</button>
<button class="x-btn-ghost">Ghost</button>
<button class="x-btn-outline">Outline</button>
<a class="x-btn" href="/action">Link as button</a>
Self-responsive container. Padding adapts via container queries. Implicit child styling recognizes <header>, <footer>, <p>, and first <img>.
Image goes edge-to-edge. Header and footer are auto-styled.
Use x-card x-stack for vertical layout with gap.
2,847
<!-- Media card — no classes needed on children -->
<article class="x-card">
<img src="photo.jpg" alt="...">
<header>Title</header>
<p>Description text.</p>
<footer>
<button class="x-btn">Save</button>
</footer>
</article>
<!-- Card with explicit classes override implicit styling -->
<article class="x-card">
<p class="x-display">1,247</p> <!-- x-display wins over card's p styling -->
</article>
.x-card > header
h4 size, border-bottom separator
.x-card > footer
caption size, border-top separator, muted color
.x-card > p
body size, relaxed line-height, secondary color
.x-card > img:first-child
Edge-to-edge, negative margins, cover fit
All implicit rules use :not([class]) — adding any class to a child element overrides the implicit styling.
Auto-styled links with aria-current support. No active class needed.
<nav class="x-nav">
<a href="/dashboard" aria-current="page">Dashboard</a>
<a href="/analytics">Analytics</a>
<a href="/reports">Reports</a>
</nav>
Form inputs with focus rings, validation states via HTML5, and autofill theme matching.
<input class="x-input" type="text" placeholder="Your name">
<input class="x-input" type="email" placeholder="you@example.com">
Combine with text color classes. Scales inside headings.
Override --x-accent for custom colors. Supports text initials or img children.
Read the documentation or check the source.
Underlined, accent colored, with hover and focus states.
Inline x-code and block:
npm install xandra
npx xcc check src/
A 1px horizontal separator using the subtle border color.
<div class="x-divider"></div>
Apply a theme class to any container. Themes cascade and nest — you can have a light card inside a dark page.
Default. Deep backgrounds, bright text.
Light backgrounds, dark text.
Night vision green. Tactical.
Maximum contrast for accessibility.
<!-- Set page theme -->
<html class="x-theme-dark">
<!-- Nest themes -->
<div class="x-theme-dark x-bg-base">
<div class="x-theme-light x-bg-base x-card">
This card is light inside a dark page.
</div>
</div>
NS (Non-Standard) is Xandra's deviation tracking system. When you need something outside the ~85 standard classes, you mark it. Every deviation is tracked, audited, and eventually promoted.
No marker needed. This is the Xandra way.
<div class="x-card x-stack">
<h3 class="x-h3">Title</h3>
<p class="x-body">Content</p>
</div>
Single element needs custom CSS. Mark it and explain why.
<div class="x-card" ns
data-ns="needs chart.js canvas">
<canvas id="chart"></canvas>
</div>
Third-party widget — everything inside is non-standard.
<div ns data-ns="Stripe Elements"
data-ns-boundary>
<!-- All children are implicitly ns -->
<div id="stripe-card"></div>
</div>
Visual debugging — highlights all ns elements with reasons.
<!-- Toggle on html or body -->
<html class="x-theme-dark x-audit">
/* Or via JS */
document.documentElement
.classList.toggle('x-audit');
Deviations aren't permanent. When the same ns reason appears across enough files, xcc suggests promoting it to a standard class.
$ npx xcc audit
NS AUDIT (12 elements across 5 files)
"needs chart component" — 7 occurrences
"needs date picker" — 3 occurrences
"stripe integration" — 2 boundaries
$ npx xcc promote
PROMOTION CANDIDATES
1. x-chart — "needs chart component" (7 times, 4 files)
Suggested CSS skeleton generated.
The compiler validates your HTML against the Xandra contract. It catches errors at build time, not in production.
npm install -D xandra-cc
xcc check [path]
Validate HTML against the contract
xcc audit [path]
Analyze ns patterns, suggest new classes
xcc audit --tree
Tree visualization of ns elements
xcc graph [path]
Map parent-child composition patterns
xcc optimize [path]
Tree-shake unused classes from CSS
xcc promote [path]
Find ns patterns ready to standardize
xcc docs [path]
Generate composition documentation
xcc init
Create xandra.config.js
$ npx xcc check src/
xcc v1.1.1 — Xandra Contract Compiler
Scanning 12 files...
ERRORS (1)
src/pages/dashboard.html:47
✕ x-stack + x-row — conflicting layout modes
WARNINGS (2)
src/pages/dashboard.html:52
⚠ x-pad-3 + x-pad-5 — multiple padding values
src/components/chart.html:18
⚠ Non-x- class "chartjs-wrapper" without [ns]
SUMMARY
12 files scanned
3 ns elements (3 with reasons)
1 error, 2 warnings
Every value in Xandra is a CSS custom property. Override them to customize without touching source files.
--x-space-1: 0.25rem /* 4px */
--x-space-2: 0.5rem /* 8px */
--x-space-3: 0.75rem /* 12px */
--x-space-4: 1rem /* 16px */
--x-space-5: 1.5rem /* 24px */
--x-space-6: 2rem /* 32px */
--x-font-sans: system-ui, ...
--x-font-mono: ui-monospace, ...
--x-text-h1: clamp(2rem, 5vw+1rem, 3.5rem)
--x-text-body: clamp(1rem, 0.5vw+0.75rem, 1.125rem)
--x-text-caption: 0.875rem
--x-text-label: 0.75rem
--x-radius-sm: 0.25rem /* 4px */
--x-radius-md: 0.5rem /* 8px */
--x-radius-lg: 0.75rem /* 12px */
--x-radius-full: 9999px
--x-transition-fast: 100ms ease
--x-transition-normal: 150ms ease
--x-transition-slow: 300ms ease
/* Override tokens for your brand */
:root {
--x-font-sans: 'Inter', system-ui, sans-serif;
--x-radius-md: 0.75rem; /* rounder corners */
}
/* Or override per theme */
.x-theme-dark {
--x-bg-primary: hsl(262 83% 58%); /* purple accent */
--x-accent: hsl(262 83% 58%);
}
CSS framework. ~85 classes. Zero JS. Zero dependencies.
Contract compiler. 7 commands. Validates, audits, graphs, promotes.
VSCode extension. Completions, diagnostics, hover docs, ns tracking.
Xandra uses modern CSS features. Minimum browser requirements: