DocsStyling
Styling~10 min read

Styling System

Build fully-typed CSS from TypeScript using composable helper functions, the StyleBuilder chain, responsive breakpoints, and pseudo-class support.

Last updated: March 2026·View source on GitHub ↗
01

Overview

Nuclo's styling system generates atomic CSS classes from TypeScript. Write styles as method chains, get a stable class name, and apply it like any other attribute.

button-style.ts
Live preview→ Generated class: n3a7f2b1
02

createStyleQueries()

Creates a style factory bound to a set of named breakpoints. Returns a cn() function you call with one or more StyleBuilder expressions.

createStyleQueries(breakpoints): CnFn
setup.ts
03

StyleBuilder

All style helpers return a StyleBuilder. Every method adds a CSS property and returns the same builder, so you can chain freely. Call cn() to get a stable class name.

bg('white').padding('1rem').borderRadius('8px').fontWeight('600')n3a7f2b1
card.ts
04

Style Helpers

Over 80 helper functions covering every common CSS property. Each one returns a StyleBuilder, so you can start a chain from any helper.

Layout & Spacing

display · position · width · height · margin · padding · gap · zIndex · overflow · boxSizing

Typography

fontSize · fontWeight · fontFamily · lineHeight · letterSpacing · textAlign · textTransform · textDecoration

Visual

bg · color · border · borderRadius · boxShadow · opacity · outline · backgroundImage · gradient

Interaction

cursor · pointerEvents · userSelect · transition · transform · animation · willChange

05

Responsive

Pass a second argument object to cn() with breakpoint keys matching those you declared in createStyleQueries(). Styles merge at each breakpoint.

grid.ts
06

Pseudo-classes

Use the same breakpoint object to apply styles on hover, focus, active, and other pseudo-states. The keys can be any valid CSS pseudo-class or selector.

interactive-card.ts