Examples
Practical examples. Live demos.
Pick an example to open it full screen, with the live preview and its source side by side.
Pick an example to open it full screen, with the live preview and its source side by side.
Create a class from one typed style object.
One style object returns one reusable class.
import 'nuclo' // A theme: named colors (and screens) that css() accepts as values const { css, cx } = createCss({ colors: { primary: "#ff3f00", surface: "#fafafa", border: "#d4d4d4", text: "#222222", muted: "#737373", }, screens: { sm: "(min-width: 520px)", }, }) // css() turns one style object into one reusable class const card = css({ p: 16, rounded: 8, border: "1px solid", borderColor: "border", bg: "surface", color: "text", w: "100%", maxW: 260, }) const quiet = css({ color: "muted", text: 13, lineHeight: "1.5", marginTop: 6 }) // A class is just an argument: pass it to the element export function Card() { return div( card, strong("Simple card"), p(quiet, "One style object returns one reusable class."), ) }