import { reset } from "@cssints/reset" with { type: "cssints" };
import * as css from "cssints" with { type: "cssints" };
reset();
// Every argument of cn() is known at build time, so the whole call is one class string and no runtime is imported: open the
// Module tab and look for `import`.
const badge = css.cn(
css.flex().alignItems("center").gap(1),
css.padding("0.125rem", "0.625rem"),
css.borderRadius("999px"),
css.bg("#dcfce7"),
css.color("#166534"),
css.fontSize("0.8125rem"),
css.fontWeight(600),
);
const list = css.cn(css.flex().wrap("wrap").gap(2), css.p(4));
export default function App() {
return (
<div className={list}>
{["stable", "beta", "alpha"].map((name) => (
<span className={badge}>{name}</span>
))}
</div>
);
}import * as import csscss from "cssints" with { type: "cssints" };
export const const C: () => anyC = () => (
<IntrinsicElements[string]: anydiv className?: string | undefinedclassName={import csscss.function cn(...styles: css.Style[]): css.Style (+1 overload)Merges styles into one class string. What is known at build time merges (the later property wins); a runtime value
(`on && p(4)`, `props.class`, a state call) is joined when the code runs, and a style in it replaces the classes it
overrides while it is active.cn(import csscss.const flex: css.Layout
() => css.Chain<css.FlexMethods> (+1 overload)
The layout context: sets `display` and chains its container properties.flex().alignItems: <readonly ["center"]>(parts_0: "center") => css.Chain<css.FlexMethods>`normal | stretch | <baseline-position> | [ <overflow-position>? <self-position> ] | anchor-center`. Chrome 29, Edge 12, Firefox 20, Safari 9, iOS 9, Android 29. [MDN](https://developer.mozilla.org/docs/Web/CSS/align-items)alignItems("center").justifyContent: <readonly ["center"]>(parts_0: "center") => css.Chain<css.FlexMethods>`normal | <content-distribution> | <overflow-position>? [ <content-position> | left | right ]`. Chrome 29, Edge 12, Firefox 20, Safari 9, iOS 9, Android 29. [MDN](https://developer.mozilla.org/docs/Web/CSS/justify-content)justifyContent("center"), import csscss.const p: <readonly [4]>(parts_0: 4) => css.Style`<'padding-top'>{1,4}`. Chrome 1, Edge 12, Firefox 1, Safari 1, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/padding)p(4))}>
Hello, world!
</IntrinsicElements[string]: anydiv>
);Output:
export const C = () => <div className="_1s47490 _1ob5z5m _cn8dee _lwugp7">Hello, world!</div>;cn(...) merges styles at build time into one class string. With arguments that are all known at build time nothing is left at runtime and the runtime is not imported.