Vela compiles Tailwind-style class names on your roblox-ts UI into Roblox properties at build time. This page takes an existing roblox-ts project to a working build. No project yet? Start from roblox-ts’s quick start.
Install the packages
Install Vela:
pnpm add vela-rbxtsnpm install vela-rbxtsyarn add vela-rbxtsbun add vela-rbxtsThen the UI library you write JSX with. For React:
pnpm add @rbxts/react @rbxts/react-roblox @rbxts/servicesnpm install @rbxts/react @rbxts/react-roblox @rbxts/servicesyarn add @rbxts/react @rbxts/react-roblox @rbxts/servicesbun add @rbxts/react @rbxts/react-roblox @rbxts/servicesFor Vide instead:
pnpm add @rbxts/vide @rbxts/servicesnpm install @rbxts/vide @rbxts/servicesyarn add @rbxts/vide @rbxts/servicesbun add @rbxts/vide @rbxts/servicesAnd the roblox-ts toolchain:
pnpm add -D roblox-ts typescript@5.9.3 @rbxts/compiler-types @rbxts/typesnpm install -D roblox-ts typescript@5.9.3 @rbxts/compiler-types @rbxts/typesyarn add -D roblox-ts typescript@5.9.3 @rbxts/compiler-types @rbxts/typesbun add -d roblox-ts typescript@5.9.3 @rbxts/compiler-types @rbxts/typesKeep TypeScript on 5.9.3 or 6.x. TypeScript 7 breaks the build (details).
Add this to pnpm-workspace.yaml and reinstall, or the build fails with runtime-not-installed:
publicHoistPattern: - "*@rbxts*"Choose how Vela runs
Vela can run inside rbxtsc as a plugin, or as a separate step before it. Both use the same compiler.
| Transformer | CLI | |
|---|---|---|
| Build command | rbxtsc | vela build && rbxtsc |
| Lowered output | Stays in memory | Written to .vela/src, so you can read it |
| Use it when | rbxtsc is your build | Your toolchain can’t load plugins |
If you’re unsure, pick the transformer.
Option A: the transformer
Add one plugin entry to tsconfig.json:
{ "compilerOptions": { "plugins": [{ "transform": "vela-rbxts/transformer" }] }}Transformer options are covered in the configuration reference.
Option B: the CLI
Point rbxtsc at the tree Vela generates, and register no plugin:
{ "compilerOptions": { "rootDir": ".vela/src", "baseUrl": ".vela/src", "outDir": "out" }, "include": [".vela/src"]}vela build copies src into .vela/src and transforms the .tsx files on the way. Always edit
src. The generated tree is overwritten on every build. See the CLI reference
for every flag.
Declare the className prop
Create this file so TypeScript accepts className on Roblox elements:
import "vela-rbxts";Any file name works except src/vela-rbxts.d.ts, which silently breaks the import.
Add a theme (optional)
Vela works without a config file. To add your own theme values, create vela.config.ts at the
project root (not inside src):
import { defineConfig } from "vela-rbxts";
export default defineConfig({ theme: { extend: { colors: { brand: { 500: "Color3.fromRGB(59, 130, 246)", }, }, }, },});Put your values under theme.extend. A top-level theme.colors replaces the default palette
entirely. The theming guide covers the rest, including defining
tokens in a vela.css file.
Build and check it works
Add a deliberately broken class to any .tsx file:
<frame className="bg-nope-500 p-4" />Then build. With the transformer:
npx rbxtscWith the CLI:
npx vela build && npx vela rbxtsc -p tsconfig.jsonYou should see a warning naming nope-500:
src/client/Smoke.tsx:4:28 - warning TS89000: [@vela-rbxts/compiler] unknown-theme-key: Unknown theme key "nope-500" for background color utility in className literal.If the warning appears, Vela is set up. Delete the file and sync out/ into Studio with Rojo as
usual. No Vela-specific Rojo mapping is needed.
No warning? See Troubleshooting.
Install the editor extension
The build doesn’t catch everything. For example, text-* on a frame compiles cleanly but does
nothing. The language server flags these as you type. In VS Code, install Vela Roblox
IntelliSense:
code --install-extension astra-void.vela-rbxts-lspFor other editors, see Editor setup.
Next steps
- Your first component: build a panel and see what each class compiles to.
- The playground: try class names in the browser, no project needed.
- Vide: what changes when you use Vide instead of React.