KahwaCSS Documentation

KahwaCSS is a runtime utility engine. It reads kw-* classes directly from your HTML, parses tokens in JavaScript, and applies inline styles without a build step.

Runtime Parser Mutation Aware Single Prefix: kw- Arbitrary Values Supported

Installation

Via CDN

<script src="https://cdn.jsdelivr.net/npm/kahwacss@1.0.4/dist/kahwacss.cdn.min.js"></script>
<script>
  KahwaCSS.init();
</script>

Via NPM

npm i kahwacss

import { initKahwaCSS } from "kahwacss";

initKahwaCSS();

How The Engine Works

Supported Utility Coverage

Default theme color tokens: red blue green pink black white orange gray yellow purple cyan brown slate zinc

Complete Utility Syntax Reference

This table lists the parser-supported syntax patterns and representative outputs.

Utility Syntax Accepts CSS Output Example
kw-block, kw-inline, kw-hidden, kw-flex, kw-grid, kw-tablefixed tokensdisplay: ...kw-grid -> display: grid
kw-visible, kw-invisiblefixed tokensvisibility: visible|hiddenkw-invisible
kw-flex-col, kw-flex-row, kw-flex-wrap, kw-flex-1, kw-flex-nonefixed tokensflex* styleskw-flex-col
kw-items-*, kw-justify-*center/start/end/between/around/evenlyalignItems, justifyContentkw-justify-between
kw-static, kw-relative, kw-absolute, kw-fixed, kw-stickyfixed tokensposition: ...kw-sticky
kw-text-left|center|right|justifyfixed tokenstextAlignkw-text-center
kw-text-xs|sm|base|lg|xl|2xl|3xl|4xl|5xl|6xlpreset size mapfontSizekw-text-3xl -> 30px
kw-text-{color}theme token or arbitrary colorcolorkw-text-gray, kw-text-[#222]
kw-bg-{color}theme token or arbitrary colorbackgroundColorkw-bg-blue, kw-bg-[#ffe88f]
kw-bold, kw-italic, kw-underline, kw-line-through, kw-no-underlinefixed tokensfontWeight, fontStyle, textDecorationkw-italic
kw-uppercase, kw-lowercase, kw-capitalize, kw-normal-casefixed tokenstextTransformkw-uppercase
kw-fs-{n|[value]}number or arbitrary valuefontSizekw-fs-18, kw-fs-[1.125rem]
kw-lh-{n|[value]}number or arbitrary valuelineHeightkw-lh-28
kw-fw-{n}numeric weightfontWeightkw-fw-500
kw-font-{token|[family]}weight token or arbitrary familyfontWeight or fontFamilykw-font-semibold, kw-font-[Inter]
kw-p-*, kw-pt-*, kw-pr-*, kw-pb-*, kw-pl-*, kw-px-*, kw-py-*number, auto, arbitrarypadding*kw-px-6, kw-p-[18px]
kw-m-*, kw-mt-*, kw-mr-*, kw-mb-*, kw-ml-*, kw-mx-*, kw-my-*number, auto, arbitrarymargin*kw-mx-auto, kw-m-[10px]
kw-w-{token}auto/full/screen/fit/min/max, fraction, number, arbitrarywidthkw-w-full, kw-w-1/3, kw-w-[340px]
kw-h-{token}auto/full/screen/fit/min/max, fraction, number, arbitraryheightkw-h-screen, kw-h-[420px]
kw-min-w-*, kw-max-w-*, kw-min-h-*, kw-max-h-*number, full, arbitrarymin/max width/heightkw-max-w-640, kw-min-h-[40vh]
kw-grow-{n}, kw-shrink-{n}numberflexGrow, flexShrinkkw-grow-1
kw-basis-{token}auto/full, fraction, number, arbitraryflexBasiskw-basis-1/2, kw-basis-[280px]
kw-border, kw-border-0fixed tokensborder, borderWidthkw-border
kw-border-{n|[value]}number or arbitrary widthborderWidth (+ solid when numeric)kw-border-2
kw-border-t-*, kw-border-b-*, kw-border-l-*, kw-border-r-*number or arbitrary widthside border width (+ side style when numeric)kw-border-b-1
kw-border-color-{color}theme token or arbitrary colorborderColorkw-border-color-black
kw-rounded, kw-rounded-none|sm|md|lg|xl|2xl|fullfixed tokensborderRadiuskw-rounded-xl
kw-rounded-{n|[value]}number or arbitraryborderRadiuskw-rounded-18, kw-rounded-[22px]
kw-grid-cols-{n|none}number or nonegridTemplateColumnskw-grid-cols-3
kw-grid-rows-{n|none}number or nonegridTemplateRowskw-grid-rows-2
kw-gap-{n|[value]}, kw-gap-x-*, kw-gap-y-*number or arbitrarygap, columnGap, rowGapkw-gap-4, kw-gap-x-[18px]
kw-overflow-hidden|auto|scroll|visiblefixed tokensoverflowkw-overflow-auto
kw-overflow-x-*, kw-overflow-y-*any overflow keywordoverflowX, overflowYkw-overflow-y-scroll
kw-opacity-{n}number 0-100opacity: n / 100kw-opacity-80 -> 0.8
kw-transition, kw-transition-colors, kw-transition-opacity, kw-transition-transformfixed tokenstransition*kw-transition
kw-duration-{n|[value]}number (ms) or arbitrarytransitionDurationkw-duration-300, kw-duration-[1.2s]
kw-top-*, kw-right-*, kw-bottom-*, kw-left-*auto/full, number, arbitraryinset positional propskw-top-2, kw-left-[12px]
kw-z-{n}numberzIndexkw-z-50
kw-aspect-auto|square|videofixed tokensaspectRatiokw-aspect-video
kw-aspect-{w/h}, kw-aspect-[value]fraction, arbitrary, raw tokenaspectRatiokw-aspect-4/3, kw-aspect-[3/2]
kw-object-contain|cover|fill|none|scale-down, kw-object-{value}fixed tokens or custom tokenobjectFitkw-object-cover
kw-pointer-none|auto, kw-pointer-{value}fixed tokens or custom tokenpointerEventskw-pointer-none
kw-cursor-pointer|not-allowed|move|default|textfixed tokenscursorkw-cursor-pointer
kw-list-none|disc|decimalfixed tokenslistStyleTypekw-list-disc
kw-whitespace-normal|nowrap|pre|pre-wrapfixed tokenswhiteSpacekw-whitespace-nowrap
kw-shadow-none|shadow|shadow-sm|shadow-md|shadow-lg|shadow-xlfixed tokensboxShadowkw-shadow-md