css() — scoped styles
Create a group of scoped styles with css() and the token helper:
backgroundColor, borderRadius). The token helper resolves to CSS custom properties from your theme.
Token helper
Thetoken namespace is typed against your active theme. Use dot notation for camelCase token names and bracket notation for any token name that contains a hyphen or a shade number.
Raw CSS keywords like
'flex', 'center', '100%', 'inherit', or 'transparent' are passed through literally.
@vertz/theme-shadcn or a custom theme defined with defineTheme()).
Shade color tokens
Color palettes support a full shade scale beyond the semantic tokens. Use bracket notation for the numeric shade:
Shade scale — each namespace supports shades from
50 (lightest) to 950 (darkest):
50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950
The actual color values are defined by your theme. When using palettes from @vertz/ui/css, the Tailwind v4 oklch color palettes are available (slate, gray, zinc, neutral, stone, red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose).
Using palettes in your theme:
Pseudo-state selectors
Use nested&: selectors to apply styles on pseudo-states:
variants() — parameterized styles
Use variants() for components with multiple visual states:
Reactive variants
Variant values can be reactive — the class name updates automatically when the signal changes:When to use css() vs inline styles
Use css() for:
- Layout and spacing (
display: 'flex',padding: token.spacing[4],gap: token.spacing[2]) - Sizing (
width: '100%',height: '100vh') and aspect ratios (aspectRatio: '16 / 9') - Positioning (
position: 'absolute',top: 0,left: token.spacing[4],inset: 0) - Images (
objectFit: 'cover',objectFit: 'contain') - Typography scales (
fontSize: token.font.size.lg,fontWeight: token.font.weight.semibold) - Borders and radius (
borderWidth: '1px',borderColor: token.color.border,borderRadius: token.radius.lg) - Colors from the theme/shade system (
backgroundColor: token.color.primary[600],color: token.color.gray[500]) - Pseudo-states (
&:hover,&:focus,&:disabled)
style for:
- Truly dynamic values computed at runtime (
transform,translate) - Syntax highlight colors or external color values
- Complex CSS that has no token equivalent (gradients,
clamp(),backdrop-filter) - Custom shadows beyond the shadow scale
- CSS custom property references (
var(--my-custom-prop))
Theme
Vertz uses CSS custom properties for theming. The@vertz/theme-shadcn package provides a shadcn/ui-inspired token set with light and dark mode support.
Custom themes
Define your own theme withdefineTheme():
Global styles
For reset styles or global base rules, useglobalCss():
Fonts
Declare font families withfont() and compile them into @font-face CSS, custom properties (--font-<key>), and preload tags with compileFonts(). Only woff2 format is supported.
Multiple font files
Pass an array ofsrc entries for variants like normal + italic:
@font-face block. Only the first file is preloaded.
System fonts (no src)
Omit src to generate a CSS custom property without an @font-face block:
Google Fonts
UsegoogleFont() to declare a Google Font by name. The framework automatically fetches the .woff2 file at dev/build time, caches it locally, and serves it self-hosted. No manual downloads needed.
- Fetches the font from Google Fonts CSS2 API on first startup
- Downloads the
.woff2file to.vertz/fonts/(cached across restarts) - Generates
@font-faceCSS with the local file path - Computes zero-CLS fallback metrics automatically
- Injects
<link rel="preload">tags in SSR
googleFont() options:
Static font with specific weights:
font() alongside googleFont():
font() and googleFont() return the same FontDescriptor type and can be mixed freely in themes:
Google Fonts are all open-source licensed (SIL OFL or Apache 2.0). Self-hosting is explicitly
permitted.
Offline and CI caching
Font files are cached in.vertz/fonts/ and persist across dev server restarts. For CI environments without network access, cache this directory: