Vela has two parts: a host adapter that decides which files to touch, and a native compiler that turns class names into Roblox properties. The transformer and the CLI share everything in between, so both produce the same Luau.
The pipeline
- A file reaches the adapter. With the transformer,
rbxtscloads the plugin, so plaintsccan’t run it. With the CLI,vela buildwalks your source folder itself. - The adapter skips any file that isn’t
.tsx, is a.d.ts, sits undernode_modules, or has noclassNameand JSX. See the configuration reference for the switches. - The adapter finds the nearest
vela.config.tsorvela.config.jsonabove the file, or uses the default theme. See config discovery. - The compiler resolves each class against your theme and returns new source text and diagnostics.
- The transformer swaps the new text in memory and reports diagnostics through roblox-ts. The CLI
writes the file into
.vela/srcand prints diagnostics itself. It skips unchanged output, sorbxtsc -wisn’t woken for nothing.
A className built in a .ts helper file is invisible to Vela. Keep class strings in .tsx files.
What gets touched
Vela lowers className on eight Roblox host elements:
frame, scrollingframe, canvasgroup, textlabel, textbutton, textbox, imagelabel, imagebutton
It also lowers className on components. A component is any tag that starts with an uppercase
letter, like <Panel />, or a member expression, like <Switch.Root />.
Anything else, such as screengui or a namespaced tag like <svg:rect />, keeps its className
untouched and warns classname-on-unsupported-host.
className on components
<Panel className="p-4 bg-slate-800" /> works like a host element. The resolved properties become
props on the component, className is removed, and helper instances are added as children:
<Box className="bg-slate-700 rounded-md" /><Box BackgroundColor3={Color3.fromRGB(49, 65, 88)}> <uicorner CornerRadius={new UDim(0, 6)} /></Box>If Box doesn’t spread unknown props onto a Roblox element and render its children, the styling is lost. Nothing warns you.
lattice-ui components are built to accept this. See Styling Lattice with Vela for a worked example.
Vela can’t know which host element a component renders. So inside a component’s className, every
utility is allowed, and nothing checks whether text-lg makes sense there.
The two lowering paths
Every element takes one of two paths. The path decides whether anything runs in the game.
Static lowering
This is the default. The compiler resolves every class to a value, writes Roblox properties on the
element, adds helper instances as children, and removes className. Nothing from Vela runs in the
game.
Host elements with a className also start transparent and borderless, so you don’t get Roblox’s
default grey box. That’s preflight. Components are never
preflighted.
The runtime path
When Vela can’t finish at build time, it swaps the element’s tag for VelaRuntimeHost. That host
reads the player’s screen size, input device and hover state in the game, then applies the
matching classes.
The host lives in a shared package, @rbxts/vela-runtime. A file on this path only gains an import
and a config object:
import { createVelaRuntimeHost } from "@rbxts/vela-runtime";const VelaRuntimeHost = createVelaRuntimeHost({ preflight: true, theme: { … }, plugins: { … } });A Vide project imports @rbxts/vela-runtime-vide instead.
What triggers the runtime path
Any one of these is enough:
-
A
classNamethe compiler can’t read. A template literal with an interpolation, a variable, a function call, or a spread. A ternary likea ? "x" : "y"is different: the compiler still resolves and checks both sides, and only the condition is left for the game. -
A variant prefix. Variants depend on the live game, so even a plain string goes this way:
<frame className="w-full sm:w-1/2" /> -
A structural utility. Margins (except
mx-autoandmy-auto),divide-*andanimate-*build extra frames or animation loops at runtime.
transition-* on its own doesn’t trigger the runtime path. With nothing to animate, it warns
transition-without-runtime and is dropped.
Dynamic class names covers what you lose on the runtime path.
Five rules that keep you on the static path
Most “my class did nothing” reports come from an element that quietly took the runtime path.
- Write
classNameas a plain string literal. A literal inside a.map()callback still counts. - Write branches out. Use
[base, on ? "bg-blue-600" : "bg-slate-700"]rather than building a string. Both looks stay checked at build time. - Set changing numbers as props. Use
Size={UDim2.fromScale(health, 1)}and let classes carry the rest. Don’t set the same property with both a class and a prop. The prop wins, and the build warnsexplicit-prop-overrides-class. - Give every element a size. Roblox starts every element at zero size, so a missing
h-*makes it invisible. - Prefer
gap-*to margins. Margins build a wrapper frame, which forces the runtime path. They also add to the parent’s gap.
Variants like hover: are worth the runtime path. A computed string where a plain one would do is
not: the classes still work, but nothing checks them.
Next step
See what Vela deliberately leaves out in Scope and status.