remix/ui/theme
theme provides Remix UI design tokens, theme creation, glyph contracts, and the built-in RMX_01 preset. Use it to install CSS custom properties once and consume typed token references in component styles.
Usage
import { createTheme, theme } from 'remix/ui/theme'
import { css } from 'remix/ui'
let Theme = createTheme({
space: {
none: '0px',
px: '1px',
xs: '2px',
sm: '4px',
md: '8px',
lg: '12px',
xl: '16px',
xxl: '24px',
},
radius: { none: '0px', sm: '4px', md: '8px', lg: '12px', xl: '16px', full: '9999px' },
fontFamily: { sans: 'Inter, sans-serif', mono: 'monospace' },
fontSize: {
xxxs: '10px',
xxs: '11px',
xs: '12px',
sm: '14px',
md: '16px',
lg: '18px',
xl: '20px',
xxl: '28px',
},
lineHeight: { tight: '1.2', normal: '1.5', relaxed: '1.7' },
letterSpacing: { tight: '-0.02em', normal: '0', meta: '0.06em', wide: '0.08em' },
fontWeight: { normal: '400', medium: '500', semibold: '600', bold: '700' },
control: { height: { sm: '28px', md: '32px', lg: '36px' } },
surface: { lvl0: '#fff', lvl1: '#f8fafc', lvl2: '#f5f5f5', lvl3: '#f1f5f9', lvl4: '#e9eef6' },
shadow: { xs: 'none', sm: 'none', md: 'none', lg: 'none', xl: 'none' },
colors: {
text: { primary: '#111827', secondary: '#374151', muted: '#6b7280', link: '#2563eb' },
border: { subtle: '#e5e7eb', default: '#d1d5db', strong: '#9ca3af' },
focus: { ring: '#3b82f6' },
overlay: { scrim: 'rgb(0 0 0 / 0.45)' },
action: {
primary: {
background: '#2563eb',
backgroundHover: '#1d4ed8',
backgroundActive: '#1e40af',
foreground: '#fff',
border: '#2563eb',
},
secondary: {
background: '#fff',
backgroundHover: '#f8fafc',
backgroundActive: '#f1f5f9',
foreground: '#111827',
border: '#d1d5db',
},
danger: {
background: '#dc2626',
backgroundHover: '#b91c1c',
backgroundActive: '#991b1b',
foreground: '#fff',
border: '#dc2626',
},
},
},
})
let card = css({
backgroundColor: theme.surface.lvl0,
color: theme.colors.text.primary,
})
function Layout() {
return (
<body>
<Theme />
<article mix={card}>Project status</article>
</body>
)
}theme.*
theme: typed CSS variable reference contract, such astheme.space.mdandtheme.colors.text.primary.createTheme(values, options?): creates a style component withcssText,selector,values,vars, andStyle.RMX_01: built-in theme component.RMX_01_GLYPHS: built-in glyph sheet component.glyphContractandglyphNames: stable glyph ids and supported glyph names.ThemeValues,ThemeVars,ThemeComponent,ThemeStyleProps,CreateThemeOptions, andThemeMix: public TypeScript types for custom themes.GlyphName,GlyphSymbol, andGlyphValues: public TypeScript types for glyph contracts.
Behavior Notes
themevalues are CSS variable references, not raw token values.createThemeserializes token values into CSS custom properties and renders a<style data-rmx-theme>tag.- The default selector is
:root; passselectorfor scoped themes. - The base reset is included by default, emitted in
rmx-reset, and can be disabled withreset: false. - The built-in components consume this token contract through their style mixins.
- Render
<RMX_01 />and<RMX_01_GLYPHS />once when using the built-in theme and glyph preset.