
A modern, lightweight utility-first CSS runtime. Write chai-* classes in your markup and let JavaScript convert them to inline styles with zero build step, zero config.
Everything you need to style modern web apps without the overhead of traditional CSS frameworks.
No Webpack, no PostCSS, no CLI. Just import and go. ChaiCoreCSS runs entirely in the browser at runtime.
Tiny footprint, massive power. The entire runtime is under 6KB gzipped with zero dependencies.
Write expressive chai-* classes directly in HTML. Spacing, colors, typography, layout, all covered.
Automatically detects and styles dynamically added DOM elements. Perfect for SPAs and reactive frameworks.
Extend the default theme with custom colors, radii, fonts, and more. Full design-system control.
Use auto-mode for zero-config, or manually control scanning with startChaiCoreCSS, brew, and parse.
Three steps to start using ChaiCoreCSS in any project.
Add ChaiCoreCSS to your project via npm with zero dependencies and a tiny footprint.
$ npm install chaicorecss
One line import. ChaiCoreCSS scans your DOM and applies styles on page load.
import "chaicorecss/auto";
Use intuitive utility classes in your HTML markup. That's literally it!
<div class="chai-flex chai-p-24">
Comprehensive utility groups covering every styling need. Numeric values become pixels automatically.
chai-p-24 → padding: 24px
chai-px-16 → padding-left/right: 16px
chai-mt-12 → margin-top: 12px
chai-gap-10 → gap: 10px
chai-mx-auto → margin-left/right: auto
chai-bg-orange → background: #f97316
chai-bg-blue-dark → background: #1e3a8a
chai-text-white → color: #ffffff
chai-text-green → color: #22c55e
chai-border-red → border-color: #ef4444
chai-text-center → text-align: center
chai-text-18 → font-size: 18px
chai-font-bold → font-weight: 700
chai-font-mono → font-family: monospace
chai-leading-relaxed → line-height: 1.625
chai-uppercase → text-transform: uppercase
chai-flex → display: flex
chai-flex-col → flex-direction: column
chai-grid → display: grid
chai-grid-cols-3 → grid-template-columns: repeat(3, 1fr)
chai-items-center → align-items: center
chai-justify-between → justify-content: space-between
chai-border → border: 1px solid
chai-border-2 → border-width: 2px
chai-rounded-xl → border-radius: 12px
chai-rounded-full → border-radius: 9999px
chai-border-orange → border-color: #f97316
chai-shadow-lg → box-shadow: 0 20px 44px ...
chai-shadow-xl → box-shadow: 0 26px 64px ...
chai-opacity-80 → opacity: 0.8
chai-cursor-pointer → cursor: pointer
chai-transition → transition-property: all
Write HTML with chai-* classes and see them rendered instantly. Hit Run or Ctrl+Enter.
Everything exposed by the chaicorecss package: clean, composable, and well-documented.
Parse a single chai-* class and return support status, category, generated styles, and an ignore reason when unsupported.
import { parseChaiClass } from "chaicorecss";
const result = parseChaiClass("chai-p-24");
// { supported: true, category: "spacing", styles: { padding: "24px" } }
Scans once, applies inline styles, removes supported chai-* classes, stores originals in data-chai-classes.
import { applyChaiStyles } from "chaicorecss";
const report = applyChaiStyles(document);
console.log(report.applied.length, "classes applied");
Runs the first scan and starts a MutationObserver for dynamic DOM updates. Returns a controller.
import { startChaiCoreCSS } from "chaicorecss";
const ctrl = startChaiCoreCSS(document);
ctrl.refresh(); // Re-scan
ctrl.disconnect(); // Stop
Friendly alias for applyChaiStyles. Perfect for re-scanning after dynamic content updates.
import { brew } from "chaicorecss";
brew(document.querySelector("#app"));
Creates a tiny configured instance with parse, apply, and start helpers bound to your custom options.
import { createChaiCoreCSS } from "chaicorecss";
const chai = createChaiCoreCSS({ theme: { colors: { brand: "#0f766e" } } });
chai.start(document);
Zero-config auto mode. Just import and ChaiCoreCSS automatically scans and observes your entire document.
// That's it: one line!
import "chaicorecss/auto";
Add custom colors, radii, fonts, and more. Use them instantly as chai-* classes.
import { startChaiCoreCSS } from "chaicorecss"; startChaiCoreCSS(document, { theme: { colors: { brand: "#0f766e", accent: "#7c3aed", surface: "#1e1b4b", }, radii: { pill: "9999px", }, }, }); // Now use in HTML: // chai-bg-brand, chai-text-accent, // chai-rounded-pill