What is rbx-css?
rbx-css is a CSS to Roblox StyleSheet compiler that lets you write standard CSS and automatically converts it to Luau modules or.rbxmx model files that create Roblox StyleSheet instances.
Instead of manually creating StyleSheets in Luau, you can leverage the power and familiarity of CSS - complete with design tokens, pseudo-classes, nesting, and modern CSS features.
Installation
Get started with npm, yarn, bun, or pnpm
Quick start
Build your first StyleSheet in under 5 minutes
CSS mapping
Learn how CSS translates to Roblox
CLI reference
Complete command-line interface documentation
Why rbx-css?
Familiar syntax
Use standard CSS you already know - selectors, properties, nesting, and more
Design tokens
Define reusable CSS variables that automatically become StyleSheet attributes
Type-safe output
Compile to Luau modules with full type safety for your Roblox projects
Theme support
Built-in dark mode and theme switching with
data-theme and media queriesWatch mode
Automatically recompile on file changes during development
Pseudo-instances
CSS properties automatically create UICorner, UIStroke, UIPadding, and more
Key features
Smart element mapping
HTML elements are automatically mapped to their Roblox equivalents:Frame, TextButton, and TextLabel rules in your StyleSheet.
Design tokens with CSS variables
Define your design system once, use it everywhere:Color3, UDim, number, or string.
Automatic pseudo-instances
CSS properties that map to Roblox child instances are automatically handled:border-radius→UICornerborder,outline→UIStrokepadding→UIPaddingdisplay: flex→UIListLayoutlinear-gradient()→UIGradienttransform: scale()→UIScale- And more!
Modern CSS features
CSS nesting
CSS nesting
Pseudo-classes
Pseudo-classes
CSS pseudo-classes map to Roblox states:
:hover→:Hover:active→:Press:focus,:disabled→:NonDefault
Combinators
Combinators
Support for child (
>), descendant ( ), and more:Output formats
Luau modules (recommended)
Generates a.luau module that exports a createStyleSheet() factory function:
RBXMX model files
Generates a.rbxmx model file for direct import into Roblox Studio:
Use cases
Roblox UI frameworks
Use rbx-css with UI frameworks like rbx-tsx or Fusion to style your components with familiar CSS syntax.
Design systems
Build and maintain consistent design systems using CSS variables for colors, spacing, and typography.
Next steps
Install rbx-css
Set up rbx-css in your project
Follow the quick start
Create your first StyleSheet