예제
실용적인 예제와 라이브 데모.
예제를 선택하면 라이브 미리보기와 소스 코드를 나란히 표시하는 전체 화면이 열립니다.
예제를 선택하면 라이브 미리보기와 소스 코드를 나란히 표시하는 전체 화면이 열립니다.
작은 테마를 정의하고 그 토큰을 가져다 씁니다.
Resize above 520px to use the sm screen rule.
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)", }, }) // "surface", "border" and "primary" are theme tokens; "sm" is a screen, // so its styles apply only above 520px const box = css({ p: 12, rounded: 8, border: "1px solid", borderColor: "border", bg: "surface", color: "text", w: "100%", maxW: 260, sm: { p: 20, borderColor: "primary" }, }) const quiet = css({ color: "muted", text: 13, lineHeight: "1.5", marginTop: 6 }) export function Box() { return div( box, strong("Theme tokens"), p(quiet, "Resize above 520px to use the sm screen rule."), ) }