Xanui Core wraps `oncss` with sane defaults so you can author responsive styles with shorthands, theme references, and CSS-in-JS ergonomics.
css(props, options?)Transforms a style object into an atomic class name. Applies aliases, breakpoint lookups, and theme-token resolution automatically.
The call returns an oncss CSSFactoryType object exposing classname (the generated class) among other metadata.
Built-in aliases (src/css/aliases.ts), all consumable directly as props on Tag:
p, pt, pr, pb, pl, px, py, m, mt, mr, mb, ml, mx, my, gap, radius/borderRadius — numeric values are multiplied by 8 (so px={2} → 16px); string values (including spacing/radius scale keys like "md") pass through as-is or get looked up as a CSS variable.bgcolor, bg, bgimage, color, borderColor — accept a raw CSS color or a theme reference such as "brand.primary", "neutral.500", "paper.ghost.primary" (see ColorsRefTypes in src/theme/types.ts), resolved to var(--color-...) custom properties.flexBox, flexRow, flexColumn, flexWraped, direction ("row" | "column" maps to flexDirection; other values map to the CSS direction property), size, width/minWidth/maxWidth (accept breakpoint keys, resolved to var(--bp-...)).fontSize, fontWeight, lineHeight accept a typography scale key ("xs"…"xl", "h1"…"h6") resolved to var(--fontsize-...)/var(--fontweight-...)/var(--lineheight-...).shadow accepts a scale key ("xs"…"xxl") resolved to var(--shadow-...).border, borderLeft, borderRight, borderTop, borderBottom accept true/false/a number (rendered as ${n}px solid var(--color-divider-primary)) or a raw CSS border string.disabled (via getProps) applies disabled-state styling (pointerEvents: none, dimmed opacity, etc.); spacing (via getProps, numeric only) produces a negative-margin/gap layout used for child spacing.Any value can be suffixed with ! to force !important (e.g. px: '16!').
Refer to src/css/types.ts for the exhaustive Aliases type and src/css/aliases.ts / src/css/getValue.ts / src/css/getProps.ts for the implementation.
tsx
import { css } from 'xanui-core' const pill = css({ display: 'inline-flex', alignItems: 'center', gap: , px: , py: , bgcolor: 'brand.ghost.primary', color: 'brand.primary', '& svg': { flexShrink: },}) export const Pill = (props) => ( <span className={pill.classname} {...props} />)