# Vela > Tailwind-style className compilation for roblox-ts React interfaces. - Docs: https://docs.astra-void.xyz/vela-rbxts/ - Source: https://github.com/astra-void/vela-rbxts # Vela > Tailwind-style className compilation for roblox-ts UI — React or Vide. Source: https://docs.astra-void.xyz/vela-rbxts/ Vela lets you write Tailwind-style classes on roblox-ts UI. At build time it turns them into plain Roblox properties. `p-4` becomes a `UIPadding` child, `rounded-lg` a `UICorner`, and `bg-slate-700` a `BackgroundColor3`. It works with [React](https://github.com/littensy/rbxts-react) by default, and with [Vide](https://docs.astra-void.xyz/vela-rbxts/guides/vide.md) when your `tsconfig.json` compiles Vide JSX. _Interactive preview: Compiled by the real Vela compiler and rendered live. The Classes tab is the source as written; the Lowered tab is what rbxtsc emits._ The Classes tab shows the component as you write it. The Lowered tab shows what ships: Roblox properties and a few helper instances, with no trace of Vela. Every preview in these docs comes from the real compiler. ## What you get A plain string of classes compiles away completely. Only two things add runtime work: a `className` the compiler can't read, and [variants](https://docs.astra-void.xyz/vela-rbxts/guides/responsive-and-input-variants.md) like `hover:` that depend on the player's device. A class Vela can't compile is reported, not dropped quietly. `tracking-wide` warns that Roblox has no letter spacing. A typo in a theme key names the scale it searched. See the [diagnostics reference](https://docs.astra-void.xyz/vela-rbxts/reference/diagnostics.md) for every code. The language server uses the same compiler as the build, so completions, hover and errors match what the build does. See [editor setup](https://docs.astra-void.xyz/vela-rbxts/guides/editor-setup.md). Vela covers what maps onto Roblox: colors, gradients, strokes, corners, padding, gap, sizing, position, flex layout and typography. Anything else is rejected with a warning rather than approximated. See [scope and status](https://docs.astra-void.xyz/vela-rbxts/getting-started/scope-and-status.md). ## Get started Read these in order: 1. [Installation](https://docs.astra-void.xyz/vela-rbxts/getting-started/installation.md): install Vela and confirm it works. 2. [Your first component](https://docs.astra-void.xyz/vela-rbxts/getting-started/first-component.md): build a panel and see what each class compiles to. 3. [How it works](https://docs.astra-void.xyz/vela-rbxts/getting-started/how-it-works.md): the build pipeline, and the two ways a `className` can compile. 4. [Scope and status](https://docs.astra-void.xyz/vela-rbxts/getting-started/scope-and-status.md): what's left out, and the gaps that don't warn. To skip setup, try the [playground](https://docs.astra-void.xyz/vela-playground/). It runs the real compiler in your browser. ## Next - Building something? [Recipes](https://docs.astra-void.xyz/vela-rbxts/guides/recipes.md) has buttons, badges, meters, list rows and a dialog, each with a live preview. - Styling and layout: [theming](https://docs.astra-void.xyz/vela-rbxts/guides/theming.md), [layout and sizing](https://docs.astra-void.xyz/vela-rbxts/guides/layout-and-sizing.md), [colors and surfaces](https://docs.astra-void.xyz/vela-rbxts/guides/colors-and-surfaces.md) and [text and fonts](https://docs.astra-void.xyz/vela-rbxts/guides/text-and-fonts.md). - Using Vide? The [Vide guide](https://docs.astra-void.xyz/vela-rbxts/guides/vide.md) covers every difference. - A class did nothing? [Troubleshooting](https://docs.astra-void.xyz/vela-rbxts/guides/troubleshooting.md) is organized by symptom. - Looking something up? The [utilities reference](https://docs.astra-void.xyz/vela-rbxts/reference/utilities.md) lists every class and the values it accepts. [Configuration](https://docs.astra-void.xyz/vela-rbxts/reference/config.md), [diagnostics](https://docs.astra-void.xyz/vela-rbxts/reference/diagnostics.md) and the [API](https://docs.astra-void.xyz/vela-rbxts/reference/api.md) cover the rest. --- # Installation > Install Vela, wire it into your roblox-ts build, and confirm it works. Source: https://docs.astra-void.xyz/vela-rbxts/getting-started/installation/ 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](https://roblox-ts.com/docs/quick-start). ## Install the packages Install Vela: ```bash pnpm add vela-rbxts ``` Then the UI library you write JSX with. For React: ```bash pnpm add @rbxts/react @rbxts/react-roblox @rbxts/services ``` For [Vide](https://docs.astra-void.xyz/vela-rbxts/guides/vide.md) instead: ```bash pnpm add @rbxts/vide @rbxts/services ``` And the roblox-ts toolchain: ```bash pnpm add -D roblox-ts typescript@5.9.3 @rbxts/compiler-types @rbxts/types ``` Keep TypeScript on 5.9.3 or 6.x. TypeScript 7 breaks the build ([details](https://docs.astra-void.xyz/vela-rbxts/guides/troubleshooting.md#the-build-fails-on-the-first-file-with-compiler-invocation-failed)). > **Using pnpm? Hoist the @rbxts scope** > > Add this to `pnpm-workspace.yaml` and reinstall, or the build fails with `runtime-not-installed`: > > ```yaml title="pnpm-workspace.yaml" > 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`: ```json title="tsconfig.json" { "compilerOptions": { "plugins": [{ "transform": "vela-rbxts/transformer" }] } } ``` Transformer options are covered in the [configuration reference](https://docs.astra-void.xyz/vela-rbxts/reference/config.md). ### Option B: the CLI Point `rbxtsc` at the tree Vela generates, and register no plugin: ```json title="tsconfig.json" { "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](https://docs.astra-void.xyz/vela-rbxts/reference/cli.md) for every flag. ## Declare the `className` prop Create this file so TypeScript accepts `className` on Roblox elements: ```ts title="src/vela-env.d.ts" 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`): ```ts title="vela.config.ts" 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](https://docs.astra-void.xyz/vela-rbxts/guides/theming.md) covers the rest, including defining tokens in a [`vela.css`](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#velacss) file. ## Build and check it works Add a deliberately broken class to any `.tsx` file: ```tsx title="src/client/Smoke.tsx" ``` Then build. With the transformer: ```bash npx rbxtsc ``` With the CLI: ```bash npx vela build && npx vela rbxtsc -p tsconfig.json ``` You should see a warning naming `nope-500`: ```text title="rbxtsc output" 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](https://docs.astra-void.xyz/vela-rbxts/guides/troubleshooting.md#nothing-is-being-transformed-at-all). ## 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**: ```bash code --install-extension astra-void.vela-rbxts-lsp ``` For other editors, see [Editor setup](https://docs.astra-void.xyz/vela-rbxts/guides/editor-setup.md#other-editors). ## Next steps - [Your first component](https://docs.astra-void.xyz/vela-rbxts/getting-started/first-component.md): build a panel and see what each class compiles to. - [The playground](https://docs.astra-void.xyz/vela-playground/): try class names in the browser, no project needed. - [Vide](https://docs.astra-void.xyz/vela-rbxts/guides/vide.md): what changes when you use Vide instead of React. --- # Your first component > Build a small panel with Vela classes and see the Roblox properties and helper instances it compiles to. Source: https://docs.astra-void.xyz/vela-rbxts/getting-started/first-component/ On this page you build a panel with a title and a caption, put it on screen, and see what each class compiled to. _Interactive preview: The panel this page builds, compiled by Vela and rendered in the browser._ The preview is live, not a screenshot. The Classes tab is the code below. The Lowered tab is what the compiler produced. ## The component ```tsx title="src/client/Panel.tsx" import React from "@rbxts/react"; export function Panel() { return ( ); } ``` > **Give every element a size** > > Roblox elements start at zero size. Leave out `h-24` and the panel compiles cleanly but is invisible. Use `w-fit` or `h-fit` to size to content instead. ## Put it on screen Mount it like any `@rbxts/react-roblox` component: ```tsx title="src/client/main.client.tsx" import React from "@rbxts/react"; import { createPortal, createRoot } from "@rbxts/react-roblox"; import { Players } from "@rbxts/services"; import { Panel } from "./Panel"; const playerGui = Players.LocalPlayer.WaitForChild("PlayerGui"); const root = createRoot(new Instance("Folder")); root.render( createPortal( , playerGui, ), ); ``` Vela doesn't lower `screengui`, so put classes on a `frame` inside it. Keep the `.tsx` extension: Vela only transforms `.tsx` files. Build, sync with Rojo, and press play. The panel appears in your place. ## What each class lowers to Some classes set properties on the Frame. The rest become helper instances, because Roblox handles layout, padding, corners and strokes as separate objects. | Class | Result | Value | |---|---|---| | `flex` | `UIListLayout` child, `FillDirection` | `Enum.FillDirection.Horizontal` | | `flex-col` | `UIListLayout.FillDirection` | `Enum.FillDirection.Vertical` | | `gap-4` | `UIListLayout.Padding` | `new UDim(0, 16)` | | `p-4` | `UIPadding` child, all four sides | `new UDim(0, 16)` | | `rounded-lg` | `UICorner.CornerRadius` | `new UDim(0, 8)` | | `bg-slate-800` | `BackgroundColor3` | `Color3.fromRGB(29, 41, 61)` | | `border` | `UIStroke.Thickness` | `1` | | `border-slate-700` | `UIStroke.Color` and `Transparency` | `Color3.fromRGB(49, 65, 88)`, `0` | | `w-80 h-24` | `Size` | `UDim2.fromOffset(320, 96)` | The pixel values are what you get on a 1920×1020 screen. Vela scales them with the player's viewport. See [rem](https://docs.astra-void.xyz/vela-rbxts/guides/theming.md#rem). A few things to notice: - `flex` and `flex-col` share one `UIListLayout`. `flex-col` alone is enough for a column. - Spacing numbers are multiplied by 4 pixels, so `w-80` is 320 pixels. - `w-80` and `h-24` merge into a single `Size`. - `border` sets the thickness. `border-slate-700` sets the color. - On the labels, `text-lg` sets `TextSize`, `text-left` sets `TextXAlignment`, and `text-slate-100` sets `TextColor3`. Vela tells them apart by value, so a misspelled size is reported as an unknown color. ## What comes out Vela removes `className`, writes the resolved properties, and adds helper instances before your own children. Here is the emitted code, with line breaks added: ```tsx title="Transformed output (line breaks added; nothing else changed)" import { createVelaRemScaler, __VelaOpacity } from "@rbxts/vela-runtime"; const __VelaRem = createVelaRemScaler({ base: 16, min: 8, max: 64, baseResolution: { x: 1920, y: 1020 }, }); ``` Some of this isn't in your class list: - `BorderSizePixel` and `BackgroundTransparency` come from [preflight](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#preflight). It stops Roblox drawing its default grey box. The panel keeps its background because `bg-slate-800` paints it. - `SortOrder = LayoutOrder` is added to every layout so `order-*` works. - `__VelaRem.scale` is the viewport scaling. [Pin `theme.rem`](https://docs.astra-void.xyz/vela-rbxts/guides/theming.md#pinning-offsets-back-to-literal-pixels) to get plain numbers instead. The previews in these docs are pinned, which is why their Lowered tab shows plain numbers. - A component's root is also wrapped in `<__VelaOpacity.Fade>`, which isn't shown above. It lets an `opacity-*` on a parent reach this subtree, and creates no instance. Helper instances come before your own children. That doesn't affect layout, but it matters if you index children by position. Everything here was resolved and checked at build time. [How it works](https://docs.astra-void.xyz/vela-rbxts/getting-started/how-it-works.md) explains when that stops being true. ## Something that does not work Vela isn't a full port of Tailwind. Roblox has no letter spacing, so `tracking-*` can't work: ```tsx title="This warns" ``` The build still succeeds, with a warning: ```text title="Compiler output" [@vela-rbxts/compiler] no-roblox-equivalent: Tailwind "tracking" utilities have no Roblox equivalent, so "tracking-wide" is ignored. ``` `p-4` and `bg-slate-800` still apply. Only `tracking-wide` is dropped. A class Vela has never heard of, like a typo, warns `unsupported-utility-family` instead. The [diagnostics reference](https://docs.astra-void.xyz/vela-rbxts/reference/diagnostics.md) lists every warning and how to fix it. ## Next step Read [How it works](https://docs.astra-void.xyz/vela-rbxts/getting-started/how-it-works.md) to see how Vela fits into the build, and when it switches to the runtime path. --- # How it works > What happens to a file during the build, which elements Vela touches, and the two ways a className compiles. Source: https://docs.astra-void.xyz/vela-rbxts/getting-started/how-it-works/ 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](https://docs.astra-void.xyz/vela-rbxts/getting-started/installation.md#choose-how-vela-runs) share everything in between, so both produce the same Luau. ## The pipeline 1. A file reaches the adapter. With the transformer, `rbxtsc` loads the plugin, so plain `tsc` can't run it. With the CLI, `vela build` walks your source folder itself. 2. The adapter skips any file that isn't `.tsx`, is a `.d.ts`, sits under `node_modules`, or has no `className` and JSX. See the [configuration reference](https://docs.astra-void.xyz/vela-rbxts/reference/config.md) for the switches. 3. The adapter finds the nearest `vela.config.ts` or `vela.config.json` above the file, or uses the default theme. See [config discovery](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#discovery). 4. The compiler resolves each class against your theme and returns new source text and diagnostics. 5. The transformer swaps the new text in memory and reports diagnostics through roblox-ts. The CLI writes the file into `.vela/src` and prints diagnostics itself. It skips unchanged output, so `rbxtsc -w` isn't woken for nothing. > **`.ts` files are never transformed** > > 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 ``, or a member expression, like ``. Anything else, such as `screengui` or a namespaced tag like ``, keeps its `className` untouched and warns `classname-on-unsupported-host`. ### `className` on components `` works like a host element. The resolved properties become props on the component, `className` is removed, and helper instances are added as children: ```tsx title="In" ``` ```tsx title="Out (shape, not verbatim)" ``` > **Your component must forward props and children** > > If `Box` doesn't spread unknown props onto a Roblox element and render its children, the styling is lost. **Nothing warns you.** [lattice-ui](https://docs.astra-void.xyz/lattice-ui/index.md) components are built to accept this. See [Styling Lattice with Vela](https://docs.astra-void.xyz/lattice-ui/guides/styling-with-vela.md) 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](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#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: ```ts title="What a runtime-path module emits" import { createVelaRuntimeHost } from "@rbxts/vela-runtime"; const VelaRuntimeHost = createVelaRuntimeHost({ preflight: true, theme: { … }, plugins: { … } }); ``` A [Vide](https://docs.astra-void.xyz/vela-rbxts/guides/vide.md) project imports `@rbxts/vela-runtime-vide` instead. ### What triggers the runtime path Any one of these is enough: - A `className` the compiler can't read. A template literal with an interpolation, a variable, a function call, or a spread. A ternary like `a ? "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: ```tsx ``` - A structural utility. Margins (except `mx-auto` and `my-auto`), `divide-*` and `animate-*` 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](https://docs.astra-void.xyz/vela-rbxts/guides/dynamic-class-names.md) 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. 1. **Write `className` as a plain string literal.** A literal inside a `.map()` callback still counts. 2. **Write branches out.** Use `[base, on ? "bg-blue-600" : "bg-slate-700"]` rather than building a string. Both looks stay checked at build time. 3. **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 warns `explicit-prop-overrides-class`. 4. **Give every element a size.** Roblox starts every element at zero size, so a missing `h-*` makes it invisible. 5. **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](https://docs.astra-void.xyz/vela-rbxts/getting-started/scope-and-status.md). --- # Scope and status > What Vela covers, which Tailwind families are permanently out, and the gaps that don't warn you. Source: https://docs.astra-void.xyz/vela-rbxts/getting-started/scope-and-status/ Vela borrows Tailwind's syntax, not its full scope. It covers what maps onto real Roblox properties and helper instances. Anything it can't express is rejected with a warning. ## What is in scope Classes work on eight host elements: `frame`, `scrollingframe`, `canvasgroup`, `textlabel`, `textbutton`, `textbox`, `imagelabel`, `imagebutton` They also work on your own components, as long as the component forwards what it receives. See [How it works](https://docs.astra-void.xyz/vela-rbxts/getting-started/how-it-works.md#classname-on-components). Any other element, such as `screengui`, keeps its `className` and warns `classname-on-unsupported-host`. On those elements, Vela covers: - Paint: colors with hex and `/N` opacity, gradients, borders, rings, outlines, corner radius, shadows, backdrop blur, and opacity. - Space: padding, margins, gap, `space-*`, `divide-*`, sizing with min and max, position, rotation, scale, aspect ratio, z-index and order. - Layout: flex, grid, visibility, overflow and scrolling. - Text and images: typography and image scaling. - Motion and state: transitions and animations, `hover:`, `active:`, `focus:`, `dark:`, breakpoints, your own attribute variants, and `group-*` / `peer-*`. Most families also accept arbitrary values in brackets. You can add your own utilities with [plugins](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#plugins) or a [`vela.css`](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#velacss). The [utilities reference](https://docs.astra-void.xyz/vela-rbxts/reference/utilities.md) lists everything. Every pixel value scales with the viewport as a [rem unit](https://docs.astra-void.xyz/vela-rbxts/guides/theming.md#rem). The same classes work under [Vide](https://docs.astra-void.xyz/vela-rbxts/guides/vide.md) as under React. ## What is permanently out Some Tailwind families can't be expressed in Roblox UI: letter spacing, filters, 3D transforms, CSS positioning, grid spans, cursors, text indent and more. These warn `no-roblox-equivalent`. That's a design decision, not a roadmap. The [not-implemented table](https://docs.astra-void.xyz/vela-rbxts/reference/utilities.md#not-implemented) says what Roblox is missing for each. A class Vela has never heard of, like a typo, warns `unsupported-utility-family` instead. ## The gaps that do not announce themselves Most mistakes produce a warning. These don't: - **A utility on the wrong element.** `` compiles and writes `TextColor3` onto a Frame. Only the [editor extension](https://docs.astra-void.xyz/vela-rbxts/guides/editor-setup.md) warns. On the runtime path the utility is dropped instead. - **A component that doesn't forward props.** If it doesn't pass unknown props to a host element and render `children`, the styling vanishes. - **A class string only known in game.** Nothing checks `` `bg-${tone}` ``, so a typo there is silent. Theme values that aren't shaped like `Color3.fromRGB(r, g, b)` or `new UDim(a, b)` also fail silently there. See [Dynamic class names](https://docs.astra-void.xyz/vela-rbxts/guides/dynamic-class-names.md). - **`transparent` as a gradient stop.** The stop is dropped, so a two-stop gradient renders as a flat fill. - **A plugin utility that refers back to itself.** It expands to nothing. - **Overlapping children under one `opacity-*`.** They darken where they overlap. Add [`isolate`](https://docs.astra-void.xyz/vela-rbxts/reference/utilities.md#effects) to the parent to fade them as one layer. `divide-transparent` is also refused, while `divide-white/10` works. The [release notes](https://docs.astra-void.xyz/vela-rbxts/reference/release-notes.md#still-open) track every open issue. ## One behavior worth knowing before you write anything > **Elements with a className start transparent** > > Roblox draws every element as a grey box with a border. Vela removes that from any host element with a `className`, so an element with no `bg-*` is invisible. Any `bg-*`, gradient, or background prop of your own brings the background back. `opacity-*` alone doesn't. Elements without a `className`, and components, are left alone. [`preflight: false`](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#preflight) turns this off. ## Release state Every Vela package is at 0.15.0 and versioned together: `vela-rbxts`, the `@vela-rbxts/*` packages, the `@rbxts/vela-runtime*` packages and the VS Code extension. Don't mix versions. The React and Vide runtimes are separate packages, `@rbxts/vela-runtime` and `@rbxts/vela-runtime-vide`, over a shared `@rbxts/vela-runtime-core`. Rojo maps all of `node_modules/@rbxts` into your place, so keeping them apart stops a Vide game from shipping React. Almost nothing is checked at install time. A wrong roblox-ts or TypeScript version, or a missing runtime, fails at build instead. See the [API reference](https://docs.astra-void.xyz/vela-rbxts/reference/api.md) for the version requirements. There are no prebuilt binaries for Windows on ARM or linux arm64 musl. ## A performance note Vela looks for a config for every source file, but loads each config once per folder per build. Keep `vela.config.ts` to a plain `defineConfig` call with literal values. Vela runs it as real code, so avoid extra imports, generated themes and side effects. A `vela.config.json` skips that step, and a `vela.css` is only parsed, never run. ## See also - [How it works](https://docs.astra-void.xyz/vela-rbxts/getting-started/how-it-works.md): the pipeline and the two lowering paths. - [Release notes](https://docs.astra-void.xyz/vela-rbxts/reference/release-notes.md): what changed in each version. - [Diagnostics](https://docs.astra-void.xyz/vela-rbxts/reference/diagnostics.md): every warning code and what triggers it. - [Troubleshooting](https://docs.astra-void.xyz/vela-rbxts/guides/troubleshooting.md): the same gaps, organized by symptom. - [Editor setup](https://docs.astra-void.xyz/vela-rbxts/guides/editor-setup.md): the checks the build doesn't run. --- # Editor setup > Install the VS Code extension, see what the language server does, and connect it to any other editor. Source: https://docs.astra-void.xyz/vela-rbxts/guides/editor-setup/ Vela ships a language server, `vela-rbxts-lsp`, and a VS Code extension that runs it. The server uses the same compiler as your build, so what the editor says about a class is what the build does. ## VS Code Install **Vela Roblox IntelliSense** from the marketplace. It needs VS Code `^1.91.0`. ```bash code --install-extension astra-void.vela-rbxts-lsp ``` Open a `.tsx` or `.ts` file and the server starts. There is nothing to enable per project. ### Settings A change to a `velaRbxts.lsp.*` setting restarts the server for you. The others apply at once. | Prop | Type | Description | | --- | --- | --- | | `velaRbxts.lsp.serverPath` | `string` | Path to a server binary. A relative path is resolved against the workspace root. Defaults to "", meaning auto-resolve. | | `velaRbxts.lsp.trace.server` | `"off" \| "messages" \| "verbose"` | LSP protocol trace written to the extension's output channel. Defaults to "off". | | `velaRbxts.lsp.enabled` | `boolean` | Whether to start the server at all. Defaults to true. | | `velaRbxts.inlayHints.enabled` | `boolean` | Show what each class lowers to as an inlay hint after the class. Defaults to false. | | `velaRbxts.classFunctions` | `string[]` | Helpers whose arguments are class lists wherever they are called, such as ["cn", "cva"]. Defaults to []. | | `velaRbxts.lint` | `Record` | A level per diagnostic code, replacing the default one. Defaults to {}. | | `velaRbxts.validate` | `boolean` | Whether to show Vela diagnostics. Completions, hover and colors keep working when it's off. Defaults to true. | To quiet one check or make another fail loudly, set its code. Every diagnostic shows its code: ```json title=".vscode/settings.json" { "velaRbxts.lint": { "overridden-class": "ignore", "unknown-theme-key": "error" } } ``` ### Commands Run these from the command palette: - **Vela: Restart Language Server** restarts the server and re-reads every `vela.config`, without reloading the window. - **Vela: Show Output** opens the server's output channel. - **Vela: Sort Classes** [sorts the classes](#sorting-class-names) in the active file. ### How the server binary is resolved If `velaRbxts.lsp.serverPath` is set, the extension runs that binary. Otherwise it runs the server bundled for your platform. > **Two platforms have no prebuilt binary** > > Linux arm64 musl and Windows on ARM need a source build. Point `velaRbxts.lsp.serverPath` at the result. The bundled platforms are darwin arm64 and x64, linux x64 gnu and musl, linux arm64 gnu, and win32 x64. There is no `cargo run` fallback, so set `serverPath` when you work on the server itself. ### When your config fails to load If the extension can't load your `vela.config.ts`, it shows a notification naming the file and the reason. Fix the file and save. The notification clears once the config loads. Until then the editor uses the default theme, so your custom keys show as unknown. ## What the language server provides - Completions inside a `className`, triggered by `-`, `:`, `"`, `'` and space. A completion replaces only the segment under the cursor. Some scales list only common values. For example, `opacity-*` suggests round numbers, but any integer from 0 to 100 compiles. - Hover shows what a class resolves to. Scaled offsets read in rem first, such as `1rem (16px at the base viewport)`. If your config [pins rem](https://docs.astra-void.xyz/vela-rbxts/guides/theming.md#pinning-offsets-back-to-literal-pixels), hovers use plain pixels. - Diagnostics as you type. While you're still typing a real key, `unknown-theme-key` waits: `bg-sla` stays quiet on the way to `bg-slate-800`, but `bg-nope` warns at once. - Color swatches in the gutter, editable with the editor's color picker. - Quickfixes for Vela diagnostics: up to three suggested replacements, plus "remove token". - Document highlight for other uses of the token under the cursor. - Inlay hints, off by default. Turn on `velaRbxts.inlayHints.enabled` to see them: ```tsx // ↑ UIPadding.PaddingTop/Right/Bottom/Left // ↑ UICorner.TopLeftRadius, BottomLeftRadius ``` All of these work anywhere a class string can appear in a `className`. That includes a function (how [Vide](https://docs.astra-void.xyz/vela-rbxts/guides/vide.md) writes a dynamic class), template interpolations, `as const`, `satisfies`, string concatenation, and object keys and spreads. They also work on a `const` string that a `className` names, at the place it's declared: ```tsx const base = "px-4 bg-slate-700"; // completed, checked and sorted here ``` The editor reads the same consts the compiler lowers. A `let`, a const declared after the class value, or one inside another function isn't read. A helper called outside a `className`, such as a `cva` recipe at the top of the file, is read only once you list it in `velaRbxts.classFunctions`: ```tsx // with "velaRbxts.classFunctions": ["cva", "tw"] const button = cva("px-4 rounded-md", { variants: { size: { sm: "text-sm", lg: "text-lg" } }, }); const card = tw`p-4 bg-slate-800`; ``` In an object, a key counts as a class list only when its value is a condition, as in `clsx`. In a cva-style map, `defaultVariants` and the variant names in `compoundVariants` are skipped. The server does not provide go-to-definition, references, rename, formatting, semantic tokens or signature help. Your editor uses its TypeScript service for those. > **Some mistakes show up only in the editor** > > `text-*` on a `frame`, `image-*` on a label, and `placeholder-*` outside a `textbox` raise `unsupported-host-utility` in the editor. The build compiles them without complaint and writes the property onto the wrong instance. On a component like ``, the editor can't know which element it renders. It offers every utility there and never raises `unsupported-host-utility`. ### Overridden classes The editor warns when a later class overrides an earlier one. In `bg-red-500 bg-blue-500`, the first class has no effect, so it gets an `overridden-class` warning naming the winner. It's drawn faded, and the quickfix removes it. A repeat like `p-4 p-4` reports `"p-4" is repeated later`. The check uses the compiler's own resolver, so it always agrees with the build: - `px-2 p-4` warns on `px-2`. `p-4 px-2` stays quiet, because `px-2` only overrides part of `p-4`. - `w-4 h-8` and `font-mono font-bold` combine into one property and stay quiet. - `bg-red-500/50 bg-blue-500` warns on `bg-red-500/50`. The solid color also replaces the `/50`. - `opacity-50 opacity-75` and `divide-y divide-red-500/50 divide-blue-500` warn too. - A `bg-*` before a gradient warns and names the gradient. A gradient forces `BackgroundColor3` to white. Only classes under the same condition are compared. `bg-red-500 hover:bg-blue-500` and `md:px-6 max-md:px-3` never warn. `md:hover:` and `hover:md:` count as the same condition. This is an editor-only lint. Builds never report it. ### Arbitrary values with a named class An arbitrary value that lowers exactly like a named class gets a `canonical-class` note at info level, and the quickfix swaps in the name: ```tsx // ↑ w-4 ↑ h-full ``` The named class follows your theme, so a later change to the scale reaches it. Your own theme's steps count: if your spacing scale names `card` as 18 pixels, `px-[18px]` points at `px-card`. Variants are kept, so `hover:w-[16px]` points at `hover:w-4`. ### Sorting class names The source action `source.sortVelaClasses` puts every `className` in the file into a standard order: layout, sizing, spacing, colors, radius, typography, then classes with variant prefixes. ```tsx title="before" ``` ```tsx title="after" ``` Sorting never changes what your classes do: - Classes that can set the same Roblox property keep their order. A `px-4` after `p-2` stays after it. - Variant chains sort by the conditions they name. `hover:md:bg-red-500 md:hover:bg-blue-500` keeps its order because both name the same two conditions. - A longer chain sorts after the shorter one it extends, so `dark:hover:` stays behind `dark:`. `group-*` and `peer-*` sort between `focus:` and `dark:`. It doesn't change your layout either. Whitespace and line breaks stay as written, and so does the whitespace around template interpolations. A class with a space inside brackets, such as `w-[calc(100% - 4px)]`, moves as one class. A class whose bracket never closes is left alone. Run it with **Vela: Sort Classes**, from the source-action menu, or on save: ```json title=".vscode/settings.json" { "editor.codeActionsOnSave": { "source.sortVelaClasses": "explicit" } } ``` To check the order in CI, run [`vela sort --check`](https://docs.astra-void.xyz/vela-rbxts/reference/cli.md#sort). Any LSP client that supports source actions can request the sort by that kind. The same sort is available as `sortClassNames` on `@vela-rbxts/compiler`. It takes `{ source, fileName }` and returns `{ edits: [{ range: { start, end }, text }] }`. ## Other editors The server speaks LSP over stdio and doesn't depend on VS Code. Add it to your project: ```bash pnpm add -D @vela-rbxts/lsp ``` Then set your editor's server command to: ```bash npx --package @vela-rbxts/lsp vela-rbxts-lsp ``` Keep `--package`. The binary is `vela-rbxts-lsp`, but the npm package is `@vela-rbxts/lsp`. A bare `npx vela-rbxts-lsp` finds nothing, because that name belongs to the VS Code extension. Text sync is incremental and positions are UTF-16. The server exits on the `exit` notification even if the client keeps stdin open. ### Pass your config to the server The server never reads `vela.config.ts` itself. Your editor has to evaluate the config and send the result in `initializationOptions`: ```json title="initializationOptions" { "workspaceRoot": "/abs/path/to/project", "configs": [ { "dir": "/abs/path/to/project", "json": "{\"theme\":{\"colors\":{ }}}" } ] } ``` > **A wrong shape fails silently** > > Keep `workspaceRoot` and `configs` as top-level siblings. If the payload doesn't parse, the server uses zero configs and every custom key reports `unknown-theme-key`. Each entry is a directory plus that directory's resolved config as a JSON string. A file uses the config of its nearest containing `dir`, which is how per-package configs in a monorepo work. To update configs after startup, send the custom method `vela-rbxts/setConfigs` with only `configs` in the payload. The VS Code extension does exactly this. It finds every `vela.config.ts`, `vela.config.json` and `vela.css`, evaluates each directory's config through `@vela-rbxts/rbxtsc-host/project-config`, and sends `{ dir, json }` pairs at startup. It sends them again when any of those files or any `.css` file changes, so stylesheets pulled in with `@import` are followed too. Your client can build the JSON any way it likes. It only has to match the resolved `TailwindConfig` shape. The VS Code settings `classFunctions`, `lint` and `validate` go in `initializationOptions` too, with the same names and values. To change them later, send `workspace/didChangeConfiguration` with them under `velaRbxts`. The server re-checks open files when `lint` or `validate` changes. A level it doesn't know is dropped, and the rest of the settings still apply. ### Platform packages The `vela-rbxts-lsp` launcher picks one of six platform packages, installed as optional dependencies: - `@vela-rbxts/lsp-darwin-arm64` - `@vela-rbxts/lsp-darwin-x64` - `@vela-rbxts/lsp-linux-arm64-gnu` - `@vela-rbxts/lsp-linux-x64-gnu` - `@vela-rbxts/lsp-linux-x64-musl` - `@vela-rbxts/lsp-win32-x64-msvc` The launcher also looks for `@vela-rbxts/lsp-linux-arm64-musl` and `@vela-rbxts/lsp-win32-arm64-msvc`, but neither is published. On those platforms, build from source. ## See also - [Configuration](https://docs.astra-void.xyz/vela-rbxts/reference/config.md): the config shape the server expects. - [Diagnostics](https://docs.astra-void.xyz/vela-rbxts/reference/diagnostics.md): every code the editor can show, and which also appear in a build. - [Dynamic class names](https://docs.astra-void.xyz/vela-rbxts/guides/dynamic-class-names.md): the case the editor can't help with, because nothing is reported. --- # Theming > Add your own theme values, extend versus replace, rem scaling, and the defaults. Source: https://docs.astra-void.xyz/vela-rbxts/guides/theming/ Add your theme values to `vela.config.ts` under `theme.extend`. Each value is a roblox-ts expression written as a string: ```ts title="vela.config.ts" import { defineConfig } from "vela-rbxts"; export default defineConfig({ theme: { extend: { colors: { brand: { 500: "Color3.fromRGB(99, 102, 241)", 700: "Color3.fromRGB(67, 56, 202)", }, surface: "Color3.fromRGB(24, 24, 27)", }, radius: { card: "new UDim(0, 10)" }, spacing: { gutter: "new UDim(0, 20)" }, }, }, }); ``` _Interactive preview: bg-surface, rounded-card, p-gutter and bg-brand-500 — all four keys come from the config above._ The preview compiles against that config with [`rem` pinned](#pinning-offsets-back-to-literal-pixels), so one pixel is one pixel. The built-in `text-slate-100` still works because the config extends the defaults instead of replacing them. Open the Lowered tab to see each value pasted in as written. A theme has six axes: `colors`, `radius`, `spacing`, `fontFamily`, `screens` and `rem`. [`plugins`](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#plugins) and [`presets`](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#presets) sit beside `theme`, not inside it. Tailwind keys like `content`, `darkMode`, `prefix`, `safelist` and `variants` are ignored. ## Values are source code, not values Write each value as roblox-ts code inside a string: - Colors: `"Color3.fromRGB(59, 130, 246)"`. - Radius and spacing: `"new UDim(0, 6)"`. This is roblox-ts syntax, not Luau's `UDim.new(0, 6)`. Vela pastes that code into the output it emits. ```ts title="vela.config.ts" export default defineConfig({ theme: { extend: { // correct — a roblox-ts expression, as a string colors: { ink: "Color3.fromRGB(17, 24, 39)" }, radius: { pill: "new UDim(0.5, 0)" }, // wrong — accepted by the config, then fails when roblox-ts compiles it // colors: { ink: "#111827" }, // wrong — not a string, so this throws at config-load time // radius: { pill: 999 }, }, }, }); ``` A number throws when the config loads. **A wrong string is never rejected.** Vela uses the first expression that parses and silently drops the rest: - `"#3b82f6"` becomes the string literal `"#3b82f6"`, a type error on the next build. - `"#a1b2c3"` is emitted as a bare `#a1b2c3`, because `#` followed by a letter is valid TypeScript. - `"Color3.fromRGB(1, 2, 3) // blue"` loses the comment, and `"foo bar"` becomes `foo`. > **Use exactly two shapes** > > Write colors as `Color3.fromRGB(r, g, b)` and UDims as `new UDim(a, b)`, with plain numbers. Classes resolved in-game re-read the theme with parsers that accept only these, and anything else silently breaks there. ### Or write the tokens as CSS A [`vela.css`](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#velacss) file takes the values a design tool gives you and converts them: ```css title="vela.css" @theme { --color-brand-500: #3b82f6; --radius-card: 12px; --spacing-gutter: 20px; } ``` `#3b82f6` becomes `Color3.fromRGB(59, 130, 246)`, and `12px` becomes `new UDim(0, 12)`. A value it can't read, like `hotpink`, is a build error instead of a silent mistake. A stylesheet only extends the theme. If you also have a `vela.config.ts`, the stylesheet applies on top of it. Keep `rem`, `framework` and anything that needs logic in the config file. ## Extend merges, top-level replaces - `theme.extend.colors` adds to the defaults. Your keys win on a collision. - `theme.colors` replaces the whole scale. All 28 built-in color families are gone. Colors merge shade by shade. Extending `blue` with only a `400` keeps the other ten shades. > **Don't set both theme.colors and theme.extend.colors** > > With a top-level `theme.colors`, Vela silently ignores `theme.extend.colors`, so your added colors fail with `unknown-theme-key`. Every axis works this way, unlike Tailwind, which applies both. ```ts title="vela.config.ts" // Do not do this — `brand` never resolves, and every built-in palette is dropped. export default defineConfig({ theme: { colors: { surface: "Color3.fromRGB(24, 24, 27)" }, extend: { colors: { brand: { 500: "Color3.fromRGB(99, 102, 241)" } }, }, }, }); ``` Use a top-level scale only when you want to start from empty, such as a locked-down design system where `bg-slate-700` should be an error. ## Rem Pixel sizes in Vela scale with the screen. `p-4`, `w-40`, `rounded-lg` and `text-sm` are rem units, not raw pixels. One rem is 16px at 1920×1020 and scales from there. It's on by default, with nothing to mount. ```ts title="vela.config.ts — the defaults, written out" export default defineConfig({ theme: { rem: { base: 16, min: 8, max: 64, baseResolution: { x: 1920, y: 1020 }, }, }, }); ``` The curve follows [Littensy's rem provider](https://github.com/littensy/slither/blob/main/src/client/providers/rem-provider.tsx). It compares the viewport diagonal with `baseResolution`, caps the width at 19:9 so ultrawide screens don't inflate it, eases off in portrait, then rounds and clamps to `[min, max]`. `theme.rem` and `theme.extend.rem` do the same thing: both merge field by field. > **Layouts change size on other screens** > > A layout tuned at 1920×1080 grows or shrinks on other viewports. To keep literal pixels, [pin the clamp](#pinning-offsets-back-to-literal-pixels). ### What rem does not touch Fractions like `w-full`, `h-1/2` and `translate-x-1/2` stay fractions of the parent. Colors, alignment, `LayoutOrder` and `ZIndex` have no pixels in them. `TextSize` scales, but stops at 100, the most Roblox honors. ### Pinning offsets back to literal pixels Set `min` and `max` to the `base` value: ```ts title="vela.config.ts" export default defineConfig({ theme: { rem: { min: 16, max: 16 } }, }); ``` Every viewport now gets the same rem, and Vela emits plain pixel values with no scaling code: ```tsx title='className="p-4 w-40" with the clamp closed' ``` Pinning to any other value still scales, so the scaling code stays. Anything inside a `SurfaceGui` or `BillboardGui` is already pinned, because those take their size from a part, not the screen. Change that list with [`rem.pinnedUnder`](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#rem). A container your JSX doesn't create needs the closed clamp above. ### What the emit looks like Without the pin, each offset is wrapped in a scaler that updates when the viewport changes: ```tsx title='className="p-4 w-40" with rem active' import { createVelaRemScaler } from "@rbxts/vela-runtime"; const __VelaRem = createVelaRemScaler({ base: 16, min: 8, max: 64, baseResolution: { x: 1920, y: 1020 } }); ``` The number after each value is a slot: one binding per scaled offset. `TextSize` goes through `scaleText`, which applies the 100 cap. An element on the runtime host scales the same props in-game instead. ## Semantic colors and shade palettes A color is either a literal, one expression used as-is, or a palette keyed by shade from `50` to `950`. A palette only needs the shades you use. Add a `DEFAULT` key so the bare family name works, as in `bg-brand`. Every built-in palette has one, equal to its `500`. Write `bg-brand`, not `bg-brand-DEFAULT`, which reports `unknown-theme-key`. ```ts title="vela.config.ts" theme: { extend: { colors: { // literal — used as `bg-surface`, with no shade surface: "Color3.fromRGB(24, 24, 27)", // palette — used as `bg-brand-500`, or bare `bg-brand` for the DEFAULT brand: { DEFAULT: "Color3.fromRGB(99, 102, 241)", 500: "Color3.fromRGB(99, 102, 241)", 700: "Color3.fromRGB(67, 56, 202)", }, }, }, } ``` Multi-word names are fine: `bg-my-color` looks up `my-color`. The last segment counts as a shade only if it's one of the eleven shade numbers. So the only names you can't use end in a hyphen plus a shade number. Each mistake has its own diagnostic: - `color-missing-shade`: a bare palette name, and the palette has no `DEFAULT`. - `color-invalid-shade`: a shade on a literal, or a shade the palette doesn't define. - `unknown-theme-key`: the name isn't in the theme at all. ## What ships by default 26 color palettes with eleven shades and a `DEFAULT` each, plus `black` and `white`. Ten radius keys and a `DEFAULT`. One spacing key, `"4"`. Three font families, five breakpoints and the rem curve. The [configuration reference](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#the-default-theme) lists every value. Spacing is computed, not looked up: any multiple of 0.5 times 4px. `p-1.5` is 6px and `p-40` is 160px. Add spacing keys only for named steps like `gutter`. Because `"4"` is a real entry, redefining it changes `p-4` but not `p-3` or `p-5`. Editor completions suggest a short list of common steps, but any multiple of 0.5 works. `screens` and `fontFamily` are the exceptions to expression strings. Breakpoints are plain numbers and fonts are asset paths. Don't name a font family after a weight: `font-bold` always means the weight, so a `fontFamily.bold` never resolves. ## See also - [Configuration reference](https://docs.astra-void.xyz/vela-rbxts/reference/config.md): the full schema, config discovery, [`vela.css`](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#velacss) and [plugins](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#plugins). - [Colors and surfaces](https://docs.astra-void.xyz/vela-rbxts/guides/colors-and-surfaces.md): the utilities that use `theme.colors` and `theme.radius`. - [Layout and sizing](https://docs.astra-void.xyz/vela-rbxts/guides/layout-and-sizing.md): the utilities that use `theme.spacing`. - [Text and fonts](https://docs.astra-void.xyz/vela-rbxts/guides/text-and-fonts.md#family): the utilities that use `theme.fontFamily`. --- # Layout and sizing > Flex, grid, padding, margins, size, position and transforms, and the Roblox layout instances they build. Source: https://docs.astra-void.xyz/vela-rbxts/guides/layout-and-sizing/ Roblox has no CSS box model. Elements are placed by `Position` and `AnchorPoint`, sized by `Size`, and laid out by child instances like `UIListLayout` and `UIPadding`. Vela's layout classes set those properties, or add those child instances for you. ```tsx title="src/client/Toolbar.tsx" ``` _Interactive preview: Nested lists: a column of two rows, each with its own UIListLayout._ ## Flex and `UIListLayout` Flex, alignment, gap and wrap classes all go into one `UIListLayout` child. `flex` and `flex-row` lay children out horizontally. `flex-col` lays them out vertically. `flex-row-reverse` and `flex-col-reverse` report `unsupported-flex-direction`. Reorder the children instead, or use [`order-*`](#child-order). ### `justify-*` splits across two properties Roblox keeps alignment and spacing-out in separate properties, so `justify-*` writes to one of two: | Class | Property | Value | | --- | --- | --- | | `justify-start` | `HorizontalAlignment` | `Enum.HorizontalAlignment.Left` | | `justify-center` | `HorizontalAlignment` | `Enum.HorizontalAlignment.Center` | | `justify-end` | `HorizontalAlignment` | `Enum.HorizontalAlignment.Right` | | `justify-between` | `HorizontalFlex` | `Enum.UIFlexAlignment.SpaceBetween` | | `justify-around` | `HorizontalFlex` | `Enum.UIFlexAlignment.SpaceAround` | | `justify-evenly` | `HorizontalFlex` | `Enum.UIFlexAlignment.SpaceEvenly` | > **Pick one justify-* class** > > `justify-center justify-between` sets both properties. The later class does not win. Roblox's layout > combines them. `items-*` and `content-*` work the same way on the vertical axis. `items-start`, `items-center` and `items-end` set `VerticalAlignment`. `items-stretch` sets `VerticalFlex = Fill`. These classes don't follow the flex direction. `justify-*` is always horizontal and `items-*` is always vertical, even under `flex-col`. ### Wrapping and gap `flex-wrap` and `flex-nowrap` set `Wraps`. `gap-{key}` sets the list's `Padding`. A list has one padding value, so there is no `gap-x-*` or `gap-y-*`. `space-y-2` is short for `flex flex-col gap-2`, and `space-x-2` for `flex gap-2`. With [`divide-*`](https://docs.astra-void.xyz/vela-rbxts/reference/utilities.md#divide), items sit `gap + line thickness` apart, as in CSS. ### Flex items and `UIFlexItem` These classes add a `UIFlexItem` child to the item itself. Several names map to the same mode: | Class | `UIFlexItem` property | | --- | --- | | `flex-1` | `FlexMode = Enum.UIFlexMode.Fill` | | `flex-auto` | `FlexMode = Enum.UIFlexMode.Fill` | | `flex-initial` | `FlexMode = Enum.UIFlexMode.Shrink` | | `flex-none` | `FlexMode = Enum.UIFlexMode.None` | | `grow` | `FlexMode = Enum.UIFlexMode.Grow` | | `grow-0` | `FlexMode = Enum.UIFlexMode.None` | | `shrink` | `FlexMode = Enum.UIFlexMode.Shrink` | | `shrink-0` | `FlexMode = Enum.UIFlexMode.None` | | `self-auto`, `self-start`, `self-center`, `self-end`, `self-stretch` | `ItemLineAlignment` | Numbered forms like `grow-2` or `flex-2` don't exist. `basis-{value}` is the same as `w-{value}`. ### Child order `order-{n}` sets `LayoutOrder`, which the list sorts by. Negative values (`-order-2`) work, as do `order-first`, `order-last` and `order-none`. Under a `divide-*` parent, Vela rewrites each child's `LayoutOrder` to its position. A component child must forward `LayoutOrder` to its root. See [divide](https://docs.astra-void.xyz/vela-rbxts/reference/utilities.md#divide) if separators land in the wrong place. ## Grid and `UIGridLayout` `grid` adds a `UIGridLayout` child. `grid-cols-{n}` (1–12) sets the number of columns, and `grid-rows-{n}` the number of rows. The grid sizes its own cells, so a `w-*` on a cell does nothing. The column count sets the width: ```tsx title="grid grid-cols-2 gap-2.5" ``` Rows stay 100px tall until you set `auto-rows-*` (or `auto-cols-*` under `grid-rows-*`). They use the spacing scale, so `auto-rows-24` is a 96px row. `gap-*` sets `CellPadding`, and responsive gaps work: `grid grid-cols-3 md:gap-4`. Spans like `col-span-*` and `row-span-*` report `no-roblox-equivalent`. More grid edge cases are in the [utilities reference](https://docs.astra-void.xyz/vela-rbxts/reference/utilities.md#grid). ## Padding and `UIPadding` Padding classes go into one `UIPadding` child. They work as in Tailwind: `p-*` sets all four sides, `px-*` and `py-*` set one axis, and `pt-*`, `pr-*`, `pb-*` and `pl-*` set one side. ## Margins are built, not native Roblox has no margins, so Vela builds one. It wraps the element in a clear frame padded by the margin. | Class | Effect | | --- | --- | | `m-*`, `mx-*`, `my-*`, `mt-*`, `mr-*`, `mb-*`, `ml-*` | wraps the element in a margin frame | | `-mt-*`, `-ml-*` | shifts `Position` instead of wrapping | | `-mr-*`, `-mb-*` | `unsupported-negative-margin` | | `mx-auto`, `my-auto` | centers with `AnchorPoint` and `Position`, no wrapper | > **Margins add to the parent's gap** > > A `gap-2` column whose children have `my-2` shows 16px gaps, not 8. Prefer `gap-*` for space between > list items. Any margin moves the element onto the [runtime path](https://docs.astra-void.xyz/vela-rbxts/guides/dynamic-class-names.md), even in a plain string. `m-0` and other zero margins are the exception. Transitions and variants still work: `m-4 w-20 transition-all hover:w-40` animates, and `mt-2 hover:mt-4` applies. ## The spacing value grammar Padding, margin, gap, min/max and size offsets all read numbers the same way: 1. If the key is in `theme.spacing`, Vela uses that value. 2. Otherwise the key must be a non-negative multiple of `0.5`, and Vela multiplies it by 4. So `p-1.5` is 6px and `p-40` is 160px. `p-0.25` reports `unknown-theme-key`. A leading sign is rejected. The default theme has only one spacing key, so almost every number goes through step 2. To add named keys, see [Theming](https://docs.astra-void.xyz/vela-rbxts/guides/theming.md). > **Pixel values scale with the screen** > > Every pixel number on this page is the value at a 1920×1020 screen. Vela scales offsets with the > player's viewport. To keep literal pixels, [pin the scale](https://docs.astra-void.xyz/vela-rbxts/guides/theming.md#pinning-offsets-back-to-literal-pixels). ## Sizing and `Size` `w-*`, `h-*` and `size-*` set the element's `Size`. Each axis accepts: - `px`: exactly 1 pixel. - `full`: 100% of the parent. - A fraction, like `w-1/2`. Only the fractions in the table below work. - A spacing number, like `w-40` (160px). | Denominator | Accepted numerators | | --- | --- | | `/2` | `1` | | `/3` | `1`, `2` | | `/4` | `1`, `3` | | `/5` | `1`, `2`, `3`, `4` | | `/6` | `1`, `5` | | `/12` | `1` through `11` | Write fractions in lowest terms. `w-2/4` reports `unknown-theme-key`. Use `w-1/2`. ### Automatic sizing `fit` and `auto` set `AutomaticSize` instead of `Size`: | Class | Property | | --- | --- | | `w-fit`, `w-auto` | `AutomaticSize = Enum.AutomaticSize.X` | | `h-fit`, `h-auto` | `AutomaticSize = Enum.AutomaticSize.Y` | | `size-fit`, `size-auto` | `AutomaticSize = Enum.AutomaticSize.XY` | | `w-fit h-fit` | `AutomaticSize = Enum.AutomaticSize.XY` | ### What gets emitted Width and height merge into one `Size`, including under variants like `md:w-32 md:h-32`: ```tsx title="Merged into one Size" // Size = UDim2.new(1, 0, 0, 48) // Size = UDim2.fromScale(0.5, 0.5) // Size = UDim2.fromOffset(160, 32) ``` A custom spacing value with a scale part, like `new UDim(0.5, 0)`, can't be used for size. It reports `unsupported-size-spacing-value`. ## Min and max size `min-w-*`, `max-w-*`, `min-h-*` and `max-h-*` add a `UISizeConstraint` child. They take pixel values only, so `max-w-1/2` doesn't work. An axis you don't set has no limit: `max-w-80` alone emits `MaxSize = new Vector2(320, math.huge)`. ## Position and anchor Position classes set the element's `Position`: | Class | Effect | | --- | --- | | `left-*` | sets the X component | | `top-*` | sets the Y component | | `right-*` | sets the X component, measured from the far edge | | `bottom-*` | sets the Y component, measured from the far edge | | `inset-*` | sets both components | | `-left-*`, `-top-*`, `-inset-*` | the same, negated | They take the same values as sizing: `px`, `full`, fractions and spacing numbers. `right-*` and `bottom-*` don't move the anchor. The element's top-left corner is still the point being placed. Add `origin-*` to place a different corner: ```tsx title="8px inside the parent's bottom-right corner" ``` Every Roblox element is already positioned relative to its parent, so `absolute`, `relative` and `fixed` report `no-roblox-equivalent`. Inside a `flex` or `grid` parent, the layout controls position and `left-*`/`top-*` have no effect. `origin-{key}` sets `AnchorPoint` to a corner, an edge or the center. The nine keys are `origin-center`, `origin-top`, `origin-bottom`, `origin-left`, `origin-right`, and the four corners `origin-top-left`, `origin-top-right`, `origin-bottom-left` and `origin-bottom-right`. So `origin-center` is `(0.5, 0.5)` and `origin-bottom-right` is `(1, 1)`. Anything else reports `unsupported-anchor-value`. ### Translation `translate-x-*` and `translate-y-*` shift the element. A fraction shifts by the element's own size. A pixel value adds to `Position`. The usual CSS centering pattern works: ```tsx title="Dead center — AnchorPoint (0.5, 0.5), Position (0.5, 0.5) scale" ``` `mx-auto` and `my-auto` do the same centering on one axis. A fractional translate sets `AnchorPoint`, so don't combine it with `origin-*`. The later class wins. ## Aspect ratio `aspect-{key}` adds a `UIAspectRatioConstraint` child. `aspect-square` is `1` and `aspect-video` is 16:9. For other ratios, use a bracket: ```tsx title="Arbitrary aspect ratios" ``` `aspect-auto` reports `unsupported-aspect-value`. ## Z-index `z-{value}` sets `ZIndex`. The presets are `z-0`, `z-10`, `z-20`, `z-30`, `z-40` and `z-50`. For other levels, use a whole number in brackets: `z-[15]`. | Input | Diagnostic | | --- | --- | | `z-auto` | `unsupported-z-index-auto` | | `-z-10` | `unsupported-negative-z-index` | | `z-[1.5]` | `unsupported-arbitrary-z-index` | | `z-5` | `unsupported-z-index-value` | ## Rotation and scale `rotate-N` and `-rotate-N` set `Rotation` in degrees. The presets are `0`, `1`, `2`, `3`, `6`, `12`, `45`, `90` and `180`. For any other angle, use a bracket: `rotate-[17deg]`. Other unbracketed numbers report `unsupported-rotation-value`. `scale-N` adds a `UIScale` child with `Scale = N / 100`. The values are `0`, `50`, `75`, `90`, `95`, `100`, `105`, `110`, `125` and `150`, so `scale-105` is `1.05`. Other values, brackets included, report `unsupported-scale-value`. Scaling is uniform, so there is no `scale-x-*` or `scale-y-*`. ## Visibility and clipping `hidden` sets `Visible = false`. `visible` sets `Visible = true`. `overflow-hidden` and `overflow-clip` set `ClipsDescendants = true`. `overflow-visible` sets it to `false`. Other values report `unsupported-overflow-value`. To scroll, use a `scrollingframe` element. ## What layout still cannot express - Grid spans and flow: `col-span-*`, `row-span-*`, `grid-flow-*`. - CSS positioning: `absolute`, `relative`, `fixed`, `sticky`, `float`, `clear`. - Per-axis gaps: `gap-x-*` and `gap-y-*`. These report `unknown-theme-key`, not an unknown-class warning. - Reversed direction: `flex-row-reverse`, `flex-col-reverse`. Use `order-*`. ## See also - [Colors and surfaces](https://docs.astra-void.xyz/vela-rbxts/guides/colors-and-surfaces.md) for `bg-*`, `border-*`, gradients, and shadows. - [Responsive and input variants](https://docs.astra-void.xyz/vela-rbxts/guides/responsive-and-input-variants.md) for breakpoint- and input-conditional layout. - [Recipes](https://docs.astra-void.xyz/vela-rbxts/guides/recipes.md) for these families composed into real interface pieces. - [Utilities reference](https://docs.astra-void.xyz/vela-rbxts/reference/utilities.md) for the complete class list. - [Diagnostics](https://docs.astra-void.xyz/vela-rbxts/reference/diagnostics.md) for every warning code named on this page. --- # Colors and surfaces > Fills, strokes, radius, shadows, blur, gradients and opacity, and the Roblox properties each one writes. Source: https://docs.astra-void.xyz/vela-rbxts/guides/colors-and-surfaces/ Color utilities read a key from `theme.colors` and write it to one Roblox property. Nothing cascades. A class sets one property on one instance. ```tsx title="src/client/Card.tsx" ``` _Interactive preview: A fill, a fill with a stroke, a pill radius, and a gradient — four utility families, four different targets._ Open the Lowered tab to see where each class goes. `bg-*` lands on the frame. `border-*`, `rounded-*` and the gradient each become a child instance. ## The color families | Family | Roblox property | Written on | | --- | --- | --- | | `bg-*` | `BackgroundColor3` | the host instance | | `text-*` | `TextColor3` | the host instance | | `image-*` | `ImageColor3` | the host instance | | `placeholder-*` | `PlaceholderColor3` | the host instance | | `border-{color}`, `ring-{color}`, `outline-{color}` | `Color` | the shared `UIStroke` child | | `shadow-{color}` | `Color` | a `UIShadow` child | | `inset-shadow-{color}`, `text-shadow-{color}` | `Color` | their own `UIShadow` child | | `divide-{color}` | `BackgroundColor3` | the separator frames | | `from-*`, `via-*`, `to-*` | color keypoints | a `UIGradient` child | `border-{color}` also sets the stroke's `Transparency` to `0`, so you don't need a second class to make it visible. `text-*` also covers size, alignment and wrapping. See [Text and fonts](https://docs.astra-void.xyz/vela-rbxts/guides/text-and-fonts.md) for how Vela tells them apart. ### Arbitrary hex colors Any color family takes a bracketed hex: `bg-[#3fa8c2]` or `bg-[#fff]`. Only three- and six-digit forms work. Anything else reports `unsupported-arbitrary-value`. Use these sparingly. If a hex appears twice, give it a name in your [theme](https://docs.astra-void.xyz/vela-rbxts/guides/theming.md). ### Opacity modifiers Add `/N` (an integer from 0 to 100) to set a color and its transparency in one class: - `bg-blue-600/50` sets `BackgroundColor3` and `BackgroundTransparency = 0.5`. - `text-slate-100/80` shows the text at 80% opacity. - `border-slate-500/25` fades the stroke, and `divide-white/10` fades the separators. - `from-blue-600/50` fades only that gradient stop. `placeholder-*` is the exception. Roblox has no placeholder transparency, so `/N` there reports `unsupported-opacity-modifier`. ## `transparent` `transparent` sets the family's transparency to `1` and writes no color. `bg-transparent` emits `BackgroundTransparency = 1` and nothing else. You rarely need `bg-transparent`. [Preflight](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#preflight) already starts every classed element with a clear background. Use it when a variant paints the background and the default should be clear, or when you set `preflight: false`. Three keywords don't work: - `placeholder-transparent` reports `unsupported-color-key`. `PlaceholderColor3` has no transparency to set. - `current` and `inherit` report `unsupported-color-key`. Roblox has no cascade, so a `TextLabel` can't take its color from a parent. - `from-transparent`, `via-transparent` and `to-transparent` are **dropped without a warning**. A two-stop gradient then renders as a flat fill. ## Shades and diagnostics Write a palette name plus a shade (`bg-blue-500`), a bare palette name (`bg-blue`), or a semantic key (`bg-surface`). A bare name uses the palette's `DEFAULT`, which every built-in palette sets to its `500`. A suffix counts as a shade only if it is one of the eleven shade numbers. Otherwise the whole payload is one key: `bg-my-color` looks up `my-color`. | Code | Fires when | | --- | --- | | `color-missing-shade` | you wrote a bare palette name and that palette has no `DEFAULT` | | `color-invalid-shade` | you gave a literal a shade (`bg-white-500`), or asked for a shade the palette lacks | | `unknown-theme-key` | the name isn't in `theme.colors` | All three are warnings. The class is dropped and the build continues. See [Theming](https://docs.astra-void.xyz/vela-rbxts/guides/theming.md) to add your own colors. ## Borders `border-*` builds a `UIStroke` child. Roblox strokes do less than CSS borders. ```tsx title="src/client/Panel.tsx" ``` - Thickness: `border` (1), `border-0`, `border-1`, `border-2` and `border-4`. Other numbers report `unsupported-border-value`. For anything else, use a bracket: `border-[3]`, `border-[3px]`. - Color: `border-{color}` sets the color. `border-transparent` hides the stroke. - Corners: `border-round`, `border-bevel` and `border-miter` set `LineJoinMode`. CSS has no equivalent. These report `unsupported-border-value` instead of doing nothing: - Styles like `border-dashed` or `border-dotted`. A stroke is always one solid line. - Single sides like `border-t-2` or `border-x`. A stroke outlines the whole element. For lines between children, use [`divide-*`](https://docs.astra-void.xyz/vela-rbxts/reference/utilities.md#divide). - `border-opacity-*`. Use `/N` instead: `border-slate-500/25`. ### Rings and outlines `ring` (thickness 3) and `outline` (thickness 2) exist for Tailwind habits. Roblox allows one reliable stroke per element, so `border`, `ring` and `outline` all write to the same `UIStroke`. The last class wins. You can't stack a ring on a border. ## Radius `rounded-{key}` sets `CornerRadius` on a `UICorner` child. The key must exist in `theme.radius`. Numbers like `rounded-8` report `unknown-theme-key`. Use a bracket for a one-off (`rounded-[8px]`), or name the value in your theme: ```ts title="vela.config.ts" theme: { extend: { radius: { card: "new UDim(0, 10)" } } } ``` ```tsx ``` ## Shadows `shadow` and its sizes build a `UIShadow` child. The sizes are fixed presets: | Class | Blur radius | Y offset | Spread | Transparency | | --- | --- | --- | --- | --- | | `shadow` | 3 | 1 | 0 | 0.9 | | `shadow-sm` | 2 | 1 | 0 | 0.95 | | `shadow-md` | 6 | 4 | −1 | 0.9 | | `shadow-lg` | 15 | 10 | −3 | 0.9 | | `shadow-xl` | 25 | 20 | −5 | 0.9 | | `shadow-2xl` | 50 | 25 | −12 | 0.75 | Add `shadow-{color}` to change the color and keep the preset's transparency. `shadow-none` disables the shadow. ```tsx ``` ### Inset and text shadows `inset-shadow-*` draws a shadow inside the element. `text-shadow-*` draws one behind the text. | Class | Mode | Blur radius | Y offset | Transparency | | --- | --- | --- | --- | --- | | `inset-shadow-2xs` | `Inset` | 0 | 1 | 0.95 | | `inset-shadow-xs` | `Inset` | 1 | 1 | 0.95 | | `inset-shadow-sm` | `Inset` | 4 | 2 | 0.95 | | `text-shadow-2xs` | `Text` | 0 | 1 | 0.85 | | `text-shadow-xs` | `Text` | 1 | 1 | 0.8 | | `text-shadow-sm` | `Text` | 2 | 2 | 0.8 | | `text-shadow-md` | `Text` | 4 | 2 | 0.75 | | `text-shadow-lg` | `Text` | 8 | 4 | 0.75 | `shadow-inner` is the same as `inset-shadow-sm`. Each family has a `-none` form and a color form, such as `text-shadow-red-500/50`. There is no `inset-shadow-md`. Vela reads it as a color and warns `unknown-theme-key`. Each family is its own `UIShadow`, so `shadow-md inset-shadow-xs text-shadow-lg` gives one element all three. > **Inset and text shadows only show in Studio** > > Roblox hasn't shipped these shadow modes to live games yet. The build won't warn you. ## Backdrop blur `backdrop-blur-*` builds a `UIBlur` child. Roblox has three strengths, so the Tailwind sizes share them: | Class | `Strength` | | --- | --- | | `backdrop-blur`, `backdrop-blur-xs`, `backdrop-blur-sm` | `Light` | | `backdrop-blur-md`, `backdrop-blur-lg` | `Medium` | | `backdrop-blur-xl`, `backdrop-blur-2xl`, `backdrop-blur-3xl` | `Heavy` | | `backdrop-blur-none` | `Enabled = false` | Other sizes, including brackets, warn `unsupported-backdrop-blur-value`. Variants work: `backdrop-blur-sm hover:backdrop-blur-xl`. The [utilities reference](https://docs.astra-void.xyz/vela-rbxts/reference/utilities.md#backdrop-blur) lists the type requirements. ## Gradients `bg-gradient-to-{dir}` (or `bg-linear-to-{dir}`) builds a `UIGradient` child. Add color stops with `from-*`, `via-*` and `to-*`: ```tsx title="src/client/Header.tsx" ``` _Interactive preview: Two stops, three stops with via-*, and a vertical direction — each swatch is one UIGradient child._ | Class suffix | Direction | Rotation | | --- | --- | --- | | `t` | to top | 270 | | `tr` | to top right | 315 | | `r` | to right | 0 | | `br` | to bottom right | 45 | | `b` | to bottom | 90 | | `bl` | to bottom left | 135 | | `l` | to left | 180 | | `tl` | to top left | 225 | Other directions report `unsupported-gradient-direction`. > **A gradient overrides bg-*** > > Vela sets the background to white so the gradient colors show true. A `bg-*` on the same element is > lost. Use one or the other. ## Element opacity `opacity-N` fades the whole element. `N` is any integer from 0 to 100, so `opacity-37` works. `opacity-40` emits a transparency of `0.6`. It fades everything the element draws, including its stroke, shadows and blur. It also fades every child under it, including children passed into your components. To fade one part only, use `/N` instead. `text-slate-100/80` fades the text and leaves the background alone. The two multiply: `opacity-50 bg-blue-600/50` lands at 0.75 transparency. A transparency you set yourself is kept. `` stays at 0.2 under a parent's `opacity-50`. On the same element, the prop wins and Vela warns `explicit-prop-overrides-class`. ### Fading a group as one layer Vela fades each child separately. Where siblings overlap, the overlap looks darker. Add `isolate` to a `frame` to fade the group as one layer: ```tsx // → … ``` Vela builds the frame as a `CanvasGroup`. That has costs: it clips its children, it redraws when any child changes, and a ref or `IsA` check sees a `CanvasGroup`. `isolate` must be static. Under a variant or in a dynamic class it warns `isolate-not-static`. On anything but a `frame` it warns `isolate-needs-frame`. Write a `` yourself there. ## See also - [Theming](https://docs.astra-void.xyz/vela-rbxts/guides/theming.md): the color, radius and spacing scales these utilities read. - [Text and fonts](https://docs.astra-void.xyz/vela-rbxts/guides/text-and-fonts.md): how `text-*` tells color from size, alignment and wrapping. - [Utilities reference](https://docs.astra-void.xyz/vela-rbxts/reference/utilities.md): every family in full. - [Diagnostics](https://docs.astra-void.xyz/vela-rbxts/reference/diagnostics.md): every code, and what triggers it. --- # Text and fonts > Text size, color, weight, family, alignment, wrapping and truncation on textlabel, textbutton and textbox. Source: https://docs.astra-void.xyz/vela-rbxts/guides/text-and-fonts/ Text classes work on the three Roblox text elements: `textlabel`, `textbutton` and `textbox`. ```tsx title="src/client/Title.tsx" ``` _Interactive preview: Three labels: size, weight, color and alignment, all from the text-* and font-* families._ > **Font weights are approximate in this preview** > > The browser preview can't load Roblox fonts, so it shows the nearest legacy font. The Lowered tab > shows the real `FontFace` Vela emits. ## The host restriction is editor-only Put text classes on text elements only. The build won't stop you: `` compiles with no warning, and the class does nothing in game. The editor extension does warn, with `unsupported-host-utility`. Install it from [Editor setup](https://docs.astra-void.xyz/vela-rbxts/guides/editor-setup.md) to catch these. The same rule covers `image-*` (for `imagelabel` and `imagebutton`) and `placeholder-*` (for `textbox`). ### The restriction does not apply to components On a component, Vela can't know which element it renders, so it never warns: ```tsx title="No warning anywhere, in the editor or the build" ``` This only works if `Title` passes the classes on to a text element. See [`className` on components](https://docs.astra-void.xyz/vela-rbxts/getting-started/how-it-works.md#classname-on-components). ## How `text-*` is disambiguated `text-*` can mean size, alignment, wrapping or color. Vela checks in this order: 1. A size key (`xs` through `9xl`) sets `TextSize`. 2. `left`, `center`, `right` or `justify` sets `TextXAlignment`. 3. `wrap` or `nowrap` sets `TextWrapped`. 4. Anything else is a color. So a typo like `text-larg` is read as a color, and you get `unknown-theme-key`. If you see that warning on a `text-*` class, check for a misspelled size or alignment. ## Size `text-{size}` sets `TextSize`: | Class | `TextSize` | | --- | --- | | `text-xs` | 12 | | `text-sm` | 14 | | `text-base` | 16 | | `text-lg` | 18 | | `text-xl` | 20 | | `text-2xl` | 24 | | `text-3xl` | 30 | | `text-4xl` | 36 | | `text-5xl` | 48 | | `text-6xl` | 60 | | `text-7xl` | 72 | | `text-8xl` | 96 | | `text-9xl` | 128 | These sizes are fixed and don't come from the theme. For another size, use a bracket: `text-[13px]`. The numbers are the sizes at a 1920×1020 screen. Vela scales them with the player's viewport. See [rem](https://docs.astra-void.xyz/vela-rbxts/guides/theming.md#rem). > **Text stops growing at 100** > > Roblox ignores a `TextSize` above 100. On a large screen, `text-6xl` and up all render at 100. ## Weight, family and style `font-*` sets weight or family. Weight, family and `italic` all combine into one `FontFace`: ```tsx title="font-mono font-bold italic" FontFace={new Font("rbxasset://fonts/families/RobotoMono.json", Enum.FontWeight.Bold, Enum.FontStyle.Italic)} ``` ### Weight | Class | `Enum.FontWeight` | | --- | --- | | `font-thin` | `Thin` | | `font-extralight` | `ExtraLight` | | `font-light` | `Light` | | `font-normal` | `Regular` | | `font-medium` | `Medium` | | `font-semibold` | `SemiBold` | | `font-bold` | `Bold` | | `font-extrabold` | `ExtraBold` | | `font-black` | `Heavy` | `italic` makes the text italic. `not-italic` turns it back off. ### Family The theme ships three families: | Class | Family | | --- | --- | | `font-sans` | Source Sans Pro (the default) | | `font-serif` | Merriweather | | `font-mono` | Roboto Mono | Add your own under `theme.extend.fontFamily`. The value is a Roblox font asset path: ```ts title="vela.config.ts" export default defineConfig({ theme: { extend: { fontFamily: { display: "rbxassetid://12345678", body: "rbxasset://fonts/families/Nunito.json", }, }, }, }); ``` ```tsx <textlabel className="font-display font-bold" Text="Match found" /> ``` A `font-*` class that is neither a weight nor a family reports `unknown-theme-key`. ### Setting `FontFace` yourself For a one-off font, set the `FontFace` prop and leave `font-*` off: ```tsx <textlabel FontFace={new Font("rbxasset://fonts/families/GothamSSm.json", Enum.FontWeight.Bold)} Text="Custom family" /> ``` Don't mix the two. `font-bold` and `italic` write a whole `FontFace` of their own. ## Alignment `text-left`, `text-center` and `text-right` set the horizontal alignment. `align-top`, `align-middle` and `align-bottom` set the vertical alignment. Other `align-*` values report `unsupported-text-alignment`. Roblox can't justify text, so `text-justify` also reports `unsupported-text-alignment`. ## Line height `leading-{key}` sets `LineHeight`: | Class | `LineHeight` | | --- | --- | | `leading-none` | 1 | | `leading-tight` | 1.25 | | `leading-snug` | 1.375 | | `leading-normal` | 1.5 | | `leading-relaxed` | 1.625 | | `leading-loose` | 2 | For another value, use a bracket: `leading-[1.2]`. Tailwind's numbered forms like `leading-5` report `unsupported-line-height-value`. ## Wrapping and truncation `text-wrap` turns wrapping on, and `text-nowrap` turns it off. `whitespace-normal` and `whitespace-nowrap` do the same. Other `whitespace-*` values report `unsupported-whitespace-value`. `truncate` cuts overflowing text off with an ellipsis at the end: ```tsx title="src/client/PlayerRow.tsx" <textlabel className="text-sm text-nowrap truncate" Text={playerName} /> ``` ## Case transforms rewrite the string `uppercase`, `lowercase`, `capitalize` and `normal-case` change the `Text` string itself. With a literal string, Vela rewrites it at build time: ```tsx title="In" <textlabel className="uppercase" Text="match found" /> ``` ```tsx title="Out" <textlabel Text="MATCH FOUND" /> ``` If `Text` is a variable, the change happens in game instead. The element then uses the [runtime path](https://docs.astra-void.xyz/vela-rbxts/guides/dynamic-class-names.md). ## Decorations use RichText `underline` and `line-through` wrap the text in RichText tags and turn on `RichText`. `no-underline` removes them. If you set `RichText` on the element yourself, Vela leaves the text alone and warns `decoration-on-richtext`. ## Placeholders `placeholder-*` sets the placeholder color on a `textbox`. `placeholder-transparent` and `/N` opacity don't work, because Roblox has no placeholder transparency. See [Colors and surfaces](https://docs.astra-void.xyz/vela-rbxts/guides/colors-and-surfaces.md). ## Typography families that cannot exist These Tailwind classes have no Roblox equivalent. They report `no-roblox-equivalent`: - `tracking-*` (letter spacing). - `indent-*`, `break-*`, `hyphens-*` and `list-*`. - `decoration-*` and `overline`. RichText only has underline and strikethrough. ## See also - [Colors and surfaces](https://docs.astra-void.xyz/vela-rbxts/guides/colors-and-surfaces.md): the color half of `text-*`, plus `transparent` and the shade rules. - [Theming](https://docs.astra-void.xyz/vela-rbxts/guides/theming.md): where `text-{color}` keys come from. - [Editor setup](https://docs.astra-void.xyz/vela-rbxts/guides/editor-setup.md): getting the host warnings the build doesn't give you. - [Diagnostics](https://docs.astra-void.xyz/vela-rbxts/reference/diagnostics.md): every code and what triggers it. --- # Responsive and input variants > Every variant prefix, what each one matches, and what using one costs. Source: https://docs.astra-void.xyz/vela-rbxts/guides/responsive-and-input-variants/ A variant applies a class only while a condition holds on the player's client. Write it as a colon prefix, as in Tailwind: ```tsx title="src/client/Panel.tsx" <frame className="w-full md:w-1/2 lg:w-1/3" /> ``` Chain prefixes to require every condition. The order inside a chain doesn't matter. ```tsx title="Only on a touch device in portrait" <frame className="hidden touch:portrait:visible" /> ``` | Variant | Matches when | | --- | --- | | `sm` `md` `lg` `xl` `2xl` | viewport width is at least 640, 768, 1024, 1280, 1536 | | `max-sm` … `max-2xl` | viewport width is below that same threshold | | `attr-[Name=value]` | the styled instance carries that Roblox attribute | | `portrait` | viewport width is less than viewport height | | `landscape` | viewport width is greater than or equal to viewport height | | `touch` | the active input mode is touch | | `mouse` | the active input mode is mouse | | `gamepad` | the active input mode is gamepad | | `hover` | the pointer is over this element | | `active` | this element is being pressed | | `focus` | this element holds focus or selection | | `dark` | the local player carries `VelaColorScheme = "dark"` | | `group-hover` `group-active` `group-focus` | the nearest ancestor marked `group` is in that state | | `peer-hover` `peer-active` `peer-focus` | a sibling marked `peer` is in that state | There is no `not-` form and no `disabled:`. An unknown prefix reports `unknown-variant`, and the token is dropped. ## Which class wins The order you write classes in doesn't decide. Vela ranks them the way Tailwind's stylesheet does, weakest first: 1. Base classes. 2. States: `hover:`, `active:`, `focus:`, attribute variants, `group-*`, `peer-*`. 3. Breakpoints, narrowest first, so a wider one wins. A `max-*` ranks as a breakpoint with no minimum. 4. `portrait:` / `landscape:`, `dark:`, and the input variants. Within one rank, the class written last wins. So: - `hover:bg-blue-500 bg-red-500` turns blue under the pointer. - `lg:p-8 md:p-4` is `p-8` on a wide screen. - `dark:bg-blue-500 md:bg-red-500` is blue in dark mode, even on a wide screen. ## Breakpoints, and their complements | Variant | Applies when | Complement | | --- | --- | --- | | `sm:` | `width >= 640` | `max-sm:` — `width < 640` | | `md:` | `width >= 768` | `max-md:` — `width < 768` | | `lg:` | `width >= 1024` | `max-lg:` — `width < 1024` | | `xl:` | `width >= 1280` | `max-xl:` — `width < 1280` | | `2xl:` | `width >= 1536` | `max-2xl:` — `width < 1536` | `max-md:` is the exact complement of `md:`. At exactly 768px, `md:` applies and `max-md:` doesn't. Chain the two to target one range: ```tsx title="Only between 768 and 1024" <frame className="md:max-lg:w-1/2" /> ``` A chain that matches no width, such as `lg:max-md:`, reports `invalid-breakpoint-range`. Write the small-screen style unprefixed and layer wider screens on top. To rename or add breakpoints, use [`theme.screens`](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#screens). One entry defines both the bare prefix and its `max-` form. Breakpoints follow the viewport live, so resizing the window re-applies them. ## How orientation is derived `landscape` means the viewport is at least as wide as it is tall. Anything else is `portrait`. **A square viewport counts as landscape.** If your layout has a square case, test it. ## How input mode is detected Exactly one input mode is active at a time. Vela picks it by priority from `UserInputService`, not by the device used last: 1. `gamepad` if `GamepadEnabled` is true. 2. Otherwise `touch` if `TouchEnabled` is true. 3. Otherwise `mouse`. So a device with both a gamepad and a touchscreen matches `gamepad:`, not `touch:`. Plugging in a controller mid-session switches the mode right away. ## Hover, active and focus are per-element These three track the element itself rather than the screen: | Variant | Tracked through | | --- | --- | | `hover` | `MouseEnter` / `MouseLeave` | | `active` | `InputBegan` / `InputEnded`, for mouse and touch. Also clears on `MouseLeave`, so dragging off a button doesn't leave it stuck. | | `focus` | `Focused` / `FocusLost` on a `textbox`. Gamepad `SelectionGained` / `SelectionLost` elsewhere. | Vela only listens on elements that use the variant. Event handlers you wrote yourself keep working. Add `transition` to tween the change instead of snapping it (see [motion utilities](https://docs.astra-void.xyz/vela-rbxts/reference/utilities.md#motion)): ```tsx title="A button with all three" <textbutton className="w-28 h-10 rounded-md bg-sky-500 hover:bg-sky-600 active:bg-sky-700 focus:ring-2 transition duration-150" Text="Play" /> ``` Gamepad and touch players may never hover. Use `hover:` as extra feedback only. A controller player sees `focus:`. ## Group and peer You can style an element from another element's state. Mark an ancestor `group` and read it with `group-hover:`, `group-active:` or `group-focus:`. Mark a sibling `peer` and read it with `peer-*`: ```tsx title="A row that highlights its label" <textbutton className="group flex gap-2 bg-slate-800"> <textlabel className="text-slate-300 group-hover:text-white" Text="Settings" /> </textbutton> ``` To pick one group out of several, name it. `group/card` marks it, and `group-hover/card:` reads the nearest `group/card` ancestor, skipping unnamed groups in between. `peer/email` and `peer-focus/email:` work the same way. Groups and peers can also be read through attribute variants: `group-selected:` for a registered `selected` variant, `group-attr-[State=open]/card:`, or `peer-attr-[Tier=2]:`. A `/` inside the brackets is part of the value. A few things differ from CSS: - Any marked sibling is a peer, not only an earlier one, because Roblox has no sibling order. Several peers combine with OR. - Group hover is geometric. A child drawn outside the group's bounds doesn't hover the group. - A marker can't be conditional. `hover:group` warns `conditional-marker`. - Put the marker on a host element, not a component. On a component it warns `marker-on-component`. - Only element states can be read. `group-md:` warns `unsupported-relational-variant`. A marker becomes a CollectionService tag, `VelaGroup` or `VelaPeer`, merged with any `Tag` you set: `<frame Tag="Card" className="group/card">` emits `Tag="Card VelaGroup/card"`. The marked element stays on the static path. Only the elements that read it use the runtime host. Because the lookup walks the instance tree, it works across components, across files, under Vide, and past a margin on either element. ## Dark mode is state your app owns Roblox doesn't tell a game the player's color scheme, so your app sets it. `dark:` matches when `Players.LocalPlayer` has a `VelaColorScheme` attribute set to `"dark"`: ```tsx title="Somewhere your settings UI can reach" Players.LocalPlayer.SetAttribute("VelaColorScheme", prefersDark ? "dark" : "light"); ``` ```tsx title="And then, anywhere" <frame className="bg-white dark:bg-zinc-900" /> ``` Any other value, or no attribute at all, means light. Changing the attribute restyles every `dark:` element immediately. ## State your UI owns For your own states, like a panel being open or a row being selected, style off a Roblox attribute on the element. Write it inline: ```tsx title="Inline" <frame className="rounded-sm attr-[State=open]:rounded-lg" /> ``` Or register a name for it in `vela.config.ts`: ```ts title="vela.config.ts" plugin(({ addVariant }) => { addVariant("open", { attribute: "State", equals: "open" }); }); ``` ```tsx title="…and then" <frame className="rounded-sm open:rounded-lg" /> ``` Set the attribute the way you set any other: ```tsx <frame ref={(f) => f?.SetAttribute("State", isOpen ? "open" : "closed")} /> ``` `equals` takes a string, number or boolean. Custom variants chain with every other variant and get the same editor support as built-in ones. Attributes replicate from the server and show in Studio, so your styles read the same state the rest of the game does. The names `group` and `peer`, and any name starting with `group-` or `peer-`, are reserved. `addVariant` throws on them. ## The cost: any variant forces the runtime path Any variant prefix moves that element onto the [runtime path](https://docs.astra-void.xyz/vela-rbxts/guides/dynamic-class-names.md), even in a plain string literal like `className="sm:w-full"`. The element renders through `VelaRuntimeHost` instead of getting plain props. The cost is small: - The file imports `@rbxts/vela-runtime`, one ModuleScript the whole place shares, plus a few hundred bytes of config. - Each runtime-path element re-checks its rules when the viewport, input mode or color scheme changes. All hosts share one set of signal connections, made the first time one needs them. The compiler still resolves and checks every variant class, so you keep diagnostics and the full utility set. Use variants where they pay off: top-level containers that reflow between phone and desktop, a gamepad-only hint, hover feedback on controls. Keep leaf components on plain classes. ## Driving reflow yourself To keep a file off the runtime host entirely, read the viewport yourself and switch between two static class strings. Both branches stay on the static path: ```tsx title="src/client/ResponsiveShell.tsx" function useViewportWide(threshold: number) { const [wide, setWide] = React.useState(false); React.useEffect(() => { const camera = Workspace.CurrentCamera; if (!camera) return; const update = () => setWide(camera.ViewportSize.X >= threshold); const connection = camera.GetPropertyChangedSignal("ViewportSize").Connect(update); update(); return () => connection.Disconnect(); }, [threshold]); return wide; } export function Shell(props: { children?: React.Element }) { const wide = useViewportWide(768); return wide ? ( <frame className="flex gap-4 p-4 w-full h-full">{props.children}</frame> ) : ( <frame className="flex flex-col gap-2 p-2 w-full h-full">{props.children}</frame> ); } ``` ## See also - [Dynamic class names](https://docs.astra-void.xyz/vela-rbxts/guides/dynamic-class-names.md): the other way onto the runtime path, and what it costs. - [Utilities reference: Motion](https://docs.astra-void.xyz/vela-rbxts/reference/utilities.md#motion): transitions and animations that pair with variants. - [Layout and sizing](https://docs.astra-void.xyz/vela-rbxts/guides/layout-and-sizing.md): the utilities you'll most often vary by breakpoint. - [Diagnostics](https://docs.astra-void.xyz/vela-rbxts/reference/diagnostics.md): every warning code. --- # Dynamic class names > Computing className keeps every utility. What stays checked, and what an unreadable string costs. Source: https://docs.astra-void.xyz/vela-rbxts/guides/dynamic-class-names/ You can compute `className`: ternaries, `&&`, arrays, template strings, props and state all work, and every utility still applies. What changes is whether the compiler can read your classes, and so whether it can check them. ## Three degrees, not two | What you wrote | Emitted as | Resolved by | Checked | |---|---|---|---| | `className="flex gap-2"`, or an array of literals | Your tag, plain props | The compiler | Yes | | A variant, a branch, a margin, a `divide-*` | `VelaRuntimeHost` with `__velaRules` | The compiler; the host only reads conditions | Yes | | A string the compiler cannot read | `VelaRuntimeHost` with `className` | The host, in-game | No | A `const` holding a string literal counts as the first row. A `const` holding anything else counts as the third. Only the third row has a real cost. The middle row is where variants and branches normally land, including a plain literal like `className="sm:w-full"`. > **An array of literals is still fully static** > > `className={["flex", "gap-2"]}` collapses to one class list and stays in the first row. A ternary lands in the middle row, with both branches resolved and checked. ## The two paths resolve the same utilities Every utility in the [reference](https://docs.astra-void.xyz/vela-rbxts/reference/utilities.md) works the same in-game as at compile time, including opacity modifiers and arbitrary values. One difference: in-game, a utility the element can't carry is dropped, because writing `TextColor3` onto a `Frame` is a Roblox error. The static path warns and writes it anyway. `opacity-*` always hands the class list to the host, which applies one alpha to the children. See [`opacity-*`](https://docs.astra-void.xyz/vela-rbxts/reference/utilities.md#effects). ## A branch lowers at compile time When an expression spells out its classes, the compiler resolves every option, even though it can't know which one applies: ```tsx title="Both sizes are resolved and checked" <textlabel className={big ? "text-lg" : "text-sm"} /> ``` Inside a branch: - The full utility set applies. - A bad utility reports a diagnostic. - A variant applies only when both it and the branch's condition hold. `big && "hover:text-xl"` needs `big` and the pointer. - Each condition is evaluated once, however many branches use it. The compiler reads ternaries, `&&`, the literal on the right of `||`, arrays, object maps, and a `const` holding a string literal. Branches combine with the classes around them, so `["w-40", tall && "h-10"]` becomes one `Size`. The element still renders through the runtime host, but the host only evaluates the conditions. Nothing is parsed in-game: ```tsx title="What the emit carries" <VelaRuntimeHost __velaRules={[ { condition: { kind: "test", index: 0, expected: true }, effects: { props: [{ name: "TextSize", value: "18" }] } }, { condition: { kind: "test", index: 0, expected: false }, effects: { props: [{ name: "TextSize", value: "14" }] } }, ]} __velaTests={[big ? true : false]} __velaTag={"textlabel"} /> ``` ### What sends a branch back to the runtime resolver Three things, and only the affected branch moves. `["w-4", on && "mt-4"]` keeps `w-4` resolved and hands the host `on && "mt-4"`. - A token no rule can carry: `m-*`, `divide-*`, `animate-*`, `transition*`, the text transforms and `opacity-*`. - A value the source never spells out: `` `size-${n}` ``, a bare variable, a call, a spread. - The left side of `||`, which is the class value itself when truthy. When branches overlap: - Branches that set the same property apply in written order. `[a && "bg-red-500", b && "bg-blue-500"]` is blue when both hold. - Branches that set different halves of one property don't merge. `[a && "w-40", b && "h-10"]` writes `Size` twice, and the later one wins. ## What the runtime path still costs This is the third row: a class value the compiler can't read, like `cn(...)`, a template string, or a prop passed through. - **No diagnostics.** A typo like `bg-blu-600` resolves to nothing, and the element renders without a background. In a literal or a branch, it would warn `unknown-theme-key`. - **Less editor help.** Completions and hover work on literal text, even inside an expression. A token an interpolation cuts into, as in `` `w-[${width}]` ``, gets none. - **Theme values are re-parsed in-game.** The host accepts only `Color3.fromRGB(r, g, b)` and `new UDim(a, b)` with plain numbers. Any other theme value compiles, then silently breaks. See [theme values](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#values-are-roblox-ts-expression-strings). Code size isn't a cost. `@rbxts/vela-runtime` is one ModuleScript the whole place shares, so each file adds only an import and its config: ```ts title="What a runtime-path module carries" import { createVelaRuntimeHost } from "@rbxts/vela-runtime"; const VelaRuntimeHost = createVelaRuntimeHost({ /* … */ }); ``` ## How to tell which row an element landed in There's no diagnostic for it, so read the emitted roblox-ts: - The element kept its own tag and gained plain props: first row. - It became `VelaRuntimeHost` with `__velaRules` and `__velaTests`: middle row. - It became `VelaRuntimeHost` and still has a `className` prop: third row. ## Writing for the checked rows Use readable forms where a typo would hurt. Compute freely everywhere else. ### Branch the classes, not the element Put the branch inside the class value instead of in a template string: ```tsx title="Read, resolved and checked" <frame className={["flex flex-col items-center gap-2 p-4 rounded-lg", emphasized ? "bg-slate-700" : "bg-slate-800"]} /> ``` Duplicating the whole element instead keeps it fully static, with no host at all. That's a leaner emit but no better checked, so save it for elements where performance matters. ### Or use a variant instead of computing If the state is something Vela can see (pointer, press, focus, viewport, input device or color scheme), use a variant: ```tsx title="No computed string needed" <textbutton className="bg-slate-800 hover:bg-slate-700 active:bg-slate-600 transition" Text="Play" /> ``` ### Computing is fine for the rest A computed `className` for your own state is normal, and every token in it resolves: ```tsx title="Fine — resolves fully, just without compile-time checking" const tone = disabled ? "bg-slate-800 text-slate-500" : "bg-blue-600 text-white"; return <frame className={`flex items-center gap-2 p-2 rounded-md ${tone}`} />; ``` The interpolation is what loses the check, not the ternary. Move the ternary into an array to get it back: ```tsx title="Same rendering, checked" return ( <frame className={[ "flex items-center gap-2 p-2 rounded-md", disabled ? "bg-slate-800 text-slate-500" : "bg-blue-600 text-white", ]} /> ); ``` ## Components take the same rows `<Panel className={classes} />` is lowered exactly like `<frame className={classes} />`, branches included. On the runtime host, `__velaTag={Panel}` holds the component itself, and the host renders it with the resolved props and helper children. **Your component must forward the props and children it doesn't use**, or the styling is lost with no diagnostic. See [How it works](https://docs.astra-void.xyz/vela-rbxts/getting-started/how-it-works.md#classname-on-components). On the runtime path, helper instances such as `UICorner` are built in-game rather than passed as JSX children. ## See also - [The five rules](https://docs.astra-void.xyz/vela-rbxts/getting-started/how-it-works.md#five-rules-that-keep-you-on-the-static-path): this page condensed to what to remember while writing code. - [Responsive and input variants](https://docs.astra-void.xyz/vela-rbxts/guides/responsive-and-input-variants.md): the other way onto the runtime path. - [How it works](https://docs.astra-void.xyz/vela-rbxts/getting-started/how-it-works.md): the compile pipeline and where the two paths split. - [Vide](https://docs.astra-void.xyz/vela-rbxts/guides/vide.md): the same three rows under the other target. --- # Vide > Use Vela with Vide. No config needed, the same static output, and a function for any class that changes. Source: https://docs.astra-void.xyz/vela-rbxts/guides/vide/ Vela works with [Vide](https://centau.github.io/vide/) as well as React. Everything else in these docs, from utilities and variants to the theme, applies to both. You don't need any Vela config for Vide. Vela detects it from the `jsxFactory` your `tsconfig.json` already sets: ```json title="tsconfig.json" { "compilerOptions": { "jsx": "react", "jsxFactory": "Vide.jsx", "jsxFragmentFactory": "Vide.Fragment" } } ``` Follow [Installation](https://docs.astra-void.xyz/vela-rbxts/getting-started/installation.md#install-the-packages), installing `@rbxts/vide` instead of React. The Vide runtime ships with `vela-rbxts`. To set the target by hand instead, see [naming the target explicitly](#naming-the-target-explicitly). ## The static path is almost the same output Classes Vela resolves at compile time produce the same props under both targets. Vide uses the same lowercase Roblox element names as React, and its props are Roblox properties. The one difference is how [rem](https://docs.astra-void.xyz/vela-rbxts/guides/theming.md#rem)-scaled offsets are written: ```tsx title="React: one scaled prop each" <frame BackgroundColor3={Color3.fromRGB(49, 65, 88)} Size={__VelaRem.scale(UDim2.fromOffset(160, 0), 4)}> <uipadding PaddingTop={__VelaRem.scale(new UDim(0, 16), 0)} /> </frame> ``` ```tsx title="Vide: one binding child per instance" <frame BackgroundColor3={Color3.fromRGB(49, 65, 88)}> <uipadding>{__VelaRem.bind({ PaddingTop: new UDim(0, 16) })}</uipadding> {__VelaRem.bind({ Size: UDim2.fromOffset(160, 0) })} </frame> ``` The binding is a Vide action, so it works inside a function child. If a spread follows the `className`, each prop keeps its own binding so the spread can override it. Lowered files import from `@rbxts/vela-runtime-vide` instead of `@rbxts/vela-runtime`. With rem pinned, as in the previews on this site, nothing is scaled and the two outputs match line for line. ## A dynamic class value has to be a thunk This is the one thing you write differently. A Vide component body runs once, so a class that changes must be a function, like any other derived Vide prop: ```tsx title="src/client/Button.tsx" const active = source(false); // Tracked: re-read whenever `active` changes. <textbutton className={() => (active() ? "bg-blue-600" : "bg-slate-700")} /> // Not tracked: read once, when the component body ran. <textbutton className={active() ? "bg-blue-600" : "bg-slate-700"} /> ``` > **The untracked form is not an error** > > `className` accepts both forms, so the second line type-checks. It just never updates, and nothing warns you. The editor works inside the function. Completions, hover, swatches, diagnostics and sorting behave as they do on a plain string. A thunk changes tracking, not compilation. Vela still sees both class strings in the source and resolves them at compile time, as it does for React. Only the `active()` test is wrapped. Both targets produce the same two `__velaRules`. Only the line inside `__velaTests` and the runtime import differ: **Vide** ```tsx title="src/client/Button.tsx" import Vide, { source } from "@rbxts/vide"; export function Button() { const active = source(false); return ( <textbutton className={() => (active() ? "bg-blue-600" : "bg-slate-700")} Text="Ready" /> ); } ``` ```tsx title="Emitted for Vide" import { createVelaRuntimeHost } from "@rbxts/vela-runtime-vide"; import type { VelaRuntimeHostComponent } from "@rbxts/vela-runtime-vide"; const VelaRuntimeHost = createVelaRuntimeHost({ "preflight": true, "theme": { "colors": {}, "radius": {}, "spacing": {}, "fontFamily": {}, "screens": {}, "rem": { "base": 16.0, "min": 8.0, "max": 64.0, "baseResolution": { "x": 1920.0, "y": 1020.0 } }, "replaced": [ "colors", "radius", "spacing", "fontFamily", "screens" ] }, "plugins": { "utilities": {} } }) as unknown as VelaRuntimeHostComponent; import Vide, { source } from "@rbxts/vide"; export function Button() { const active = source(false); return (<VelaRuntimeHost Text="Ready" BorderSizePixel={(0 as never)} BackgroundTransparency={(1 as never)} __velaRules={[ { "condition": { "kind": "test", "index": 0, "expected": true }, "effects": { "props": [ { "name": "BackgroundColor3", "value": "Color3.fromRGB(21, 93, 252)" }, { "name": "BackgroundTransparency", "value": "0" } ], "helpers": [] } }, { "condition": { "kind": "test", "index": 0, "expected": false }, "effects": { "props": [ { "name": "BackgroundColor3", "value": "Color3.fromRGB(49, 65, 88)" }, { "name": "BackgroundTransparency", "value": "0" } ], "helpers": [] } } ]} __velaTests={[ ()=>active() ? true : false ]} __velaTag={"textbutton"}/>); } ``` **React** ```tsx title="src/client/Button.tsx" import React, { useState } from "@rbxts/react"; export function Button() { const [active] = useState(false); return ( <textbutton className={active ? "bg-blue-600" : "bg-slate-700"} Text="Ready" /> ); } ``` ```tsx title="Emitted for React" import { createVelaRuntimeHost } from "@rbxts/vela-runtime"; import type { VelaRuntimeHostComponent } from "@rbxts/vela-runtime"; const VelaRuntimeHost = createVelaRuntimeHost({ "preflight": true, "theme": { "colors": {}, "radius": {}, "spacing": {}, "fontFamily": {}, "screens": {}, "rem": { "base": 16.0, "min": 8.0, "max": 64.0, "baseResolution": { "x": 1920.0, "y": 1020.0 } }, "replaced": [ "colors", "radius", "spacing", "fontFamily", "screens" ] }, "plugins": { "utilities": {} } }) as unknown as VelaRuntimeHostComponent; import React, { useState } from "@rbxts/react"; export function Button() { const [active] = useState(false); return (<VelaRuntimeHost Text="Ready" BorderSizePixel={(0 as never)} BackgroundTransparency={(1 as never)} __velaRules={[ { "condition": { "kind": "test", "index": 0, "expected": true }, "effects": { "props": [ { "name": "BackgroundColor3", "value": "Color3.fromRGB(21, 93, 252)" }, { "name": "BackgroundTransparency", "value": "0" } ], "helpers": [] } }, { "condition": { "kind": "test", "index": 0, "expected": false }, "effects": { "props": [ { "name": "BackgroundColor3", "value": "Color3.fromRGB(49, 65, 88)" }, { "name": "BackgroundTransparency", "value": "0" } ], "helpers": [] } } ]} __velaTests={[ active ? true : false ]} __velaTag={"textbutton"}/>); } ``` ## What the runtime host does differently On a host element, nothing you need to handle. The Vide host keeps each property in sync with the current classes. A property that drops out goes back to what the element declared, or to the Roblox default. Interaction variants, `transition-*`, `animate-*`, text transforms, `divide-*` and `opacity-*` all behave as they do under React. So do `touch:`, `gamepad:` and `dark:`. They update when a gamepad is plugged in, when the `VelaColorScheme` attribute changes, or when `LocalPlayer` arrives late. Two limits come from how Vide works, and both affect components. ### A component element's props are fixed at the call Vide passes props to a component once, when it's called. So the set of props Vela can pass down is fixed at that moment: ```tsx title="Both branches are known when Card is called" <Card className={() => (loud() ? "bg-red-500 rounded-xl" : "bg-slate-700")} /> ``` This works, because Vela reads both branches up front and passes both `BackgroundColor3` and the `UICorner`. A prop that no branch names at call time can't be added later. Host elements don't have this limit. ### A late `m-*` cannot be honoured A margin is a wrapper instance around the element. Vide parents an element as soon as it's built, so the wrapper can't be added afterwards. When a class value names `m-*` anywhere Vela can see it, Vela emits `__velaMarginBox` and the host builds the wrapper first: **Vide** ```tsx title="src/client/Panel.tsx" import Vide from "@rbxts/vide"; export function Panel(p: { big: () => boolean }) { return <frame className={() => (p.big() ? "m-4 p-2" : "p-2")} />; } ``` ```tsx title="Emitted for Vide" import { createVelaRuntimeHost } from "@rbxts/vela-runtime-vide"; import type { VelaRuntimeHostComponent } from "@rbxts/vela-runtime-vide"; const VelaRuntimeHost = createVelaRuntimeHost({ "preflight": true, "theme": { "colors": {}, "radius": {}, "spacing": {}, "fontFamily": {}, "screens": {}, "rem": { "base": 16.0, "min": 8.0, "max": 64.0, "baseResolution": { "x": 1920.0, "y": 1020.0 } } }, "plugins": { "utilities": {} } }) as unknown as VelaRuntimeHostComponent; import Vide from "@rbxts/vide"; export function Panel(p: { big: () => boolean; }) { return <VelaRuntimeHost className={()=>p.big() ? "m-4 p-2" : "p-2"} BorderSizePixel={(0 as never)} BackgroundTransparency={(1 as never)} __velaMarginBox={true} __velaTag={"frame"}/>; } ``` **React** ```tsx title="src/client/Panel.tsx" import React from "@rbxts/react"; export function Panel(props: { big: boolean }) { return <frame className={props.big ? "m-4 p-2" : "p-2"} />; } ``` ```tsx title="Emitted for React" import { createVelaRuntimeHost } from "@rbxts/vela-runtime"; import type { VelaRuntimeHostComponent } from "@rbxts/vela-runtime"; const VelaRuntimeHost = createVelaRuntimeHost({ "preflight": true, "theme": { "colors": {}, "radius": {}, "spacing": {}, "fontFamily": {}, "screens": {}, "rem": { "base": 16.0, "min": 8.0, "max": 64.0, "baseResolution": { "x": 1920.0, "y": 1020.0 } } }, "plugins": { "utilities": {} } }) as unknown as VelaRuntimeHostComponent; import React from "@rbxts/react"; export function Panel(props: { big: boolean; }) { return <VelaRuntimeHost className={props.big ? "m-4 p-2" : "p-2"} BorderSizePixel={(0 as never)} BackgroundTransparency={(1 as never)} __velaTag={"frame"}/>; } ``` React doesn't need this, because it renders the wrapper and the margin together. If a margin arrives from a value Vela can't see into, such as a function call, the runtime warns instead of rendering without the margin. ## Naming the target explicitly Set `framework` in `vela.config.ts` to choose the target yourself: ```ts title="vela.config.ts" import { defineConfig } from "vela-rbxts"; export default defineConfig({ framework: "vide" }); ``` Writing the key at all turns detection off. `framework: "react"` forces React even with a Vide `jsxFactory`. Most Vide projects don't need either. You need `framework: "vide"` only when detection can't find your factory. Detection walks up from each source file to the nearest `tsconfig.json`. It follows a relative `extends` up to eight levels and reads `compilerOptions.jsxFactory`. A factory starting with `Vide.` selects Vide. Anything else, or nothing found, means React. A non-relative `extends`, or one nested deeper than eight levels, is missed. > **One target per project** > > `jsxFactory` applies to the whole program, so a project can't mix React and Vide files. ## Writing the declaration file Same as React. One import adds `className` to both `React.Attributes` and `Vide.Attributes`: ```ts title="src/vela-env.d.ts" import "vela-rbxts"; ``` ## See also - [Dynamic class names](https://docs.astra-void.xyz/vela-rbxts/guides/dynamic-class-names.md): what a branch costs, on both targets. - [`framework`](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#framework): the config key. - [Release notes](https://docs.astra-void.xyz/vela-rbxts/reference/release-notes.md#0120): what shipped with Vide support. --- # Recipes > Small, complete UI patterns — buttons, badges, meters, list rows, a dialog — compiled and rendered live. Source: https://docs.astra-void.xyz/vela-rbxts/guides/recipes/ This page builds the small pieces most Roblox interfaces are made of. Each preview is compiled by the same compiler `rbxtsc` uses. The Classes tab shows the source and the Lowered tab shows the output. The previews all stay on the [static path](https://docs.astra-void.xyz/vela-rbxts/getting-started/how-it-works.md#the-two-lowering-paths). Two habits repeat throughout: - Give everything an explicit size. Roblox instances start at zero size, so most examples set `w-*` and `h-*`. Backgrounds already start transparent ([preflight](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#preflight)), so you don't need `bg-transparent`. - Rows and columns are `UIListLayout`. An element with `flex`, `gap-*`, `justify-*` or `items-*` gets one `UIListLayout` child, which positions every child. See [layout and sizing](https://docs.astra-void.xyz/vela-rbxts/guides/layout-and-sizing.md). ## Buttons _Interactive preview: Filled, outlined, and destructive — the outline is a UIStroke, and everything else is four utility families._ A button is a `textbutton` with a size, a radius, a background and text classes. The outlined version adds `border border-slate-600`, which becomes a `UIStroke` child. Add hover and press feedback with [`hover:` and `active:`](https://docs.astra-void.xyz/vela-rbxts/guides/responsive-and-input-variants.md#hover-active-and-focus-are-per-element). Add `transition` to tween the change: ```tsx title="Hover and press tween the fill over 150ms" <textbutton className="w-28 h-10 rounded-md bg-sky-500 hover:bg-sky-600 active:bg-sky-700 transition duration-150 text-white text-sm font-semibold" Text="Play" /> ``` Variants put the button on the [runtime path](https://docs.astra-void.xyz/vela-rbxts/guides/dynamic-class-names.md). Gamepad and touch players may never hover, so use hover only as extra feedback. To keep a button fully static, track the press yourself and switch between two complete elements: ```tsx title="src/client/ActionButton.tsx" export function ActionButton(props: { label: string; onClick: () => void }) { const [pressed, setPressed] = React.useState(false); return pressed ? ( <textbutton className="w-28 h-10 rounded-md bg-sky-600 text-white text-sm font-semibold" Text={props.label} Event={{ Activated: props.onClick, MouseButton1Up: () => setPressed(false), MouseButton1Down: () => setPressed(true), }} /> ) : ( <textbutton className="w-28 h-10 rounded-md bg-sky-500 text-white text-sm font-semibold" Text={props.label} Event={{ Activated: props.onClick, MouseButton1Up: () => setPressed(false), MouseButton1Down: () => setPressed(true), }} /> ); } ``` Each branch is a plain literal, so the button needs no runtime host. Buttons don't size to their label. `w-fit` and `h-fit` lower to `AutomaticSize`, but a fixed `w-28 h-10` is more predictable in a row of buttons. ## Badges _Interactive preview: Status pills: rounded-full, a dark shade for the fill, a light shade of the same palette for the text._ A pill is a `textlabel` with `rounded-full`. That's `new UDim(0.5, 0)`, half the label's height, so it stays a capsule at any size. Roblox centers label text by default, so you need no alignment classes. For the colors, take the fill from the dark end of a palette, the border one step lighter, and the text from the light end. Every palette has the same eleven shades, so this works with any hue. ## Stat bars _Interactive preview: A meter is a track and a fill: the fraction is the value, and the fill sits at the track's origin because a plain frame does not lay out its children._ A meter is a `rounded-full` track with a plain child fill at `w-2/3 h-full`. The track has no `UIListLayout`, so the fill sits at its top-left corner. `w-2/3` means two thirds of the track. For live data, set `Size` directly instead of computing a class: ```tsx title="The fraction is data — pass it as a prop" <frame className="w-72 h-2 rounded-full bg-slate-800"> <frame className="rounded-full bg-emerald-500" Size={UDim2.fromScale(health, 1)} /> </frame> ``` **Don't set the same property from a class and a prop.** The prop wins, the class is left out, and the build warns `explicit-prop-overrides-class`. ## List rows _Interactive preview: A column of rows, each row its own UIListLayout. Column widths are chosen so rank, avatar, name, and score fill the row exactly._ A list is a `flex flex-col gap-2` column of `flex items-center gap-3` rows. Each one gets its own `UIListLayout`. The score reaches the right edge because the column widths and gaps add up to the row's width. `justify-between` also works in a real place, where it lowers to `UIListLayout.HorizontalFlex`. The preview renderer doesn't support it. Fixed widths are also what you want when a column must not shrink. A literal `className` inside a `.map()` callback is still static: ```tsx title="Still the static path" {entries.map((entry, index) => ( <frame className="flex items-center gap-3 w-full h-9 px-3 rounded-md bg-slate-800" key={entry.id}> {/* … */} </frame> ))} ``` What counts is the expression in the attribute, not where it appears. ## A confirmation dialog _Interactive preview: Column layout, wrapped body text, and a justify-end button row — the alignment half of justify-*, which is plain UIListLayout._ The dialog is a `gap-3` column with a `text-wrap` body and a `justify-end` button row, which lowers to `HorizontalAlignment = Right`. Text doesn't wrap by default, so long text clips without `text-wrap`. For a modal, put the card inside a full-screen scrim: ```tsx title="src/client/Modal.tsx" <frame className="size-full bg-slate-950/60 z-50"> <frame className="origin-center left-1/2 top-1/2 w-96 h-40 …">{/* the card */}</frame> </frame> ``` - `bg-slate-950/60` fades only the scrim's background. `opacity-60` would fade the card too, because it applies to everything inside the element. - `origin-center` sets `AnchorPoint` to `(0.5, 0.5)`, so `left-1/2 top-1/2` centers the card. - `z-50` raises `ZIndex` above the rest of the interface. ## When a recipe needs state Every pattern here eventually meets data: a selected tab, a disabled button, a filling meter. - The look changes between known states: branch the classes, as in `["w-28 h-10 rounded-md", on ? "bg-sky-600" : "bg-slate-700"]`. Both looks are resolved and checked. To skip the runtime host as well, switch between two whole elements, as the button does. - A number changes continuously: keep the classes static and set the property directly, as the meter does. - The state is hover, press or focus: use `hover:`, `active:` or `focus:`, ideally with `transition`. Avoid building class names in template strings, such as `` `bg-${color}-500` ``. They still resolve, but nothing checks them, so a typo renders as nothing on a clean build. See [dynamic class names](https://docs.astra-void.xyz/vela-rbxts/guides/dynamic-class-names.md), or the short version in the [five rules](https://docs.astra-void.xyz/vela-rbxts/getting-started/how-it-works.md#five-rules-that-keep-you-on-the-static-path). ## See also - [Your first component](https://docs.astra-void.xyz/vela-rbxts/getting-started/first-component.md): the same walkthrough, one utility at a time. - [Layout and sizing](https://docs.astra-void.xyz/vela-rbxts/guides/layout-and-sizing.md): the layout model these recipes use. - [Troubleshooting](https://docs.astra-void.xyz/vela-rbxts/guides/troubleshooting.md): when a recipe doesn't look like its preview. --- # Troubleshooting > Find the fix by symptom, especially for problems the build doesn't report. Source: https://docs.astra-void.xyz/vela-rbxts/guides/troubleshooting/ Most mistakes show up as [diagnostics](https://docs.astra-void.xyz/vela-rbxts/reference/diagnostics.md). This page covers the rest: something looks wrong and the build said nothing. > **Upgrade first** > > Many silent problems are fixed in newer releases. Check your version with `npm ls @vela-rbxts/compiler` > and skim the [release notes](https://docs.astra-void.xyz/vela-rbxts/reference/release-notes.md). ## "A class did nothing" Most likely causes first: 1. **The utility doesn't apply to that element.** `<frame className="text-red-500" />` compiles, but a Frame has no `TextColor3`. The editor warns `unsupported-host-utility`. The build does not. 2. **The class is on a component that doesn't forward it.** `<Panel className="p-4" />` passes `Panel` props and helper children. `Panel` must spread unknown props onto a host element and render `children`. See [How it works](https://docs.astra-void.xyz/vela-rbxts/getting-started/how-it-works.md#classname-on-components). 3. **The class is computed at runtime.** A typo in a computed string isn't checked. See [dynamic class names](https://docs.astra-void.xyz/vela-rbxts/guides/dynamic-class-names.md). 4. **Your roblox-ts drops Vela's warnings.** Vela reports through `context.addDiagnostic`. Test it by compiling `className="bg-nope-500"`. You should see a warning. 5. **The editor stays quiet while you type a partial key.** `bg-slat` has no squiggle because it's a prefix of a real key. The build still warns. 6. **`transition` on an element that never changes.** It's dropped with `transition-without-runtime`. Add the `hover:` or breakpoint rule it should animate. ## "The editor flags a class the build accepts" The build is the source of truth, so this is an editor bug. Upgrade the extension. The one intended difference: per-element rules (`unsupported-host-utility`) are checked only in the editor. The editor also has two lints the build never runs: `overridden-class` and `canonical-class`. To quiet one, set it to `"ignore"` in [`velaRbxts.lint`](https://docs.astra-void.xyz/vela-rbxts/guides/editor-setup.md#settings). ## "The editor ignores a class list outside `className`" The editor reads a `const` string only when a `className` names it, and only one the compiler would lower. These are skipped: - a `let`, or a `const` declared after the `className` that uses it - a `const` declared inside another function - the arguments of a helper called outside a `className`, such as `cva(...)` at the top of the file For the helper case, add its name to [`velaRbxts.classFunctions`](https://docs.astra-void.xyz/vela-rbxts/guides/editor-setup.md#settings), and pass `--class-functions` to `vela sort` so the CLI sorts the same lists. ## "`vela sort --check` passes on a file I know is unsorted" Check the path. A file or directory that doesn't exist is skipped, and the check still exits `0`: ```bash npx vela sort --check src/nope.tsx # prints nothing, exits 0 ``` Also check that the list is one the sort reads. A helper's arguments are sorted only with `--class-functions`. ## "A breakpoint or orientation variant never applies" - Chained variants like `md:touch:` need every condition to match. - Breakpoints are minimum widths, so a phone-sized viewport matches none of them. - A square viewport counts as `landscape`. ## "The layout is wrong" **`left-*` or `top-*` is ignored.** The parent has a `UIListLayout` (from `flex`, `gap-*` or `space-*`), which controls child positions. Position elements only inside a plain frame. **An element sits outside its parent with `right-*` or `bottom-*`.** These place the element's top-left corner. Add the matching origin: `right-2 bottom-2 origin-bottom-right`. **`justify-*` behaves strangely.** `justify-center` and `justify-between` set different properties and interact. Use one. See [layout and sizing](https://docs.astra-void.xyz/vela-rbxts/guides/layout-and-sizing.md#justify--splits-across-two-properties). **Spacing is bigger than expected.** Margins add to the parent's `gap-*`. Use `gap-*` alone for list spacing. **Items in a `divide-*` list are out of order.** Vela sets each child's `LayoutOrder`. With React: - A component child must forward `LayoutOrder` to its root element. - An `order-*` the parent can't read, such as `hover:order-1`, warns `divide-unreadable-order`. **`order-*` does nothing.** You wrote the layout instance yourself, and its `SortOrder` defaults to `Name`. Set `SortOrder={Enum.SortOrder.LayoutOrder}`. ## "The colors are wrong" **An element disappeared.** [Preflight](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#preflight) makes every classed host element start transparent. Add a `bg-*`, or set `preflight: false`. **A gradient is a flat color.** One stop is `transparent`, which is dropped without a warning. **`bg-*` is ignored next to a gradient.** Intended. A gradient sets the background to white so its colors show correctly. **A theme color reports `unknown-theme-key`.** Either a top-level `theme.colors` replaced your `theme.extend.colors` and the built-in palette, or a `vela.config.ts` in a subfolder is shadowing the root one. See [merge semantics](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#merge-semantics). **Overlapping children darken where they overlap.** `opacity-*` fades each element separately. Add `isolate` to the parent `frame` to fade the group as one layer. It must not be inside a variant or branch. **A theme color works on static elements but not dynamic ones.** At runtime, Vela only reads `Color3.fromRGB(r, g, b)` and `new UDim(a, b)` with plain numbers. See [theming](https://docs.astra-void.xyz/vela-rbxts/guides/theming.md). ## "Everything is bigger or smaller than expected" Pixel values scale with the viewport ([rem](https://docs.astra-void.xyz/vela-rbxts/guides/theming.md#rem)), clamped between 8 and 64 by default. To turn scaling off while you debug: ```ts title="vela.config.ts" export default defineConfig({ theme: { rem: { min: 16, max: 16 } } }); ``` `TextSize` stops at 100, the most Roblox supports. ## "A prop or a spread I wrote is ignored" A prop you write on the element beats the class. The build warns: ```text explicit-prop-overrides-class: Vela: `bg-red-500` generates BackgroundColor3, but this element already declares BackgroundColor3. The declared BackgroundColor3 wins, so the class does not emit one; remove the class or the prop. ``` A helper child, such as `<uicorner>`, beats `rounded-lg` the same way (`explicit-helper-overrides-class`). Spreads follow JSX order. In `<textbutton className="bg-slate-700" {...props} />`, `props.BackgroundColor3` wins. Put `className` after the spread to make the class win. ## "The build fails with `runtime-not-installed`" Rojo only maps `node_modules/@rbxts`, and Vela's runtime isn't there. - **pnpm:** add `publicHoistPattern: ["*@rbxts*"]` to `pnpm-workspace.yaml` (or set `nodeLinker: hoisted`) and reinstall. - **npm:** run `npm ls @rbxts/vela-runtime`. If it's nested under `vela-rbxts`, pin `@rbxts/react@17.3.7-ts.2` and `@rbxts/react-roblox@17.3.7-ts.2`, delete `package-lock.json`, and reinstall. Newer `@rbxts/react` prereleases fall outside the runtime's peer range. - **Version mismatch:** keep every `@rbxts/vela-runtime*` package at the `vela-rbxts` version. ## "The build fails on a Vela error" Any Vela error stops the build, and the failing file isn't emitted. Common causes: - `config-resolution-failed`: your config doesn't load. It's checked on every build. - `compiler-unavailable`: the native compiler couldn't load on this platform. - A `vela.css` syntax error. See [`vela.css`](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#velacss). ## "A margin has no effect under Vide" Under Vide, the compiler must see `m-*` classes directly. A margin coming from a function call it can't read is skipped with a warning. Write the class where the compiler can see it. See [the Vide guide](https://docs.astra-void.xyz/vela-rbxts/guides/vide.md). ## "`className` is a type error" Add the declaration file `src/vela-env.d.ts` containing `import "vela-rbxts";`. Don't name it `src/vela-rbxts.d.ts`, because the import then points at itself. See [installation](https://docs.astra-void.xyz/vela-rbxts/getting-started/installation.md#declare-the-classname-prop). ## "The build fails on the first file with `compiler-invocation-failed`" If the message is `Cannot read properties of undefined (reading 'Latest')`, your TypeScript is too new. Use `typescript@5.9.3` or 6.x. Otherwise, check your platform has a [prebuilt binary](https://docs.astra-void.xyz/vela-rbxts/reference/api.md#prebuilt-compiler-binaries). Windows on ARM and Linux arm64 musl don't. ## "The build fails on `vela.config.ts`" ```text title="rbxtsc output" src/vela.config.ts:1:30 - error TS roblox-ts: You cannot use modules directly under node_modules. ``` The config file is inside `src`, so roblox-ts compiles it as game code. Move it to the project root. If ESLint then reports the file as outside the project, add an ESLint override for it, or use `vela.config.json`. Don't add it to `tsconfig.json`'s `include`. ## "Nothing is being transformed at all" - The file must end in `.tsx`. Class names in `.ts` files are ignored. - The tsconfig plugin must be `vela-rbxts/transformer`, with the subpath. - The transformer only runs under `rbxtsc`, not plain `tsc`. - Files with no `className` and no JSX are skipped. This is [configurable](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#tsconfig-plugin-options). ## "The output is bigger than expected" A computed `className`, or an element with a spread, pulls the theme tables into the output. Writing each branch out as a literal string usually avoids that. ## Still stuck? Build the smallest example that shows the problem and read the emitted TSX. A static element keeps its tag and gains plain props. A runtime element becomes `VelaRuntimeHost`. The [five rules](https://docs.astra-void.xyz/vela-rbxts/getting-started/how-it-works.md#five-rules-that-keep-you-on-the-static-path) explain how to stay static. --- # Utility reference > Every utility class, the exact values it accepts, and what it lowers to. Source: https://docs.astra-void.xyz/vela-rbxts/reference/utilities/ Every class Vela compiles is on this page. If a class is not here, Vela does not implement it. [Diagnostics](https://docs.astra-void.xyz/vela-rbxts/reference/diagnostics.md) explains each warning named below. Each utility lowers to a Roblox property or to a helper instance Vela adds as a child, such as `UIPadding`, `UIStroke` or `UICorner`. An element gets one of each helper, shared by every class that targets it: `p-4 px-8` makes a single `UIPadding`. `UIShadow` is the exception, with [one per layer](#shadow). Margins, `divide-*` and `animate-*` build wrappers, separators or loops. They move the element onto the [runtime path](https://docs.astra-void.xyz/vela-rbxts/getting-started/how-it-works.md#the-two-lowering-paths), even in a plain string literal. The tables mark them. ## Supported elements Vela lowers `className` on these eight intrinsic elements, and on components. | Element | Notes | |---|---| | `frame` | Layout container | | `scrollingframe` | Layout container, plus `overscroll-*` and the [scrolling families](#scrolling) | | `canvasgroup` | Layout container; `opacity-*` fades the subtree as one composited layer and stops there | | `textlabel` | Text properties allowed | | `textbutton` | Text properties allowed | | `textbox` | Text properties allowed, plus `placeholder-*` | | `imagelabel` | `image-*` and `object-*` allowed | | `imagebutton` | `image-*` and `object-*` allowed | | Any component | An uppercase tag (`<Panel />`) or a member expression (`<Switch.Root />`). Every utility is allowed | Any other tag keeps its `className` untouched and reports `classname-on-unsupported-host`. That includes intrinsics such as `screengui` and namespaced tags such as `<svg:rect />`. Text classes (`text-*`, `font-*`, `leading-*`, alignment, wrapping, case, decorations) belong on the three text hosts. A class on the wrong host behaves differently per path: - The runtime path drops it. - The static path warns `unsupported-host-utility` and **writes it anyway**. `<frame className="text-red-500" />` emits `TextColor3` onto a Frame ([still open](https://docs.astra-void.xyz/vela-rbxts/reference/release-notes.md#still-open)). A component gets every utility. It must forward the props it does not use to a host element, and nothing checks that it does. See [How it works](https://docs.astra-void.xyz/vela-rbxts/getting-started/how-it-works.md#classname-on-components). ## Color | Class | Values | Roblox target | Notes | | --- | --- | --- | --- | | `bg-{color}` | theme color key, `[#hex]` | `BackgroundColor3` + `BackgroundTransparency` | | | `text-{color}` | theme color key, `[#hex]` | `TextColor3` + `TextTransparency` | Fallback branch of `text-*` | | `image-{color}` | theme color key, `[#hex]` | `ImageColor3` + `ImageTransparency` | | | `placeholder-{color}` | theme color key, `[#hex]` | `PlaceholderColor3` | No transparency channel | | `border-{color}` | theme color key, `[#hex]` | `UIStroke.Color` + `UIStroke.Transparency` | Helper instance | | `ring-{color}`, `outline-{color}` | theme color key, `[#hex]` | `UIStroke.Color` + `UIStroke.Transparency` | Same `UIStroke` as `border-*` | | `shadow-{color}` | theme color key, `[#hex]` | `UIShadow.Color` | Helper instance | | `inset-shadow-{color}`, `text-shadow-{color}` | theme color key, `[#hex]` | that layer's `UIShadow.Color` | Since 0.14.0. A `UIShadow` of its own | | `divide-{color}` | theme color key, `[#hex]` | separator `BackgroundColor3` + `BackgroundTransparency` | Runtime-structural | | `from-{color}`, `via-{color}`, `to-{color}` | theme color key, `[#hex]` | `UIGradient.Color` keypoints + `UIGradient.Transparency` | Helper instance | A color key is a literal (`black`, `white`) or a palette plus a shade from `50` to `950`. Vela splits the shade off at the last `-` only when it is one of those eleven numbers. So `bg-my-color` looks up a single key named `my-color`. A bare palette name such as `bg-slate` resolves to the palette's `DEFAULT`. Every built-in palette has one. A palette of your own needs one too, or the bare form reports `color-missing-shade`. You cannot write `DEFAULT` in a class: `bg-slate-DEFAULT` looks up a key named `slate-DEFAULT`. Hex colors work in every color family: `bg-[#3b82f6]`, `text-[#fff]`. Any other bracket payload reports `unsupported-arbitrary-value`. ### Opacity modifiers Add `/N`, an integer from 0 to 100, to set that family's transparency. `bg-blue-600/50` writes the color plus `BackgroundTransparency = 0.5`. | Family | `/N` lowers to | |---|---| | `bg-*` | `BackgroundTransparency` | | `text-*` | `TextTransparency` | | `image-*` | `ImageTransparency` | | `shadow-*`, `inset-shadow-*`, `text-shadow-*` | that layer's `UIShadow.Transparency` | | `border-*`, `ring-*`, `outline-*` | `UIStroke.Transparency` | | `divide-*` | the separator frames' `BackgroundTransparency` | | `from-*`, `via-*`, `to-*` | a `UIGradient.Transparency` sequence whose keypoints line up with the color stops | Each gradient stop fades on its own. `placeholder-*` has no transparency channel in Roblox, so `/N` there reports `unsupported-opacity-modifier`. ### Keywords - `transparent` sets the transparency to `1` and removes the color property. - On `placeholder-*` and `divide-*`, `transparent` reports `unsupported-color-key`. `divide-white/10` still works. - On gradient stops, `from-transparent`, `via-transparent` and `to-transparent` are **silently dropped**. The stop is missing from the `ColorSequence`. - `current` and `inherit` are rejected. ### Color diagnostics | Mistake | Diagnostic | |---|---| | A palette with no shade and no `DEFAULT` | `color-missing-shade` | | A shade on a literal, or a shade the palette lacks | `color-invalid-shade` | | A name not in the theme | `unknown-theme-key` | > **text-* falls back to color** > > Anything after `text-` that is not a size, alignment or wrap keyword is read as a color. A typo like `text-smal` reports `unknown-theme-key` for a color named `smal`. ## Border, ring, and outline | Class | Values | Roblox target | Notes | | --- | --- | --- | --- | | `border` | — | `UIStroke.Thickness = 1` | Bare form | | `border-{n}` | `0`, `1`, `2`, `4` | `UIStroke.Thickness` | No other numbers; use `border-[3px]` | | `border-transparent` | — | `UIStroke.Transparency = 1` | | | `border-{join}` | `round`, `bevel`, `miter` | `UIStroke.LineJoinMode` | | | `border-{color}` | theme color key, `[#hex]` | `UIStroke.Color`, `Transparency = 0` | | | `ring` | — | `UIStroke.Thickness = 3` | Also sets `ApplyStrokeMode = Border` | | `ring-{n}` | `0`, `1`, `2`, `4`, `8` | `UIStroke.Thickness` | | | `outline` | — | `UIStroke.Thickness = 2` | Also sets `ApplyStrokeMode = Border` | | `outline-none`, `outline-hidden` | — | `UIStroke.Thickness = 0` | | | `border-[{n}]`, `ring-[{n}]`, `outline-[{n}]` | pixels, with or without the unit | `UIStroke.Thickness` | Arbitrary value, since 0.7.0. A bracket is read as a color first | All three families write into one shared `UIStroke`. They do not stack like CSS rings on borders: the later class wins. `ring` and `outline` also set `ApplyStrokeMode = Border`. A bracket is read as a color first, then as a thickness. `border-[#0f0]` is a color. `border-[3px]` and `border-[3]` are a thickness. See [arbitrary values](#arbitrary-values). Rejected values: - `border-*` reports `unsupported-border-value` for `dashed`, `solid`, `dotted`, `double`, every side form (`border-x`, `border-t-2`) and `border-opacity-*`. Use `/N` for opacity: `border-red-500/50`. - `ring-*` and `outline-*` report `unsupported-stroke-value` for `inset`, the four styles, `offset-*`, and any unbracketed thickness not in the table. ## Radius | Class | Values | Roblox target | Notes | | --- | --- | --- | --- | | `rounded` | — | `UICorner.CornerRadius` | The theme's `DEFAULT` radius, 4px by default | | `rounded-{key}` | any key in `theme.radius` | `UICorner.CornerRadius` | Pure theme lookup | | `rounded-[{n}]` | pixels, percent | `UICorner.CornerRadius` | Arbitrary value, since 0.7.0 | | `rounded-t-{key}`, `rounded-b-{key}` | any key in `theme.radius`, or a bracketed value | `UICorner.TopLeftRadius` + `TopRightRadius`, `BottomLeftRadius` + `BottomRightRadius` | Since 0.13.0. The other pair is squared to `0` | | `rounded-l-{key}`, `rounded-r-{key}` | any key in `theme.radius`, or a bracketed value | `UICorner.TopLeftRadius` + `BottomLeftRadius`, `TopRightRadius` + `BottomRightRadius` | Since 0.13.0. The other pair is squared to `0` | | `rounded-tl-{key}`, `rounded-tr-{key}`, `rounded-bl-{key}`, `rounded-br-{key}` | any key in `theme.radius`, or a bracketed value | The one matching `UICorner` radius property | Since 0.13.0. Beats `rounded-{key}` on the corner it names, in either order | The default keys are `DEFAULT` (bare `rounded`), `none`, `xs`, `sm`, `md`, `lg`, `xl`, `2xl`, `3xl`, `4xl` and `full`. There is no numeric fallback, so `rounded-8` is `unknown-theme-key`. Write `rounded-[8px]` instead. A directional class squares off the corners it does not name, so `rounded-r-lg` alone leaves the left side flat. It beats the all-corner shorthand on its corners, in either order: ```tsx title="Both round the left pair to lg and the right pair to md" <frame className="rounded-l-lg rounded-md" /> <frame className="rounded-md rounded-l-lg" /> ``` A variant can fill in the rest: `rounded-l-lg hover:rounded-md`. ## Shadow | Class | Values | Roblox target | Notes | | --- | --- | --- | --- | | `shadow` | — | `UIShadow` preset | blur 3, offset Y 1, spread 0, transparency `0.9` | | `shadow-sm` | — | `UIShadow` preset | 2 / 1 / 0 / `0.95` | | `shadow-md` | — | `UIShadow` preset | 6 / 4 / −1 / `0.9` | | `shadow-lg` | — | `UIShadow` preset | 15 / 10 / −3 / `0.9` | | `shadow-xl` | — | `UIShadow` preset | 25 / 20 / −5 / `0.9` | | `shadow-2xl` | — | `UIShadow` preset | 50 / 25 / −12 / `0.75` | | `shadow-none` | — | `UIShadow.Enabled = false` | | | `shadow-{color}` | theme color key, `[#hex]` | `UIShadow.Color` | `shadow-transparent` instead sets `Transparency = 1` | | `shadow-inner` | — | `UIShadow` with `Inset = true` | Since 0.14.0, the same as `inset-shadow-sm` | | `inset-shadow-2xs`, `inset-shadow-xs`, `inset-shadow-sm` | — | `UIShadow` with `Inset = true` | Since 0.14.0. 0 / 1 / `0.95`, 1 / 1 / `0.95`, 4 / 2 / `0.95`. Studio beta | | `text-shadow-2xs`, `text-shadow-xs`, `text-shadow-sm`, `text-shadow-md`, `text-shadow-lg` | — | `UIShadow` with `Mode = Text` | Since 0.14.0. Blur 0 / 1 / 2 / 4 / 8. Studio beta | | `inset-shadow-none`, `text-shadow-none` | — | that layer's `UIShadow.Enabled = false` | | Presets set `BlurRadius`, `Offset`, `Transparency`, and `Spread` when it is non-zero. A drop shadow, an inset shadow and a text shadow each get their own `UIShadow`. So `shadow-md inset-shadow-xs text-shadow-lg` puts three on one element. `opacity-*`, `transition-shadow` and rem scaling reach all three. `inset-shadow-*` and `text-shadow-*` have no bare form. `text-shadow` alone is read as a text color named `shadow`. Where Tailwind stacks several text-shadow layers, Vela uses the widest one with their combined alpha. > **Inset and text shadows are Studio beta** > > Roblox ships both modes in Studio beta. They do not render in a live game until Roblox releases them. Drop shadows are unaffected. ## Gradient | Class | Values | Roblox target | Notes | | --- | --- | --- | --- | | `bg-gradient-to-{dir}` | `t`, `tr`, `r`, `br`, `b`, `bl`, `l`, `tl` | `UIGradient.Rotation` | Rotations 270, 315, 0, 45, 90, 135, 180, 225 | | `bg-linear-to-{dir}` | same | same | Accepted alias | | `from-{color}`, `via-{color}`, `to-{color}` | theme color key, `[#hex]` | `UIGradient.Color` | | `Rotation` is written only when it is non-zero. The element's `BackgroundColor3` is forced to white so it does not tint the gradient. That overrides any `bg-*` on the same element. A bad direction reports `unsupported-gradient-direction`. ## Z-index | Class | Values | Roblox target | Notes | | --- | --- | --- | --- | | `z-{n}` | `0`, `10`, `20`, `30`, `40`, `50` | `ZIndex` | Exactly these six | | `z-[{n}]` | any non-negative integer | `ZIndex` | Arbitrary value, since 0.7.0 | Use `z-[15]` for a level the presets do not cover. The value must be a whole number. | Class | Diagnostic | |---|---| | `z-[1.5]` | `unsupported-arbitrary-z-index` | | `z-auto` | `unsupported-z-index-auto` | | `-z-N`, `-z-[N]` | `unsupported-negative-z-index` | | Any other unbracketed number | `unsupported-z-index-value` | ## Padding All padding writes into one `UIPadding`. | Class | Values | Roblox target | | --- | --- | --- | | `p-{key}` | spacing value | `PaddingTop`, `PaddingRight`, `PaddingBottom`, `PaddingLeft` | | `px-{key}` | spacing value | `PaddingLeft`, `PaddingRight` | | `py-{key}` | spacing value | `PaddingTop`, `PaddingBottom` | | `pt-{key}` | spacing value | `PaddingTop` | | `pr-{key}` | spacing value | `PaddingRight` | | `pb-{key}` | spacing value | `PaddingBottom` | | `pl-{key}` | spacing value | `PaddingLeft` | ### Spacing values A spacing key is looked up in `theme.spacing` first. Otherwise any non-negative multiple of `0.5` becomes `new UDim(0, key * 4)`. So `p-1.5` is 6 pixels and `p-40` is 160. `p-0.25` reports `unknown-theme-key`. The default theme defines only one spacing key, `"4"`. Every other number comes from that rule. ## Arbitrary values A bracket sets a value directly instead of using a scale. There are two kinds: - **Colors**: `[#rgb]` and `[#rrggbb]`, in every color family. - **Lengths**: `[16px]`, `[16]`, `[50%]`, `[1rem]`, and their negatives. A bare number means pixels. A percentage is the scale part of a `UDim`: `w-[50%]` is `UDim2.fromScale(0.5, 0)`. A `rem` uses `theme.rem.base` and scales with the viewport. | Family | Reads a bracket as | Example | |---|---|---| | Spacing — `p-*`, `m-*`, `gap-*`, `space-*` | Length | `p-[12px]`, `-mt-[8px]` | | Size — `w-*`, `h-*`, `size-*`, `min-*`, `max-*` | Length | `w-[120px]`, `h-[50%]` | | Position — `left-*`, `top-*`, `inset-*`, `translate-*` | Length | `left-[25%]`, `-left-[10px]` | | Radius — `rounded-*` | Length | `rounded-[6px]` | | Scrollbar width — `scrollbar-w-*` | Length | `scrollbar-w-[6px]` | | `text-*` | Length, read as `TextSize` | `text-[13px]` | | `leading-*` | Number, read as `LineHeight` | `leading-[1.6]` | | `rotate-*` | Number, read as degrees | `rotate-[17deg]` | | `z-*` | Integer, read as `ZIndex` | `z-[15]` | | `border-*`, `ring-*`, `outline-*` | Length, read as `Thickness` | `border-[3px]` | | `aspect-*` | Ratio | `aspect-[16/9]` | A payload the family cannot read reports `unsupported-arbitrary-value` and is dropped. Other families take no bracket: there is no `font-[…]`, no `duration-[…]` and no grid template. A space inside brackets does not split the class. `w-[calc(100% - 4px)]` is one token with one diagnostic, since no family reads `calc()`. An unclosed bracket does split, so the classes after a typo still apply. ## Margin Roblox has no margins, so Vela wraps the element in a transparent frame padded by the margin. A positive margin moves the element onto the [runtime path](https://docs.astra-void.xyz/vela-rbxts/guides/dynamic-class-names.md), even in a plain string literal. `m-0`, `mb-0` and `-ml-0` emit nothing and stay static. | Class | Values | Effect | Notes | | --- | --- | --- | --- | | `m-{key}` | spacing value | margin box, all four sides | Runtime-structural. `m-0` emits nothing and stays static | | `mx-{key}`, `my-{key}` | spacing value | margin box, one axis | Runtime-structural | | `mt-{key}`, `mr-{key}`, `mb-{key}`, `ml-{key}` | spacing value | margin box, one side | Runtime-structural | | `-mt-{key}`, `-ml-{key}` | spacing value | `Position` shift | Negative top/left margins move, not wrap | | `-mr-{key}`, `-mb-{key}` | — | — | `unsupported-negative-margin` | | `mx-auto` | — | `AnchorPoint.X = 0.5`, `Position.X = 0.5` scale | **Static** — centers without a wrapper | | `my-auto` | — | `AnchorPoint.Y = 0.5`, `Position.Y = 0.5` scale | **Static** | Margins add to the parent's `gap-*`. A `gap-2` list whose children have `my-2` gets 16-pixel gaps, not 8. For space between list children, use `gap-*` on the parent instead. It stays on the static path. A negative top or left margin shifts the element instead of wrapping it. Each side holds one signed value, and the last class wins: - `ml-4 -ml-2` shifts by 8. - `-ml-2 ml-4` pads by 16. - `-ml-0` clears what came before it. The wrapper takes the element's `Size`, `Position`, `AnchorPoint`, `LayoutOrder` and `ZIndex`, and tweens with it. Variant margins such as `mt-2 hover:mt-4` work, but the padding changes instantly. ## Gap and space | Class | Values | Roblox target | Notes | | --- | --- | --- | --- | | `gap-{key}` | spacing value | `UIListLayout.Padding` | No `gap-x-` or `gap-y-`. On a `grid`, `CellPadding` instead | | `space-x-{key}` | spacing value | `UIListLayout.Padding` + `FillDirection = Horizontal` | | | `space-y-{key}` | spacing value | `UIListLayout.Padding` + `FillDirection = Vertical` | | `UIListLayout` has one padding axis, so there is no `gap-x-*` or `gap-y-*`. `space-y-2` is exactly `flex flex-col gap-2`. An unresolvable value reports `unsupported-space-value`. `space-x-reverse` is not implemented. On a `grid`, `gap-*` sets `UIGridLayout.CellPadding` instead. See [grid](#grid). ## Divide `divide-*` inserts separator frames between the element's children. Every divide class moves the element onto the runtime path. | Class | Values | Effect | Notes | | --- | --- | --- | --- | | `divide-x`, `divide-y` | — | 1px separators between children, horizontal / vertical | | | `divide-x-{n}`, `divide-y-{n}` | `0`, `1`, `2`, `4`, `8` | separator thickness | `0` removes the separators | | `divide-{color}` | theme color key, `[#hex]` | separator `BackgroundColor3` | | Items sit `gap + thickness` apart, as in CSS. Vela sets the list's `Padding` to 0 and gives the gap to each separator. A `Padding` you wrote on your own `<uilistlayout>` is left alone. **Vela overwrites your children's `LayoutOrder`.** It ranks each child by its declared order, ties in source order. The child ranked *r* gets `LayoutOrder = 2r` and the separator after it `2r + 1`. On React, a component child must forward `LayoutOrder` to its root. Separators fade with `opacity-*` on the element or an ancestor. | Diagnostic | When | |---|---| | `divide-without-list-layout` | Nothing gives the element a list layout, so every separator stacks at the corner. Add `flex`, `flex-col` or `space-*` | | `divide-with-grid` | The element is a `grid`, so each separator would take a cell | | `divide-unreadable-order` | React only. A child's `order-*` sits under a variant, in a class value branch, or in a class value left to the runtime. The parent ranks by the static order instead | An unresolvable payload reports `unsupported-divide-value`. ## Size | Class | Values | Roblox target | Notes | | --- | --- | --- | --- | | `w-{value}` | `px`, `full`, fractions, spacing offsets | `Size` X component | Merges with `h-` | | `h-{value}` | `px`, `full`, fractions, spacing offsets | `Size` Y component | Merges with `w-` | | `size-{value}` | `px`, `full`, fractions, spacing offsets | both axes | | | `basis-{value}` | `px`, `full`, fractions, spacing offsets | `Size` X component | Effectively `w-*` regardless of fill direction | | `w-auto`, `w-fit` | — | `AutomaticSize = Enum.AutomaticSize.X` | | | `h-auto`, `h-fit` | — | `AutomaticSize = Enum.AutomaticSize.Y` | | | `size-auto`, `size-fit` | — | `AutomaticSize = Enum.AutomaticSize.XY` | Also when both axes are set | Accepted values on the sizing axes: - `px`: one pixel of offset. - `full`: scale `1`. - Fractions from a fixed list: `1/2`, `1/3`, `2/3`, `1/4`, `3/4`, `1/5`, `2/5`, `3/5`, `4/5`, `1/6`, `5/6`, and `1/12` through `11/12`. Unreduced forms such as `2/4` and `3/6` are rejected. - Any spacing value, as an offset. A spacing value with a non-zero scale reports `unsupported-size-spacing-value`. `w-` and `h-` merge into one `Size`. Vela emits `UDim2.fromOffset`, `UDim2.fromScale` or `UDim2.new`, whichever the values need. `basis-*` is `w-*` under another name. It sets the X axis whatever the fill direction. ## Constraints | Class | Values | Roblox target | | --- | --- | --- | | `min-w-{key}` | spacing offset | `UISizeConstraint.MinSize` X | | `min-h-{key}` | spacing offset | `UISizeConstraint.MinSize` Y | | `max-w-{key}` | spacing offset | `UISizeConstraint.MaxSize` X | | `max-h-{key}` | spacing offset | `UISizeConstraint.MaxSize` Y | Emitted as `new Vector2(x, y)`. An unset axis defaults to `0` for `MinSize` and `math.huge` for `MaxSize`. Offsets only: no fractions, no `full`. ## Position | Class | Values | Roblox target | Notes | | --- | --- | --- | --- | | `left-{value}` | `px`, `full`, fractions, spacing offsets | `Position` X | | | `top-{value}` | same | `Position` Y | | | `right-{value}` | same | `Position` X, from the far edge | `right-2` is `new UDim(1, -8)` | | `bottom-{value}` | same | `Position` Y, from the far edge | | | `inset-{value}` | same | both axes | | | `-left-{value}`, `-top-{value}`, `-inset-{value}` | same | negated | | Fractions use the same list as sizing. `right-*` and `bottom-*` measure from the far edge but do not change `AnchorPoint`. Pair them with `origin-*`: `right-2 bottom-2 origin-bottom-right` puts the bottom-right corner 8 pixels inside the parent's. These classes do nothing under a parent with a `UIListLayout`, which any `flex`, `gap-*` or `space-*` creates. The layout owns its children's positions. ## Anchor | Class | Values | Roblox target | Notes | | --- | --- | --- | --- | | `origin-{key}` | `top-left`, `top`, `top-right`, `left`, `center`, `right`, `bottom-left`, `bottom`, `bottom-right` | `AnchorPoint` | Emitted as `new Vector2(x, y)` | Anything outside these nine keys reports `unsupported-anchor-value`. ## Flex layout These write into a `UIListLayout`. | Class | Roblox target | Notes | | --- | --- | --- | | `flex` | `FillDirection = Enum.FillDirection.Horizontal` | Bare form. Every form also sets `SortOrder = LayoutOrder` | | `flex-row` | `FillDirection = Enum.FillDirection.Horizontal` | | | `flex-col` | `FillDirection = Enum.FillDirection.Vertical` | | | `flex-wrap` | `Wraps = true` | | | `flex-nowrap` | `Wraps = false` | | | `justify-start`, `justify-center`, `justify-end` | `HorizontalAlignment = Left, Center, Right` | | | `justify-between`, `justify-around`, `justify-evenly` | `HorizontalFlex = Enum.UIFlexAlignment.SpaceBetween, SpaceAround, SpaceEvenly` | Different property | | `items-start`, `items-center`, `items-end` | `VerticalAlignment = Top, Center, Bottom` | | | `justify-stretch` | `HorizontalFlex = Enum.UIFlexAlignment.Fill` | Different property. Since 0.12.7 | | `items-stretch` | `VerticalFlex = Enum.UIFlexAlignment.Fill` | Different property | | `content-{start,center,end}` | `VerticalAlignment` | | | `content-{between,around,evenly,stretch}` | `VerticalFlex` | | `justify-*` and `items-*` follow Roblox's horizontal and vertical axes, not the flex main and cross axes. They do not swap under `flex-col`. Likewise `items-stretch` writes `VerticalFlex` and `justify-stretch` writes `HorizontalFlex`. An unknown `flex-*` reports `unsupported-flex-direction`. An unresolvable `justify-*`, `items-*` or `content-*` reports `unsupported-alignment-value`. ## Flex items These write into a `UIFlexItem` on the child. | Class | Roblox target | | --- | --- | | `flex-1` | `FlexMode = Enum.UIFlexMode.Fill` | | `flex-auto` | `FlexMode = Enum.UIFlexMode.Fill` | | `flex-initial` | `FlexMode = Enum.UIFlexMode.Shrink` | | `flex-none` | `FlexMode = Enum.UIFlexMode.None` | | `grow` | `FlexMode = Enum.UIFlexMode.Grow` | | `grow-0` | `FlexMode = Enum.UIFlexMode.None` | | `shrink` | `FlexMode = Enum.UIFlexMode.Shrink` | | `shrink-0` | `FlexMode = Enum.UIFlexMode.None` | | `self-{auto,start,center,end,stretch}` | `ItemLineAlignment` | There are no numeric `grow-{n}` or `shrink-{n}` forms. ## Grid | Class | Values | Roblox target | Notes | | --- | --- | --- | --- | | `grid` | — | `UIGridLayout` child, `SortOrder = LayoutOrder` | | | `grid-cols-{n}` | `1`–`12` | `FillDirection = Horizontal`, `FillDirectionMaxCells = n`, `CellSize.X` | | | `grid-rows-{n}` | `1`–`12` | `FillDirection = Vertical`, `FillDirectionMaxCells = n`, `CellSize.Y` | | | `auto-rows-{n}` | spacing scale, arbitrary | `CellSize.Y` | Cross axis of `grid-cols-*` | | `auto-cols-{n}` | spacing scale, arbitrary | `CellSize.X` | Cross axis of `grid-rows-*` | | `gap-{key}` | spacing value | `CellPadding` | Since 0.14.0 no second `UIListLayout`. `gap-[10%]` still falls back to one | `UIGridLayout` has no spans, so `col-span-*`, `row-span-*` and templates are not implemented. An unresolvable count reports `unsupported-grid-value`. `grid-cols-N` sizes the cells. The layout ignores each child's own `Size`, so Vela splits the axis into N tracks, each taking its share of the gap: ```tsx title="grid grid-cols-2 gap-2.5" <uigridlayout FillDirection={Enum.FillDirection.Horizontal} FillDirectionMaxCells={2} CellSize={new UDim2(0.5, -5, 0, 100)} CellPadding={UDim2.fromOffset(10, 10)} /> ``` The other axis stays at Roblox's default 100px until `auto-rows-*` sets it (`auto-cols-*` for `grid-rows-*`). Both read the [spacing scale](#spacing-values), so `auto-rows-24` is 96px. Variant gaps and tracks reflow the grid: `grid grid-cols-3 md:gap-4` works. A gap that `CellPadding` cannot hold, such as `gap-[10%]`, falls back to a `UIListLayout` beside the grid. ## Order | Class | Values | Roblox target | | --- | --- | --- | | `order-{n}`, `-order-{n}` | any integer | `LayoutOrder` | | `order-first` | — | `LayoutOrder = -9999` | | `order-last` | — | `LayoutOrder = 9999` | | `order-none` | — | `LayoutOrder = 0` | `order-*` only works under a layout that sorts by `LayoutOrder`. Vela's `flex` and `grid` layouts do. A layout you wrote yourself keeps Roblox's default sort by `Name` and ignores `order-*`. An unresolvable payload reports `unsupported-layout-order-value`. Under a `divide-*` parent, see [divide](#divide). ## Aspect ratio | Class | Values | Roblox target | Notes | | --- | --- | --- | --- | | `aspect-square` | — | `UIAspectRatioConstraint.AspectRatio = 1` | | | `aspect-video` | — | `AspectRatio = 1.7777777778` | | | `aspect-[W/H]` | positive finite numbers | `AspectRatio` | Arbitrary value | | `aspect-[N]` | positive finite number | `AspectRatio` | Arbitrary value | | `aspect-auto` | — | — | `unsupported-aspect-value` | ## Transform | Class | Values | Roblox target | Notes | | --- | --- | --- | --- | | `rotate-{deg}`, `-rotate-{deg}` | `0`, `1`, `2`, `3`, `6`, `12`, `45`, `90`, `180` | `Rotation` | `-rotate-0` stays `0` | | `scale-{n}` | `0`, `50`, `75`, `90`, `95`, `100`, `105`, `110`, `125`, `150` | `UIScale.Scale` | Maps to `0`, `0.5`, `0.75`, `0.9`, `0.95`, `1`, `1.05`, `1.1`, `1.25`, `1.5` | | `translate-x-{v}`, `translate-y-{v}` | fractions or spacing values | `AnchorPoint` or `Position` | A fraction anchors; a pixel value shifts | Scaling is uniform: there is no `scale-x-*` or `scale-y-*`. Other degrees report `unsupported-rotation-value`, and other scales `unsupported-scale-value`. `translate-*` with a fraction sets `AnchorPoint`, a shift measured in the element's own size. With a pixel value it adds to the `Position` offset. So the CSS centering idiom works as written: ```tsx title="AnchorPoint (0.5, 0.5) + Position (0.5, 0.5) scale" <frame className="left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2" /> ``` `mx-auto` and `my-auto` compile to the same centering. ## Effects | Class | Values | Roblox target | Notes | | --- | --- | --- | --- | | `opacity-{n}` | any integer `0`–`100` | Every transparency channel the element paints, and the subtree under it | Inverted: `opacity-100` is fully opaque | | `opacity-{n}` | any integer `0`–`100` | `GroupTransparency`, on a `canvasgroup` | One composited layer; the fade stops there | | `isolate` | — | builds a `frame` as a `canvasgroup` | Since 0.14.0. Static and unconditional only (`isolate-not-static`), `frame` only (`isolate-needs-frame`) | | `backdrop-blur`, `backdrop-blur-xs`, `backdrop-blur-sm` | — | `UIBlur.Strength = Light` | Since 0.14.0. Needs `@rbxts/types` 1.0.958 | | `backdrop-blur-md`, `backdrop-blur-lg` | — | `UIBlur.Strength = Medium` | | | `backdrop-blur-xl`, `backdrop-blur-2xl`, `backdrop-blur-3xl` | — | `UIBlur.Strength = Heavy` | | | `backdrop-blur-none` | — | `UIBlur.Enabled = false` | | `opacity-75` sets a transparency of `0.25`. A non-integer or out-of-range value reports `unsupported-opacity-value`. `opacity-*` fades everything the element draws: background, text, image, and any `UIStroke`, `UIShadow` or `UIBlur` from the same class list. It also fades the subtree. Each descendant's transparency becomes `1 - (1 - own) * alpha`. That includes children inside expressions, `{props.children}`, and component children, which the alpha reaches through React context. A `canvasgroup` stops it. It multiplies with `/N`, in any order. `opacity-50 bg-blue-600/50` gives a transparency of 0.75. Use `/N` to fade one family and `opacity-*` to fade the element and its subtree. A transparency you set yourself is kept. `<frame BackgroundTransparency={0.2} />` under an ancestor's `opacity-50` stays at 0.2. Unlike CSS, overlapping siblings fade one by one, so their overlap looks darker. Use `isolate` for a true composite. ### isolate `isolate` on a `frame` builds it as a `canvasgroup`. `opacity-*` then sets `GroupTransparency`, and the subtree fades as one layer, as in CSS: ```tsx title="isolate opacity-75 bg-red-500" <canvasgroup BackgroundColor3={Color3.fromRGB(251, 44, 54)} GroupTransparency={0.25} BorderSizePixel={0} /> ``` A CanvasGroup costs more. It clips its descendants, re-renders them to a texture on every change, and is what a ref or an `IsA` check sees. `isolate` must be static and unconditional. Under a variant or in a class value it reports `isolate-not-static`. On anything but a `frame` it reports `isolate-needs-frame`. ### Backdrop blur `backdrop-blur-*` lowers to Roblox's `UIBlur`, which has three strengths. The table above shows how Tailwind's sizes map onto them. Any other size, `backdrop-blur-[3px]` included, reports `unsupported-backdrop-blur-value`. Other `backdrop-*` filters are `no-roblox-equivalent`. `opacity-*` fades the blur, and `hover:backdrop-blur-xl` changes the strength. A static `backdrop-blur-*` needs `@rbxts/types` 1.0.958 or later to typecheck. Roblox has not documented `UIBlur` yet. The mapping assumes it blurs what is behind its parent, and has not been checked in Studio. ## Motion Transitions and animations run on `TweenService` in the runtime helper. | Class | Values | Effect | Notes | | --- | --- | --- | --- | | `transition` | — | Tween property changes caused by variant rules | | | `transition-all` | — | Tween every property a rule changes | | | `transition-colors` | — | Narrow the tween to the color properties | | | `transition-opacity` | — | Narrow the tween to the transparency properties | | | `transition-transform` | — | Narrow the tween to `Position`, `Rotation`, `UIScale` | | | `transition-shadow` | — | Narrow the tween to the `UIShadow` properties | Since 0.13.0, when transitions began moving the helper instances | | `transition-none` | — | Disable tweening | | | `duration-{n}` | preset `75`–`1000`, or any integer ms | Tween time, `n / 1000` seconds | | | `delay-{n}` | preset `75`–`1000`, or any integer ms | Tween delay | | | `ease-{linear,in,out,in-out}` | — | `EasingStyle` / `EasingDirection` | | | `animate-{spin,pulse,bounce}` | — | Preset looping animation | Runtime-structural | | `animate-none` | — | No animation | | The defaults are `0.15` seconds and `Quad`/`Out`. Any of `duration-*`, `delay-*` or `ease-*` alone turns the transition on. ```tsx title="A hover transition, complete" <textbutton className="bg-sky-500 hover:bg-sky-600 transition duration-150" Text="Play" /> ``` A transition needs a property that changes, from a [variant](https://docs.astra-void.xyz/vela-rbxts/guides/responsive-and-input-variants.md) or a dynamic `className`. On a static element it is dropped with `transition-without-runtime`. On a component, motion classes report `motion-on-component`. The filters limit what tweens. Under `transition-colors`, a rule changing color and position tweens the color and snaps the position. Helper instances tween too, so `hover:rounded-xl` and `hover:border-blue-500` animate. An unresolvable value reports `unsupported-transition-value` or `unsupported-animation-value`. A [motion driver](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#motion-driver) can replace TweenService. ## Typography | Class | Values | Roblox target | Notes | | --- | --- | --- | --- | | `text-{size}` | `xs` 12, `sm` 14, `base` 16, `lg` 18, `xl` 20, `2xl` 24, `3xl` 30, `4xl` 36, `5xl` 48, `6xl` 60, `7xl` 72, `8xl` 96, `9xl` 128 | `TextSize` | Pixel values shown | | `font-{weight}` | `thin`, `extralight`, `light`, `normal`, `medium`, `semibold`, `bold`, `extrabold`, `black` | `FontFace` weight axis | `normal` is `Regular`, `black` is `Heavy` | | `font-{family}` | any key in `theme.fontFamily` — `sans`, `serif`, `mono` by default | `FontFace` family axis | The fallback branch of `font-*` | | `italic`, `not-italic` | — | `FontFace` style axis | Merges with the weight | | `leading-{key}` | `none` 1, `tight` 1.25, `snug` 1.375, `normal` 1.5, `relaxed` 1.625, `loose` 2 | `LineHeight` | Numeric forms are `unsupported-line-height-value` | | `text-left`, `text-center`, `text-right` | — | `TextXAlignment` | | | `text-justify` | — | — | `unsupported-text-alignment` | | `align-top`, `align-middle`, `align-bottom` | — | `TextYAlignment = Top, Center, Bottom` | | | `text-wrap`, `text-nowrap` | — | `TextWrapped = true, false` | | | `whitespace-normal`, `whitespace-nowrap` | — | `TextWrapped = true, false` | Alias family; others are `unsupported-whitespace-value` | | `truncate` | — | `TextTruncate = Enum.TextTruncate.AtEnd` | | | `uppercase`, `lowercase`, `capitalize`, `normal-case` | — | the `Text` string itself | Rewritten at compile time when `Text` is a literal | | `underline`, `line-through`, `no-underline` | — | RichText markup around `Text` | Backs off with `decoration-on-richtext` if you set `RichText` | `font-*` covers weight, family and style, merged into one `FontFace`. Weight names are checked first. Anything else is a key in [`theme.fontFamily`](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#fontfamily): ```tsx title="font-mono font-bold italic" FontFace={new Font("rbxasset://fonts/families/RobotoMono.json", Enum.FontWeight.Bold, Enum.FontStyle.Italic)} ``` The style argument appears only with `italic`. Because the family lookup comes last, a bad `font-*` reports `unknown-theme-key`. The default families are `sans` (Source Sans Pro), `serif` (Merriweather) and `mono` (Roboto Mono). Any Roblox font asset works, uploaded ones included. Case transforms rewrite the `Text` string. With a literal it happens at compile time: `<textlabel className="uppercase" Text="hello" />` emits `Text="HELLO"`. With an expression, the runtime helper does it. Decorations wrap `Text` in RichText tags and set `RichText={true}`. `underline` emits `Text="<u>hello</u>"`. If you set `RichText` yourself, Vela skips the decoration and reports `decoration-on-richtext`. ## Images | Class | Roblox target | | --- | --- | | `object-cover` | `ScaleType = Enum.ScaleType.Crop` | | `object-contain` | `ScaleType = Enum.ScaleType.Fit` | | `object-fill` | `ScaleType = Enum.ScaleType.Stretch` | | `object-tile` | `ScaleType = Enum.ScaleType.Tile` | `object-tile` is a Roblox-only addition. Other values report `unsupported-object-fit-value`. ## Interaction | Class | Roblox target | | --- | --- | | `pointer-events-none` | `Interactable = false` | | `pointer-events-auto` | `Interactable = true` | | `overscroll-auto` | `ElasticBehavior = Enum.ElasticBehavior.Always` | | `overscroll-contain` | `ElasticBehavior = Enum.ElasticBehavior.WhenScrollable` | | `overscroll-none` | `ElasticBehavior = Enum.ElasticBehavior.Never` | `overscroll-*` only works on `scrollingframe`. Unresolvable values report `unsupported-pointer-events-value` and `unsupported-overscroll-value`. ## Visibility | Class | Roblox target | | --- | --- | | `hidden` | `Visible = false` | | `visible` | `Visible = true` | ## Overflow | Class | Roblox target | | --- | --- | | `overflow-hidden` | `ClipsDescendants = true` | | `overflow-clip` | `ClipsDescendants = true` | | `overflow-visible` | `ClipsDescendants = false` | Other values report `unsupported-overflow-value`. There is no `overflow-auto` or `overflow-scroll`. Use a `scrollingframe` with the [scrolling families](#scrolling). ## Scrolling These four families only work on `scrollingframe`. | Class | Values | Roblox target | Notes | | --- | --- | --- | --- | | `scroll-{x,y,xy}` | — | `ScrollingDirection = X, Y, XY` | | | `scroll-none` | — | `ScrollingEnabled = false` | Does not set a direction | | `scrollbar-w-{n}` | spacing scale, arbitrary | `ScrollBarThickness` | `scrollbar-w-2` is 8px | | `scrollbar-none` | — | `ScrollBarThickness = 0` | | | `scrollbar-{color}` | any color, `/N` modifier | `ScrollBarImageColor3`, `ScrollBarImageTransparency` | | | `canvas-{auto,auto-x,auto-y,none}` | — | `AutomaticCanvasSize = XY, X, Y, None` | | ```tsx title="A vertical list that grows its canvas" <scrollingframe className="scroll-y canvas-auto-y scrollbar-w-2 scrollbar-zinc-600/50" /> ``` ```tsx title="lowers to" <scrollingframe ScrollingDirection={Enum.ScrollingDirection.Y} ScrollBarThickness={8} ScrollBarImageTransparency={0.5} ScrollBarImageColor3={Color3.fromRGB(82, 82, 92)} AutomaticCanvasSize={Enum.AutomaticSize.Y} /> ``` Without `canvas-*`, the canvas keeps whatever `CanvasSize` the element declares, and the scrollbar has nothing to scroll. Tailwind's own `scroll-*` utilities, such as `scroll-smooth` and `scroll-m-*`, are not implemented. They report `unsupported-scroll-value`, which lists the values that work. > **The static path does not check the host** > > `<frame className="scroll-y" />` writes `ScrollingDirection` onto a Frame, and Roblox rejects it at runtime. Only the editor and the runtime path catch it. ## Variants Chain variants with colons. Every condition must hold: `md:touch:w-full` applies only on a wide touch screen. An unknown prefix reports `unknown-variant` and drops the token. | Variant | Condition | Notes | | --- | --- | --- | | `sm:`, `md:`, `lg:`, `xl:`, `2xl:` | Viewport width ≥ 640, 768, 1024, 1280, 1536 | `xl` and `2xl` since 0.13.0. Every threshold is a `theme.screens` key | | `max-sm:`, `max-md:`, `max-lg:`, `max-xl:`, `max-2xl:` | Viewport width < the same threshold | Since 0.13.0. The exact complement of the bare form, so the two cover every viewport once. Chains, as `md:max-lg:` | | `attr-[{Name}={value}]:` | The styled instance carries that Roblox attribute | Since 0.13.0. `addVariant()` registers the same condition under a name | | `portrait:` | Viewport width less than height | | | `landscape:` | Viewport width ≥ height | | | `touch:` | `UserInputService.TouchEnabled`, and no gamepad | | | `mouse:` | Neither gamepad nor touch | | | `gamepad:` | `UserInputService.GamepadEnabled` | | | `hover:` | The pointer is over this element | | | `active:` | This element is being pressed | | | `focus:` | This element holds focus or selection | | | `dark:` | `Players.LocalPlayer` carries `VelaColorScheme = "dark"` | | Breakpoints come from [`theme.screens`](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#screens), so a custom `tablet:` is one line of config. `max-*` is the exact complement of the bare form (minimum inclusive, maximum exclusive). They combine: `md:max-lg:`. `max-` on something that is not a breakpoint reports `unknown-breakpoint`. A range that matches no viewport reports `invalid-breakpoint-range`. `attr-[State=open]:` matches a Roblox attribute on the styled instance. [`addVariant`](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#addvariant) gives the same condition a name. A malformed `attr-[…]` reports `malformed-attribute-variant`. How the built-in conditions behave: - A square viewport counts as `landscape`. - Exactly one input mode is active, by priority: gamepad, then touch, then mouse. - `hover` and `active` are tracked per element, alongside any handlers you attached. `active` clears on `MouseLeave`. - `focus` follows `Focused`/`FocusLost` on a `textbox`, and `SelectionGained`/`SelectionLost` elsewhere. - `dark` reads an attribute your app sets. Roblox exposes no color scheme. There are no structural variants (`first:`, `last:`) and no `disabled:`. Any variant moves the element onto the runtime path. See [Responsive and input variants](https://docs.astra-void.xyz/vela-rbxts/guides/responsive-and-input-variants.md) for the cost and for how to drive `dark:`. ## Not implemented An unknown family, typos included, reports `unsupported-utility-family`. A real Tailwind family with no Roblox equivalent reports `no-roblox-equivalent`. This list is permanent: | Family | Why there is no equivalent | |---|---| | `tracking-*`, `indent-*`, `break-*`, `hyphens-*`, `list-*` | The Roblox text engine exposes no letter-spacing, indent, or line-breaking control | | `decoration-*`, `overline` | No RichText equivalent (`underline` and `line-through` do exist) | | `blur-*`, `backdrop-*` other than [`backdrop-blur-*`](#backdrop-blur), `grayscale`, `invert`, `sepia`, `contrast-*` | No per-element filters — `BlurEffect` is camera-global, and `UIBlur` only blurs what is behind | | `brightness-*`, `fill-*`, `stroke-*` | Deliberately excluded; an `ImageColor3` approximation would mislead | | `skew-*`, `perspective-*` | Roblox UI is strictly 2D | | `static`, `fixed`, `absolute`, `relative`, `sticky`, `block`, `inline` | Roblox positioning is always parent-relative; there is no positioning model to switch | | `float`, `clear`, `columns-*`, `col-span-*`, `row-span-*` | `UIGridLayout` has no span or flow concept | | `cursor-*`, `caret-*`, `accent-*`, `select-*`, `snap-*`, `resize-*` | No property to target | | Tailwind's `scroll-*` (`scroll-smooth`, `scroll-m-*`) | The prefix is taken by the [scrolling families](#scrolling); reports `unsupported-scroll-value` | | `ms-*`, `me-*` | No logical-direction margins | | `animate-ping` | Needs a cloned element; the other `animate-*` presets exist | A family that exists but rejects a value has its own diagnostic, listed in its section above. ## Dynamic class names When `className` is not a compile-time constant, the runtime helper resolves it. Every family on this page works there, with the same results. One difference: the runtime path drops a utility the host cannot carry, because assigning `TextColor3` to a Frame is a Roblox error. The static path writes it anyway. See [supported elements](#supported-elements). An `opacity-*` inside a variant fades the subtree it is written over. [Dynamic class names](https://docs.astra-void.xyz/vela-rbxts/guides/dynamic-class-names.md) covers the cost and what moves an element onto this path. ## See also - [Configuration](https://docs.astra-void.xyz/vela-rbxts/reference/config.md) for the theme keys these utilities look up, and [`plugins`](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#plugins) for registering utilities of your own. - [Diagnostics](https://docs.astra-void.xyz/vela-rbxts/reference/diagnostics.md) for every warning code named on this page. - [Recipes](https://docs.astra-void.xyz/vela-rbxts/guides/recipes.md) for these utilities composed into real interface pieces. --- # Cheat sheet > Every utility class on one filterable page — by class, by property, or by lowering path. Source: https://docs.astra-void.xyz/vela-rbxts/reference/cheat-sheet/ The same classes the [utility reference](https://docs.astra-void.xyz/vela-rbxts/reference/utilities.md) documents, with the prose taken out. Filter by a class prefix such as `bg-`, by the Roblox property a class writes such as `UIStroke` or `TextSize`, or by the family name. Every family heading links back to the section that explains it. The **runtime** pill marks a utility that builds a wrapper, a separator or a loop, which no static prop can express. Margins, `divide-*`, `animate-*` and every variant prefix move the element onto the [runtime path](https://docs.astra-void.xyz/vela-rbxts/getting-started/how-it-works.md#the-two-lowering-paths), even inside a plain string literal. Filter to just those to see what a class list is costing you. _Every utility class on one filterable page. The same rows, with the prose that explains them, are in the Utility reference._ A class that is not here is one Vela does not compile. The reference page lists [what has no Roblox equivalent](https://docs.astra-void.xyz/vela-rbxts/reference/utilities.md#not-implemented) and why, and [Diagnostics](https://docs.astra-void.xyz/vela-rbxts/reference/diagnostics.md) explains every warning code named above. Three things this page cannot flatten into rows, all on the reference. [Color keys and the `/N` modifier](https://docs.astra-void.xyz/vela-rbxts/reference/utilities.md#color), [arbitrary bracket values](https://docs.astra-void.xyz/vela-rbxts/reference/utilities.md#arbitrary-values), and [which utilities each host element accepts](https://docs.astra-void.xyz/vela-rbxts/reference/utilities.md#supported-elements). --- # Configuration > How vela.config.ts is found and loaded, the complete theme schema, the built-in defaults, and the tsconfig plugin options. Source: https://docs.astra-void.xyz/vela-rbxts/reference/config/ Vela reads one optional config file. It sets the theme, whether [preflight](#preflight) resets Roblox's default styling, and which UI [`framework`](#framework) to emit for. Everything else, such as which files to compile and where output goes, comes from `tsconfig.json`. ## Discovery Vela looks for `vela.config.ts` or `vela.config.json`. No other names work: no `.js`, `.mjs`, `.cjs`, `.mts`, or `package.json` key. If a directory has both, the `.ts` file wins. Vela walks up from each source file and uses the first config it finds, or `defaultConfig` if there is none. A config in a subdirectory overrides the root one for the files below it. That is usually a mistake. A [`vela.css`](#velacss) is found by its own upward walk and applied on top of whichever config was found. The JSON form takes the same shape as `defineConfig`'s argument. Add `$schema` for editor validation. Vela strips it before parsing. ```json title="vela.config.json" { "$schema": "./node_modules/vela-rbxts/schema.json", "theme": { "extend": { "colors": { "brand": { "500": "Color3.fromRGB(99, 102, 241)" } } } } } ``` Each config is loaded once per build and re-read when it changes. A config that throws is reported once, and your next edit clears it. ## How the TypeScript form is loaded Vela runs the file itself instead of passing it to roblox-ts. That has three effects: - **The file is not type-checked.** A type error passes silently. - Imports resolve relative to the config file, not through `tsconfig.json` `paths`. - The default export must be a resolved config or a `defineConfig` input. Anything else throws, naming the key that failed. Every `import` from `vela-rbxts` is stripped, and `defineConfig` and `defaultConfig` are injected in its place. Those two are the only `vela-rbxts` exports a config can use. The file runs as real code, so keep it cheap. ```ts title="vela.config.ts" import { defineConfig } from "vela-rbxts"; export default defineConfig({ theme: { extend: { colors: { brand: { 500: "Color3.fromRGB(99, 102, 241)", 700: "Color3.fromRGB(67, 56, 202)", }, }, }, }, }); ``` ## vela.css Write tokens, utility classes and attribute variants as CSS in a `vela.css` file. Put it beside the config file, or use it with no config file at all: ```css title="vela.css" @import "./tokens.css"; @theme { --color-brand-500: #3b82f6; --color-ink: rgb(17 17 17); --spacing-gutter: 20px; --radius-card: 12px; --radius-pill: 50%; --breakpoint-tv: 1920px; --font-display: rbxasset://fonts/families/Gotham.json; } @custom-variant selected (Selected = true); .btn { @apply bg-brand-500 rounded-card px-4; } .panel { BackgroundTransparency: 0.5; ZIndex: 2; } ``` You write values in CSS units. Vela converts them into theme expressions: | Written | Becomes | |---|---| | `--color-brand-500: #3b82f6` | `colors.brand.500` = `Color3.fromRGB(59, 130, 246)` | | `--color-ink: rgb(17 17 17)` | `colors.ink` = `Color3.fromRGB(17, 17, 17)` | | `--spacing-gutter: 20px` | `spacing.gutter` = `new UDim(0, 20)` | | `--radius-pill: 50%` | `radius.pill` = `new UDim(0.5, 0)` | | `--breakpoint-tv: 1920px` | `screens.tv` = `1920` | | `--font-display: rbxasset://…` | `fontFamily.display`, as written | Every token goes under `theme.extend`, so a stylesheet never replaces a scale. The other rules map onto plugin features: - `.name { @apply … }` registers a class-list utility, like [`addUtilities`](#addutilities). - `.name { Property: value; }` registers a property map. Values are roblox-ts expressions. - `@custom-variant selected (Selected = true);` registers an attribute variant, like [`addVariant`](#addvariant). - `@import "./tokens.css";` pulls in a sibling stylesheet as a [preset](#presets). The importing file wins on conflicts. When a project has both files, the stylesheet wins: a token defined in both takes the CSS value. The compiler and the editor treat a CSS class the same as a plugin class. Roblox has no cascade, selectors or inheritance, so neither does `vela.css`. **Any diagnostic fails the config:** ```text ".card > .title" is not a supported selector. Vela has no cascade, so a rule names one class, as ".btn". ".btn:hover" is not a supported selector. Vela has no cascade, so a rule names one class, as ".btn". "@media" is not supported. Vela CSS understands "@theme", "@custom-variant", "@import". "display" is a CSS property, and vela styles Roblox instances. Use a layout utility such as `flex`. "hotpink" is not a color. Write a hex literal, "rgb(r g b)", or a Color3 expression. The rem scale is not a token; set `theme.rem` in `vela.config.ts`. ``` Use `hover:` on the class instead of `:hover`, and `theme.screens` instead of `@media`. Set `theme.rem` in the config file. > **rbxtsc -w does not watch stylesheets** > > After you edit `vela.css` or a file it imports, unchanged source files keep the old tokens until they are saved again. Restart the watcher, or use [`vela watch`](https://docs.astra-void.xyz/vela-rbxts/reference/cli.md#watch), which follows stylesheets. ## Schema The config has five optional keys: `preflight`, `theme`, `plugins`, `framework` and `presets`. Tailwind options such as `content`, `darkMode`, `prefix`, `important`, `corePlugins`, `safelist` and `variants` do not exist and are ignored. | Prop | Type | Description | | --- | --- | --- | | `presets` | `readonly (TailwindConfigInput \| TailwindConfig)[]` | Shareable configs applied before this one, in array order. This config always wins. See Presets below. | | `framework` | `"react" \| "vide"` | The UI library to emit for. Default react. Left unset, it is inferred from tsconfig.json. | | `preflight` | `boolean` | Default true. Resets Roblox's default background and border on every supported element with a className. Set false to only add what your classes name. | | `theme.colors` | `Record<string, string \| Partial<Record<Shade \| "DEFAULT", string>>>` | Replaces the whole color registry. A value is a roblox-ts expression string, or a map from shade (50…950, plus an optional DEFAULT) to one. | | `theme.radius` | `Record<string, string>` | Replaces the whole radius scale. Each value is a roblox-ts expression producing a UDim. | | `theme.spacing` | `Record<string, string>` | Replaces the whole spacing scale. Each value is a roblox-ts expression producing a UDim. | | `theme.fontFamily` | `Record<string, string>` | Replaces the whole font family scale. Each value is a rbxasset:// font JSON or an uploaded rbxassetid://. The keys are what font-{family} looks up. | | `theme.screens` | `Record<string, number>` | Replaces the breakpoint scale, in pixels of viewport width. Defaults: sm 640, md 768, lg 1024, xl 1280, 2xl 1536. Each key gives a min-width prefix and its max- complement. | | `theme.rem` | `{ base?: number; min?: number; max?: number; baseResolution?: { x: number; y: number }; pinnedUnder?: string[] }` | How one rem resolves against the viewport. Defaults: base 16, min 8, max 64, baseResolution 1920×1020, pinnedUnder ["surfacegui", "billboardgui"]. Merges field by field, except pinnedUnder, which replaces. | | `plugins` | `VelaPlugin[] \| { utilities, motion }` | Register your own utility classes and variants, or replace the motion driver. In vela.config.json, write the resolved object form. | | `theme.extend.colors` | `Record<string, string \| Partial<Record<Shade \| "DEFAULT", string>>>` | Merges over the default colors, per family and, when both sides are palettes, per shade. Set DEFAULT on a family so a bare bg-brand resolves. | | `theme.extend.radius` | `Record<string, string>` | Merges over the default radius scale by key. | | `theme.extend.spacing` | `Record<string, string>` | Merges over the default spacing scale by key. | | `theme.extend.fontFamily` | `Record<string, string>` | Merges over the default font family scale by key. | | `theme.extend.screens` | `Record<string, number>` | Merges over the default breakpoints by key, so a new name joins sm…2xl. | | `theme.extend.rem` | `{ base?: number; min?: number; max?: number; baseResolution?: { x: number; y: number } }` | Same as theme.rem. Both merge field by field. | Valid shades are `50` through `950`, plus `DEFAULT`, which a bare name such as `bg-brand` resolves to. Built-in palettes set `DEFAULT` to their `500`. `DEFAULT` is a config key only: `bg-brand-DEFAULT` reports `unknown-theme-key`. An empty palette object throws `Color palette normalization requires at least one shade value.` That applies to a new family, or any family under a top-level `theme.colors`. Extending an existing palette with `{}`, as in `theme.extend.colors: { blue: {} }`, throws nothing and does nothing. ### framework The UI library to emit for: `"react"` (default) or `"vide"`. It decides which runtime host the output imports, and the shape of the emitted code. ```ts title="vela.config.ts" export default defineConfig({ framework: "vide" }); ``` Most projects leave it unset. Vela then reads `compilerOptions.jsxFactory` from the nearest `tsconfig.json`, following relative `extends` up to eight levels. A factory starting with `Vide.` selects Vide. Setting the key to either value turns inference off, so `framework: "react"` pins React even under a Vide `jsxFactory`. The [Vide guide](https://docs.astra-void.xyz/vela-rbxts/guides/vide.md#the-static-path-is-almost-the-same-output) shows how the output differs. ### preflight Default `true`. Roblox draws every `GuiObject` as an opaque gray box with a 1px border. With preflight on, a supported element with a `className` starts at `BackgroundTransparency = 1` and `BorderSizePixel = 0`: ```tsx <frame className="w-20 h-10" /> // → <frame Size={UDim2.fromOffset(80, 40)} BorderSizePixel={0} BackgroundTransparency={1} /> <frame className="w-20 h-10 bg-slate-800" /> // → <frame BackgroundColor3={Color3.fromRGB(29, 41, 61)} Size={UDim2.fromOffset(80, 40)} BorderSizePixel={0} /> ``` The transparency is skipped when something else paints the element: a `bg-*`, a gradient stop, or your own transparency prop. `BorderSizePixel` is skipped if you set it. `opacity-*` alone does not count, so `w-20 opacity-50` stays transparent. A `bg-*` under a variant paints the element at runtime. Elements without a `className`, and components, are never touched. Set it to `false` and Vela only adds the properties your classes name. The gray default shows wherever you do not paint over it: ```ts title="vela.config.ts" export default defineConfig({ preflight: false }); ``` ### Values are roblox-ts expression strings Every theme value is a string of roblox-ts code, which Vela pastes into its output. It is not a hex string or a number: ```ts title="vela.config.ts" export default defineConfig({ theme: { extend: { colors: { ink: "Color3.fromRGB(17, 17, 17)" }, radius: { pill: "new UDim(0.5, 0)" }, spacing: { gutter: "new UDim(0, 20)" }, }, }, }); ``` `4` is rejected when the config loads. `"#111111"` is accepted, then emitted as a string literal, which fails roblox-ts type checking on the next build. The [theming guide](https://docs.astra-void.xyz/vela-rbxts/guides/theming.md#values-are-source-code-not-values) compares the shapes. > **Dynamic classes read only two value forms** > > A class resolved at runtime accepts only `Color3.fromRGB(r, g, b)` and `new UDim(a, b)` with numeric arguments. Any other value compiles, then **silently degrades at runtime** with no diagnostic. ## Merge semantics A top-level `theme.radius`, `theme.spacing` or `theme.fontFamily` replaces the whole scale. The `theme.extend` version merges over the defaults by key. For `colors`, `extend` merges per family, and per shade when both sides are palettes. A literal and a palette replace each other. > **theme.colors silently discards theme.extend.colors** > > If `theme.colors` is set, `theme.extend.colors` is ignored without warning, and the built-in palettes go with it. The same holds for `radius`, `spacing` and `fontFamily`, so add values with `extend` alone. ## The default theme `defaultConfig` holds the built-in defaults. You get it when no config file is found. ### Colors Twenty-eight families. `black` and `white` are literals. The other twenty-six are palettes with all eleven shades (`50` through `950`), each with a `DEFAULT` equal to its `500`: `slate`, `gray`, `zinc`, `neutral`, `stone`, `red`, `orange`, `amber`, `yellow`, `lime`, `green`, `emerald`, `teal`, `cyan`, `sky`, `blue`, `indigo`, `violet`, `purple`, `fuchsia`, `pink`, `rose`, `mauve`, `olive`, `mist`, `taupe`. The first twenty-two match Tailwind. `mauve`, `olive`, `mist` and `taupe` are Vela additions. ### Radius Ten named keys, plus a `DEFAULT` for bare `rounded`. There is no numeric fallback, so these are all the keys until you extend them. | Key | Value | |---|---| | `DEFAULT` | `new UDim(0, 4)` | | `none` | `new UDim(0, 0)` | | `xs` | `new UDim(0, 2)` | | `sm` | `new UDim(0, 4)` | | `md` | `new UDim(0, 6)` | | `lg` | `new UDim(0, 8)` | | `xl` | `new UDim(0, 12)` | | `2xl` | `new UDim(0, 16)` | | `3xl` | `new UDim(0, 24)` | | `4xl` | `new UDim(0, 32)` | | `full` | `new UDim(0.5, 0)` | ### Spacing One key: `"4"`, which is `new UDim(0, 16)`. Every other number comes from an arithmetic rule: any non-negative multiple of `0.5` becomes `new UDim(0, key * 4)`. So `p-2` is 8px. A negative number, a finer fraction or a word reports `unknown-theme-key`. See [spacing values](https://docs.astra-void.xyz/vela-rbxts/reference/utilities.md#spacing-values). Use `theme.extend.spacing` for named tokens such as `p-gutter`. ### fontFamily Three keys. `sans` is the default when no `font-{family}` is set. | Key | Value | |---|---| | `sans` | `rbxasset://fonts/families/SourceSansPro.json` | | `serif` | `rbxasset://fonts/families/Merriweather.json` | | `mono` | `rbxasset://fonts/families/RobotoMono.json` | Any Roblox font family works, including one you uploaded: ```ts title="vela.config.ts" export default defineConfig({ theme: { extend: { fontFamily: { display: "rbxassetid://12345678", body: "rbxasset://fonts/families/Nunito.json", }, }, }, }); ``` That gives `font-display` and `font-body`. Unlike other theme values, these are asset paths, not roblox-ts expressions. They go into `Font`'s first argument as written. ### screens The viewport widths, in pixels, that the responsive variants use. | Key | Default | |---|---| | `sm` | `640` | | `md` | `768` | | `lg` | `1024` | | `xl` | `1280` | | `2xl` | `1536` | Each key gives two prefixes, a minimum width and its `max-` complement: ```ts title="vela.config.ts" export default defineConfig({ theme: { extend: { screens: { tablet: 900 } } }, }); ``` That defines `tablet:` (≥ 900) and `max-tablet:` (< 900). A top-level `theme.screens` removes `sm` through `2xl`, so any class still using one reports `unknown-breakpoint`. ### rem How many pixels one rem is worth. Every pixel offset a utility lowers is measured in rem. See [the theming guide](https://docs.astra-void.xyz/vela-rbxts/guides/theming.md#rem). | Key | Default | What it is | |---|---|---| | `base` | `16` | Pixels per rem at `baseResolution` | | `min` | `8` | Lower clamp, in pixels | | `max` | `64` | Upper clamp, in pixels | | `baseResolution` | `{ x: 1920, y: 1020 }` | The viewport `base` is calibrated against | | `pinnedUnder` | `["surfacegui", "billboardgui"]` | Containers whose subtree keeps literal pixels | ```ts title="vela.config.ts" export default defineConfig({ theme: { rem: { base: 16, min: 8, max: 64, baseResolution: { x: 1920, y: 1020 } }, }, }); ``` `theme.rem` and `theme.extend.rem` do the same thing: they merge field by field. `pinnedUnder` is the exception. It replaces, and an empty list puts both containers back on the rem curve. Elements written under a `surfacegui` or `billboardgui` in your JSX keep literal pixels, because those containers size from their part, not the viewport. A container Vela never sees is not covered. For that case, pin rem with `rem: { min: 16, max: 16 }`. An inverted clamp collapses onto `min`. ## Plugins A plugin is a function that registers utilities, variants or a motion driver. Wrap it in `plugin()` from `@vela-rbxts/config`, with an optional name: ```ts title="vela.config.ts" import { defineConfig, plugin } from "@vela-rbxts/config"; export default defineConfig({ plugins: [ plugin(({ addUtilities, theme }) => { addUtilities({ btn: "bg-blue-600 rounded-lg px-4 py-2", panel: { BorderSizePixel: "0", BackgroundColor3: theme("colors.zinc.950") }, }); }, { name: "acme" }), ], }); ``` Plugins run when the config resolves, not per file. The compiler, the runtime host and the editor all see the same result. ### addUtilities A utility is either a class list or a Roblox property map. | Form | Example | Meaning | |---|---|---| | Class list | `btn: "bg-blue-600 rounded-lg px-4"` | Expands to those utilities | | Property map | `panel: { BorderSizePixel: "0" }` | Assigns those properties directly | Property-map values are [roblox-ts expression strings](#values-are-roblox-ts-expression-strings), like theme values. A registered utility: - Takes variants: `hover:btn` applies everything `btn` expands to on hover. - Works in dynamic `className` values. - Can use another: `"btn-lg": "btn text-lg"` expands `btn` too. - Sorts before plain utilities, so a `bg-*` beside it wins. `className="btn bg-rose-600"` is rose in either order. > **A cycle expands to nothing, silently** > > A utility that refers back to itself, such as `{ a: "b", b: "a" }`, applies none of its classes and reports nothing. If a plugin utility does nothing, check for a cycle. ### addVariant Registers a variant that matches a Roblox attribute on the styled instance: ```ts title="vela.config.ts" plugin(({ addVariant }) => { addVariant("open", { attribute: "State", equals: "open" }); addVariant("premium", { attribute: "Tier", equals: 3 }); }); ``` `open:` then applies while `instance:GetAttribute("State")` is `"open"`. `equals` takes a string, number or boolean. `attr-[State=open]:` writes the same condition inline. Both combine with every other variant and work in the editor. A registered variant also works through a marker. `group-open:` matches while the nearest `group` ancestor has the attribute. `peer-open:` matches while any marked sibling does. **`group`, `peer`, and any name starting with `group-` or `peer-` are reserved.** `addVariant` rejects them, and `vela.config.json` reports `invalid-custom-variant`. ### theme() `theme("colors.blue.600")` returns the roblox-ts expression string for that key in the resolved theme, with defaults and `extend` applied. A second argument is the fallback when the path is missing. ### Motion driver `setMotionDriver` replaces TweenService for [`transition` and `animate-*`](https://docs.astra-void.xyz/vela-rbxts/reference/utilities.md#motion): ```ts title="vela.config.ts" plugin(({ setMotionDriver }) => { setMotionDriver({ module: "@acme/springs", export: "driver" }); }); ``` The runtime host imports the module and calls its `transition` and `animate` methods. Each is optional: a driver with only `transition` leaves `animate-*` on TweenService. Omit `export` to use the module's default export. Write them as methods, not arrow-function properties. roblox-ts compiles the two differently, and the arrow form is a type error: ```ts title="@acme/springs" export const driver = { transition(instance: Instance, goal: object, spec: { time: number }) { … }, animate(instance: Instance, preset: string) { … }, }; ``` Tweens on `UICorner`, `UIStroke` and `UIShadow` pass a fourth argument naming the helper. Tweens on a margin wrapper pass `{ owner, marginBox: true }`. A three-argument driver still works. Every transformed module that needs the driver imports it. So the module must be a package name or a path relative to your `baseUrl`. A `./` path is rejected at load: ``` plugins.motion set the motion driver module to "./driver". A relative path cannot resolve from every module that imports the driver; use a package name or a baseUrl-relative path. ``` ### The JSON form `vela.config.json` cannot hold functions, so you write the object that plugins would produce: ```json title="vela.config.json" { "plugins": { "utilities": { "btn": "bg-blue-600 rounded-lg px-4 py-2", "panel": { "BorderSizePixel": "0" } }, "motion": { "module": "@acme/springs" } } } ``` You lose `theme()` and any logic, but no features. ## Presets A preset is a shareable piece of config: a design system's theme, plugins, utilities and variants, added in one line. ```ts title="vela.config.ts" import { defineConfig } from "vela-rbxts"; import { gameUiPreset } from "@acme/game-ui/vela"; export default defineConfig({ presets: [gameUiPreset()], theme: { extend: { colors: { brand: { 500: "Color3.fromRGB(99, 102, 241)" } } } }, }); ``` Presets apply after the built-in defaults and before your config, in array order. They merge as inputs, so a preset that replaces `theme.radius` can still be extended by your `theme.extend.radius`. `definePreset()` types a preset without resolving it: ```ts title="@acme/game-ui/vela.ts" import { definePreset } from "@vela-rbxts/config"; export const gameUiPreset = () => definePreset({ theme: { extend: { screens: { tablet: 900 } } }, }); ``` A `vela.config.json` can inline a preset object but cannot import one from a package. ## tsconfig plugin options Options go on the plugin entry in `tsconfig.json`. These are the keys you can write in JSON. | Prop | Type | Description | | --- | --- | --- | | `filter.skipNodeModules` | `boolean` | Default true. Skip any file whose path contains a node_modules segment. | | `filter.requireClassName` | `boolean` | Default true. Skip any file whose source text does not contain the substring className. | | `filter.requireJsxSyntax` | `boolean` | Default true. Skip any file whose source text does not match an opening-JSX-tag pattern. | | `diagnosticCodeBase` | `number` | Default 89000. The first numeric diagnostic code; each diagnostic in a file gets base + index. | | `projectRoot` | `string` | Defaults to the program's current directory. Has no effect: config discovery walks up from each file. | | `config` | `TailwindConfig` | A resolved config used for every file. It overrides the discovered config, but discovery still runs and can still fail the build. | ```json title="tsconfig.json" { "compilerOptions": { "plugins": [ { "transform": "vela-rbxts/transformer", "filter": { "skipNodeModules": true }, "diagnosticCodeBase": 89000 } ] } } ``` ## File eligibility Vela transforms a file only if it passes all five checks, in this order: 1. The name ends in `.tsx` (any case). **A `.ts` file is never transformed.** 2. It is not a declaration file (`.d.ts` or `.d.tsx`). 3. Its path has no `node_modules` segment, unless `filter.skipNodeModules` is off. 4. Its text contains `className`, unless `filter.requireClassName` is off. 5. Its text contains an opening JSX tag, unless `filter.requireJsxSyntax` is off. There are no globs. The three `filter` options are the only controls. Checks 4 and 5 are plain text scans, so `className` in a comment is enough to pass. ## See also - [Theming](https://docs.astra-void.xyz/vela-rbxts/guides/theming.md) for a working walkthrough of extending the theme. - [Utility reference](https://docs.astra-void.xyz/vela-rbxts/reference/utilities.md) for the classes that read these theme keys. - [API](https://docs.astra-void.xyz/vela-rbxts/reference/api.md) for `defineConfig` and `defaultConfig`. --- # CLI > The `vela` command. Lower your sources ahead of `rbxtsc`, with every command, flag and exit code. Source: https://docs.astra-void.xyz/vela-rbxts/reference/cli/ `vela build` lowers your `className` usage into a second source tree. `rbxtsc` then compiles that tree, with no transformer plugin. ```bash npx vela build && npx vela rbxtsc -p tsconfig.json ``` Use the CLI instead of [the transformer](https://docs.astra-void.xyz/vela-rbxts/getting-started/installation.md#choose-how-vela-runs), not alongside it. Both produce the same output. The CLI fits when your toolchain can't load a roblox-ts plugin, or when you want the lowered sources as a file you can review. Your config, the [`className` declaration](https://docs.astra-void.xyz/vela-rbxts/getting-started/installation.md#declare-the-classname-prop), your classes and every diagnostic work the same either way. The command is installed as both `vela` and `vela-rbxts`. ## Commands | Command | What it does | | --- | --- | | [`build`](#build) | Transform the source tree once, then exit | | [`watch`](#watch) | Transform once, then again on every change | | [`rbxtsc [args...]`](#rbxtsc-and-remap) | Run the project's `rbxtsc`, with its errors pointed back at `src` | | [`remap`](#rbxtsc-and-remap) | The same rewrite, as a filter over `rbxtsc` output on stdin | | [`sort [paths...]`](#sort) | Sort the classes in your sources, or check that they are sorted | `vela` with no command prints help and exits `0`. ## Options Every command takes the same flags. The last two apply to `sort` only. | Option | | | --- | --- | | `-p, --project <dir>` | Project root. Default: the current directory | | `--src <dir>` | Source tree to read, relative to the project root. Default: `src` | | `--out <dir>` | Generated tree to write. Default: `.vela/src` | | `--clean` | Delete the generated tree before building | | `-q, --quiet` | Hide the header and summary lines | | `-h, --help` | Print help | | `-v, --version` | Print the `vela-rbxts` version | | `--check` | `sort`: list the files that need sorting and exit `1`, writing nothing | | `--class-functions <names>` | `sort`: comma-separated helpers whose arguments are class lists, such as `cn,cva` | - Value flags take either form: `--src ui` or `--src=ui`. - For `rbxtsc`, put Vela's flags before the command. Everything after `rbxtsc` goes to roblox-ts: `vela --src app rbxtsc -w`. - `--quiet` hides only the `src -> .vela/src` header and the summary line. Warnings and diagnostics always print to stderr. No flag silences them. `--src` and `--out` can't be the same directory or contain each other, and `--out` can't be the project root. Vela rejects these before writing anything: ```text vela: error: --out must differ from --src: the generated tree would overwrite your sources. ``` ## Switching from the transformer Point `rootDir`, `baseUrl` and `include` at the generated tree, and remove the plugin entry: ```json title="tsconfig.json" { "compilerOptions": { "rootDir": ".vela/src", "baseUrl": ".vela/src", "outDir": "out" }, "include": [".vela/src"] } ``` Build in two steps. Run roblox-ts through [`vela rbxtsc`](#rbxtsc-and-remap) so its errors name your real files: ```bash title="Build" npx vela build && npx vela rbxtsc -p tsconfig.json ``` ```bash title="Watch" npx vela watch & npx vela rbxtsc -w -p tsconfig.json ``` `vela build` warns on every run if `rootDir` still points at `src` or the plugin is still registered: ```text vela: warning: tsconfig.json compilerOptions.rootDir is "src" but the generated tree is ".vela/src". Point rootDir and include at ".vela/src" so rbxtsc compiles the lowered sources. vela: warning: tsconfig.json still registers the "vela-rbxts/transformer" plugin. Remove it — the CLI already lowered these sources. ``` A leftover plugin only wastes work. It finds nothing left to lower. The check reads only `rootDir` and `plugins` from the root `tsconfig.json`, and it doesn't check `include`. If it can't parse the file, it stays silent. Comments and trailing commas are fine. > **TypeScript 7 breaks the CLI too** > > It fails on the first file with `compiler-invocation-failed` ([fix](https://docs.astra-void.xyz/vela-rbxts/guides/troubleshooting.md#the-build-fails-on-the-first-file-with-compiler-invocation-failed)). A `vela.config.json` avoids it, because only a `.ts` config goes through TypeScript. ## What lands in the generated tree `--out` mirrors all of `--src`: | Source file | In the generated tree | | --- | --- | | `.tsx` using `className` | Transformed. The output is reprinted, so comments are gone | | `.tsx` with no `className` | Copied as written | | Everything else (`.ts`, `.d.ts`, `.lua`, `.json`, assets) | Copied byte for byte | Folder structure is kept, so relative imports and `baseUrl` still resolve. Your `vela-env.d.ts` is copied too, so `className` still type-checks inside the generated tree. Vela keeps its own files in `.vela/`, outside the mirror, so none of them reach `out/`: | File | | | --- | --- | | `.vela/.gitignore` | Contains `*`, so the tree stays out of git. Written on the first run and never overwritten | | `.vela/build-manifest.json` | What the last run wrote. Used for pruning | | `.vela/maps/<path>.map` | A v3 source map per transformed file, such as `.vela/maps/client/App.tsx.map`. Used by [`vela rbxtsc` and `vela remap`](#rbxtsc-and-remap) | > **Edit src, never the generated tree** > > The next build overwrites any edit you make in `.vela/src`, with no warning. ## Rebuilds and pruning - An output that hasn't changed is never rewritten, so its mtime stays put and `rbxtsc -w` doesn't rebuild it. - When a source file is deleted, Vela deletes its output and any folder left empty. It only deletes files the manifest says it wrote. Files you added to the tree by hand are left alone. - `--clean` deletes the whole `--out` folder and resets the manifest, including any files you added. ## Diagnostics and exit codes Diagnostics print to stderr and point at your real files and lines, not the generated tree. Paths are relative to `--src`, so they have no leading `src/`: ```text client/V.tsx:4:27 - warning vela/compiler(unknown-variant): Unknown variant "checked" in "checked:px-4"; supported variants are active, dark, focus, gamepad, hover, landscape, mouse, portrait, touch, the breakpoints sm, md, lg, xl, 2xl and their `max-` forms, `group-*` and `peer-*` over hover, active, focus and the attribute variants, and `attr-[Name=value]`. 2 transformed, 2 copied, 1 warning (167ms) ``` The summary counts files transformed and copied. It adds removed files, errors and warnings when there are any. | Exit code | | | --- | --- | | `0` | Built. Warnings don't fail the run | | `1` | A file failed to compile, or `--src` doesn't exist | | `2` | Bad usage: unknown command or option, a flag missing its value, or a `--src`/`--out` conflict | A file with an error is not written, and its previous output is deleted. That stops `rbxtsc` from compiling a stale version. For example, a broken `vela.css`: ```text client/App.tsx - error vela/host(compiler-invocation-failed): Failed to parse vela.css: …/vela.css:3:10 "hotpink" is not a color. Write a hex literal, "rgb(r g b)", or a Color3 expression. 0 transformed, 2 copied, 1 removed, 1 error (4ms) ``` `client/App.tsx` stays out of `.vela/src` until you fix the stylesheet. A missing runtime fails the same way, with [`runtime-not-installed`](https://docs.astra-void.xyz/vela-rbxts/getting-started/installation.md#install-the-packages). Codes are the same as under the transformer, so [the diagnostics reference](https://docs.astra-void.xyz/vela-rbxts/reference/diagnostics.md) applies. Only the format differs: `vela/compiler(unknown-variant)` here, `TS89000: [@vela-rbxts/compiler] unknown-variant` under roblox-ts. ## `build` ```bash npx vela build [options] ``` Transforms or copies every file in `--src`, then deletes outputs whose source is gone. ## `watch` ```bash npx vela watch [options] ``` Builds once, prints `vela watch: waiting for changes...`, then rebuilds only what changed. Changes are debounced by 60ms, and each summary is prefixed: ```text vela watch: 1 transformed, 0 copied (26ms) ``` | Change | What happens | | --- | --- | | A source file edited | That file is rebuilt | | A source file deleted | Its output is deleted | | `vela.config.ts`, `vela.config.json` or `vela.css` at the project root edited | The whole tree is rebuilt with the new config | | A stylesheet that `vela.css` pulls in with `@import` edited | The whole tree is rebuilt, even if the file is outside the project | An `@import` you add while watch runs is picked up from the next rebuild. The transformer has no equivalent; see [the `vela.css` notes](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#velacss). Watch uses recursive `fs.watch`. Where the platform doesn't support it, Vela polls every 400ms instead and says so: ```text vela: warning: Recursive file watching is unavailable; polling every 400ms instead. ``` `SIGINT` and `SIGTERM` stop watching and exit with the last build's status. ## `rbxtsc` and `remap` roblox-ts only sees the generated tree, so its line numbers don't match your files. `vela rbxtsc` fixes that: ```text title="npx rbxtsc -p tsconfig.json" .vela/src/client/App.tsx:13:11 - error TS2322: Type 'string' is not assignable to type 'number'. ``` ```text title="npx vela rbxtsc -p tsconfig.json" src/client/App.tsx:5:8 - error TS2322: Type 'string' is not assignable to type 'number'. 5 const n: number = "oops"; ``` `vela rbxtsc` runs your project's roblox-ts and passes along everything after `rbxtsc`. It rewrites paths, lines and columns in both output streams back to `src`, and redraws the code frame from your file. It exits with rbxtsc's exit code. To run roblox-ts yourself, pipe its output through `vela remap`: ```bash npx rbxtsc -p tsconfig.json 2>&1 | npx vela remap ``` A pipe returns the last command's exit code. Set `pipefail` if your build depends on rbxtsc's. - rbxtsc runs in the project root. `vela -p game rbxtsc -p tsconfig.json` reads `game/tsconfig.json` and prints paths relative to `game`. - A stale map is ignored. If a file changed since its map was written, or has no map yet, its diagnostics print unchanged rather than pointing at the wrong line. - A copied file only gets its path rewritten, and only once its contents match the source. - A type error on a lowered prop points at the `className` it came from. ## `sort` ```bash npx vela sort [paths...] [options] ``` Sorts the classes in every `.tsx` file under `--src`, or under the files and directories you name. The order is the one the editor's [sort action](https://docs.astra-void.xyz/vela-rbxts/guides/editor-setup.md#sorting-class-names) writes, and the nearest `vela.config` is read the way a build reads it. `sort` works on your real sources, so it fits a transformer project too. ```text sorted src/client/App.tsx vela: sorted 1 file. ``` In CI or a pre-commit hook, add `--check`. It prints each unsorted file, writes nothing, and exits `1` if any file needs sorting: ```bash npx vela sort --check ``` ```text src/client/App.tsx vela: 1 file needs sorting. Run "vela sort" to fix. ``` A `className` and any `const` string it names are always sorted. To sort the arguments of helpers called outside a `className`, list them the way the editor's [`velaRbxts.classFunctions`](https://docs.astra-void.xyz/vela-rbxts/guides/editor-setup.md#settings) does: ```bash npx vela sort --class-functions cn,cva ``` ## What you give up - Your editor and `tsc --noEmit` see the generated tree, because that's what `rootDir` and `include` name. Type errors, stack traces and go-to-definition land in `.vela/src`. Only `vela rbxtsc` and `vela remap` map errors back. Luau stack traces at runtime still name generated code. The [language server](https://docs.astra-void.xyz/vela-rbxts/guides/editor-setup.md) reads your real sources, so completions, hover and colors work as usual. - It's a second process to keep running. If `vela watch` dies, `rbxtsc -w` keeps compiling the last tree it wrote, with no warning. ## Related - [Installation](https://docs.astra-void.xyz/vela-rbxts/getting-started/installation.md): the transformer setup, and the TypeScript versions both paths need. - [Configuration](https://docs.astra-void.xyz/vela-rbxts/reference/config.md): `vela.config.ts`, which the CLI reads the same way. - [Diagnostics](https://docs.astra-void.xyz/vela-rbxts/reference/diagnostics.md): every code either path can report. --- # Diagnostics > Every diagnostic code Vela reports, what triggers it, and how to fix the common ones. Source: https://docs.astra-void.xyz/vela-rbxts/reference/diagnostics/ This page lists every code Vela reports, with fixes for the ones you'll hit most. Failures that produce no diagnostic at all are in [Troubleshooting](https://docs.astra-void.xyz/vela-rbxts/guides/troubleshooting.md). ## How diagnostics reach you Vela's diagnostics appear in your `rbxtsc` output in this format: ```text [@vela-rbxts/compiler] unknown-theme-key: Unknown theme key "brand-500" for background color utility in className literal. ``` The bracketed prefix says where it came from: - `@vela-rbxts/compiler`: a problem in your classes. - `@vela-rbxts/rbxtsc-host`: a problem the adapter found, such as `compiler-invocation-failed`. - `vela-rbxts`: the compiler couldn't load. Numeric codes are `89000` plus an index, restarting in each file. Change the base with [`diagnosticCodeBase`](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#tsconfig-plugin-options). Every code is a warning unless listed under [Errors](#errors), except the editor-only `canonical-class`, which is info. In the editor you can change any code's level with [`velaRbxts.lint`](https://docs.astra-void.xyz/vela-rbxts/guides/editor-setup.md#settings). An error fails the build. The file isn't emitted. Under the CLI, `vela build` writes nothing to `.vela/src` for that file, removes any earlier output for it, and exits 1. > **Never seen a Vela warning?** > > Some roblox-ts builds don't expose `context.addDiagnostic`, and then every Vela warning is silently dropped. Test with `className="bg-nope-500"`. If roblox-ts can't take an error that way, the plugin throws instead, so errors are never lost. ### Where the underline lands Read the message, not the underline. A token in a plain string `className` gets its exact position, and so does `tsx-parse-failed`. For a computed `className`, Vela underlines the first place the token's text appears in the file, which may be an unrelated comment. A diagnostic with no token lands at the top of the file. `classname-on-unsupported-host` gets an exact range on a string literal and the top of the file on a computed expression. ## Code table ### Families, variants, and payload shapes | Code | Fires when | |---|---| | `unsupported-utility-family` | The token matches no known utility, usually a typo | | `no-roblox-equivalent` | A real Tailwind family Roblox can't express (`tracking-*`, `blur-*`, `cursor-*`, …). The message names the family | | `unknown-variant` | A prefix before `:` that isn't a variant. The message lists the valid ones, your breakpoints, and the `attr-[…]` form | | `unknown-breakpoint` | `max-` before something that isn't a breakpoint. Check `theme.screens` | | `invalid-breakpoint-range` | Width bounds that can never match, like `lg:max-md:` or `md:max-md:` | | `malformed-attribute-variant` | An `attr-[…]`, `group-attr-[…]` or `peer-attr-[…]` that doesn't parse: an open bracket, or no value. The message says which | | `unsupported-relational-variant` | A `group-*` or `peer-*` reading something a parent or sibling can't report, like `group-md:`, or a name with invalid characters | | `conditional-marker` | A `group` or `peer` marker under a variant, like `hover:group`. A marker can't come and go | | `marker-on-component` | A `group` or `peer` marker on a component, which has no instance to tag | | `invalid-custom-variant` | The config defines a variant it can't register. `group`, `peer`, and names starting `group-` or `peer-` are reserved, and `defineConfig` throws on them too | | `unsupported-arbitrary-value` | A `[...]` value the family can't read: `w-[abc]`, `bg-[notacolor]`, `font-[600]`. Spaces inside brackets don't split the token, so `w-[calc(100% - 4px)]` reports once. See [arbitrary values](https://docs.astra-void.xyz/vela-rbxts/reference/utilities.md#arbitrary-values) | | `unsupported-opacity-modifier` | A `/N` opacity on a family with no transparency. Only `placeholder-*` | ### Theme and color | Code | Fires when | |---|---| | `unknown-theme-key` | A color, radius, spacing or font-family key isn't in the theme | | `unsupported-color-key` | `current` or `inherit`, or `transparent` on a property with no transparency | | `color-missing-shade` | A palette used without a shade, when the palette has no `DEFAULT` | | `color-invalid-shade` | A shade on a plain color, or a shade the palette doesn't define | | `unsupported-size-spacing-value` | A spacing value used for a size isn't offset-only | ### Per-value rejections Each family with a fixed set of values has its own code, so the message says which family rejected what. | Code | Family | |---|---| | `unsupported-border-value` | `border-*` styles, sides, and unlisted thicknesses | | `unsupported-stroke-value` | `ring-*` / `outline-*` unlisted values, `inset`, `offset-*` | | `unsupported-rotation-value` | `rotate-*` outside the degree list | | `unsupported-scale-value` | `scale-*` outside the value list | | `unsupported-opacity-value` | `opacity-*` that isn't an integer 0–100 | | `unsupported-aspect-value` | `aspect-*` other than `square`, `video` or a valid bracket | | `unsupported-flex-direction` | `flex-*` that's neither a direction nor a flex-item keyword | | `unsupported-alignment-value` | An unknown `justify-*`, `items-*` or `content-*` | | `unsupported-grid-value` | `grid-cols-*` / `grid-rows-*` outside 1–12 | | `unsupported-layout-order-value` | An unknown `order-*` | | `unsupported-space-value` | An unknown `space-x-*` / `space-y-*` | | `unsupported-margin-value` | An unknown margin value | | `unsupported-negative-margin` | `-mr-*` or `-mb-*`. Only top and left margins can be negative. Each side holds one signed value, and the last class wins. See [margin](https://docs.astra-void.xyz/vela-rbxts/reference/utilities.md#margin) | | `unsupported-divide-value` | An unknown `divide-*` value | | `unsupported-line-height-value` | `leading-*` outside the six named keys | | `unsupported-text-size` | An unresolvable `text-{size}`. Not reachable in practice | | `unsupported-font-weight` | An unknown weight name. Not reachable: see below | | `unsupported-text-alignment` | `text-justify`, or `align-*` other than top, middle or bottom | | `unsupported-whitespace-value` | `whitespace-*` other than `normal` or `nowrap` | | `unsupported-gradient-direction` | `bg-gradient-to-{x}` outside the eight directions | | `unsupported-backdrop-blur-value` | `backdrop-blur-*` other than `xs`–`3xl` or `none`, brackets included. `UIBlur` has three strengths | | `unsupported-canvas-size-value` | `canvas-*` other than `auto`, `auto-x`, `auto-y` or `none` | | `unsupported-scrollbar-thickness` | An unknown scrollbar thickness | | `unsupported-overflow-value` | `overflow-*` other than `hidden`, `clip` or `visible` | | `unsupported-anchor-value` | `origin-{x}` outside the nine origin keys | | `unsupported-object-fit-value` | `object-*` other than `cover`, `contain`, `fill` or `tile` | | `unsupported-pointer-events-value` | `pointer-events-*` other than `none` or `auto` | | `unsupported-overscroll-value` | `overscroll-*` other than `auto`, `contain` or `none` | | `unsupported-scroll-value` | `scroll-*` other than `x`, `y`, `xy` or `none`. Tailwind's `scroll-smooth` and `scroll-m-*` land here | | `unsupported-transition-value` | An unknown transition, duration, delay or ease value | | `unsupported-animation-value` | `animate-*` outside the presets | Z-index has four codes: `z-auto` is `unsupported-z-index-auto`, `-z-N` is `unsupported-negative-z-index`, `z-[1.5]` is `unsupported-arbitrary-z-index`, and any other unbracketed number is `unsupported-z-index-value`. A whole-number `z-[15]` works. `font-*` never reaches `unsupported-font-weight`. Anything that isn't a weight name is read as a [`theme.fontFamily`](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#fontfamily) key, so `font-nope`, `font-600` and `font-extrablack` all report `unknown-theme-key`. ### Contextual warnings | Code | Fires when | |---|---| | `transition-without-runtime` | `transition`, `duration-*`, `ease-*` or `delay-*` on an element with no variants and no dynamic `className`. Nothing changes, so the tokens are dropped | | `motion-on-component` | `transition-*` or `animate-*` on a component, or motion under a variant there. Motion needs a real instance | | `explicit-prop-overrides-class` | A class sets a property the element also sets as a prop. The prop wins everywhere: base, variants and branches | | `explicit-helper-overrides-class` | A class builds a helper, like the `UICorner` from `rounded-lg`, that the element already has as a child. Your child wins. `UIShadow` children are exempt, since shadows stack | | `possible-duplicate-helper` | Same, but the compiler can't tell: the child is conditional, or a variant changes the helper. Both are kept | | `isolate-not-static` | `isolate` under a variant, in a branch, or in a runtime class value. An instance can't change class after it's built | | `isolate-needs-frame` | `isolate` on anything but a `frame`. Use a `<canvasgroup>` instead | | `divide-without-list-layout` | `divide-*` with no list layout, so separators would pile up in the corner. Add `flex`, `flex-col` or `space-*` | | `divide-with-grid` | `divide-*` next to `grid`, where each separator would take a cell | | `divide-unreadable-order` | React only. A child of a divided list has `order-*` under a variant, in a branch, or in a runtime value. Separators follow the static order | | `decoration-on-richtext` | `underline` or `line-through` on an element that already sets `RichText`. Vela leaves your markup alone | | `classname-on-unsupported-host` | Build only. `className` on an element that's neither a supported host nor a component | | `unsupported-host-utility` | Editor only. The utility doesn't apply to that element | | `overridden-class` | Editor only. A later class under the same condition overrides this one, like `bg-red-500` in `bg-red-500 bg-blue-500`. See [editor setup](https://docs.astra-void.xyz/vela-rbxts/guides/editor-setup.md#overridden-classes) | | `canonical-class` | Editor only, info. An arbitrary value lowers exactly like a named class, like `w-[16px]` for `w-4`. The quickfix writes the name. See [editor setup](https://docs.astra-void.xyz/vela-rbxts/guides/editor-setup.md#arbitrary-values-with-a-named-class) | ### Errors | Code | Fires when | |---|---| | `tsx-parse-failed` | The file didn't parse, or parsed with recovered errors | | `tsx-emit-failed` | Code generation failed after a successful transform | | `invalid-config-json` | The resolved config is malformed. The file falls back to the default theme | | `compiler-invocation-failed` | The native compiler call threw | | `runtime-not-installed` | The file imports a runtime that `node_modules/@rbxts` doesn't have, or has at a different version from the compiler. The message names each package. See [installation](https://docs.astra-void.xyz/vela-rbxts/getting-started/installation.md) | | `config-resolution-failed` | The config failed to resolve. It's checked on every build, so it fails even when no source file changed | | `compiler-unavailable` | The native compiler couldn't load | | `transformed-source-invalid` | The lowered file doesn't parse, so it isn't emitted. This is a Vela bug: report it with the file's `className` usage | `compiler-invocation-failed` on the first file, with this message, means TypeScript 7: ```text Cannot read properties of undefined (reading 'Latest') ``` Install `typescript@5.9.3`. Anything else under this code means the native binding failed to load or threw. ### classname-on-unsupported-host Vela only lowers `className` on the eight supported host elements and on components. Anything else keeps the attribute and warns: ```tsx title="Warns, and the className survives untouched" <screengui className="bg-slate-700" /> ``` That includes lowercase elements like `screengui` and namespaced tags like `<svg:rect />`. The message names only the part after the colon, so `<svg:rect />` is reported as `rect`. Move the classes onto a `frame` inside, or onto a component that forwards them. This code only appears in builds, never in the editor. ### unsupported-host-utility This code only appears in the editor. `<frame className="text-red-500" />` builds without complaint and writes `TextColor3` onto a Frame. It's never raised on a component, since Vela can't know what `<Panel />` renders. On the runtime path, the same utility is dropped silently instead. Neither path warns at build time. ## The ones you will actually hit ### unsupported-utility-family Vela doesn't recognize the class, usually because of a typo. The token is dropped and the rest of the element compiles. ```tsx title="A typo" <frame className="shadwo-lg rounded-lg" /> ``` `rounded-lg` applies, and `shadwo-lg` warns. The same code covers typos and unknown families, so check the spelling before deciding a feature is missing. ### no-roblox-equivalent The class is real Tailwind, but Roblox UI can't express it: ```text title="Compiler output" [@vela-rbxts/compiler] no-roblox-equivalent: Tailwind "tracking" utilities have no Roblox equivalent, so "tracking-wide" is ignored. ``` The [not-implemented table](https://docs.astra-void.xyz/vela-rbxts/reference/utilities.md#not-implemented) gives the reason for each family and what to use instead. ### unknown-theme-key The class parsed, but the key isn't in your theme. The message names the scale it searched. ```tsx title="Fails" <frame className="rounded-huge p-0.25" /> ``` `huge` isn't a radius key. Add it under `theme.extend.radius`, or use `4xl`. `p-0.25` fails because spacing only accepts multiples of `0.5`. Use `p-0.5`. **A color you defined can still report this.** A top-level `theme.colors` in your config silently discards `theme.extend.colors`. See [merge semantics](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#merge-semantics). ### color-missing-shade You used a palette without a shade, and the palette has no `DEFAULT`: ```tsx title="Fails, if your brand palette defines only 500 and 700" <frame className="bg-brand" /> ``` ```text title="Compiler output" [@vela-rbxts/compiler] color-missing-shade: Color palette "brand" for background color utility has no "DEFAULT" shade, so it requires an explicit shade such as "brand-500" in className literal. ``` Write `bg-brand-500`, or add a `DEFAULT` key to the palette. Built-in palettes all have one, so `bg-slate` works. Plain colors like `black` and `white` never need a shade. ### color-invalid-shade You gave a plain color a shade, or asked a palette for a shade it doesn't have: ```tsx title="Fails" <frame className="bg-white-500 text-brand-400" /> ``` Write `bg-white`. For `text-brand-400`, add `400` to the palette or use a shade you defined. Vela doesn't fill in missing shades. ## Editor-only filtering While you type, the editor hides `unknown-theme-key` if what you've typed could still become a real key. `bg-sla` shows nothing on the way to `bg-slate-800`, but `bg-nope` warns at once. So a wrong key that happens to be the start of a real one, like `bg-slat`, looks fine in the editor. The build still warns. No other code is filtered. ## See also - [Utility reference](https://docs.astra-void.xyz/vela-rbxts/reference/utilities.md) for the values each family accepts. - [Editor setup](https://docs.astra-void.xyz/vela-rbxts/guides/editor-setup.md) for getting these into your editor. - [Troubleshooting](https://docs.astra-void.xyz/vela-rbxts/guides/troubleshooting.md) for failures that produce no diagnostic. --- # API > Everything you can import from `vela-rbxts`, every published package, and the versions Vela is tested against. Source: https://docs.astra-void.xyz/vela-rbxts/reference/api/ Most projects import only `defineConfig`, and register `vela-rbxts/transformer` in `tsconfig.json`. This page lists everything else. ```bash pnpm add vela-rbxts ``` ## From `vela-rbxts` ```ts import { defaultConfig, defineConfig, definePreset, plugin, createTransformer, type TailwindConfig, type TailwindConfigInput, type VelaPreset, type ThemeScreens, type VariantDefinition, type ClassValue, type StylableProps, } from "vela-rbxts"; ``` | Export | Kind | What it is | | --- | --- | --- | | [`defineConfig`](#defineconfig) | function | Resolves a config against the defaults | | [`defaultConfig`](#defaultconfig) | value | The resolved built-in theme | | `definePreset` | function | Types a [preset](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#presets) without resolving it | | `plugin` | function | Wraps a [plugin](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#plugins) handler, with an optional name | | [`createTransformer`](#createtransformer) | function | The rbxtsc host bridge, for tooling | | [Types](#types) | types | Config, preset, plugin, variant and `className` types | The plugin and variant types come from `@vela-rbxts/config`, re-exported here so you don't need to install it. ### defineConfig ```ts function defineConfig(input?: TailwindConfigInput): TailwindConfig; ``` Resolves your config against the built-in defaults. `defineConfig()` with no argument returns a fresh copy of `defaultConfig`. It's available in `vela.config.ts` even without the import. ### defaultConfig ```ts const defaultConfig: TailwindConfig; ``` The built-in theme Vela uses when there is no config: 28 color families, ten named radius keys plus `DEFAULT`, and one spacing key. ### createTransformer ```ts function createTransformer( options?: RbxtscTransformerBridgeOptions, ): RbxtscTransformerBridge; // the returned bridge: // { name, getFileEligibility, shouldTransformFile, transformSource, transformFile } ``` Returns the rbxtsc host bridge. Its `name` is `"@vela-rbxts/rbxtsc-host"`. `transformSource` and `transformFile` are the same function. You only need this for tooling that runs the transform itself. > **This is not the tsconfig plugin** > > `tsconfig.json` needs `vela-rbxts/transformer`. Passing this `createTransformer` to roblox-ts transforms nothing, with no error. ### Types | Prop | Type | Description | | --- | --- | --- | | `TailwindConfig` | `{ preflight; framework; theme: { colors; radius; spacing; fontFamily; screens; rem }; plugins }` | A fully resolved config, every field present. What defineConfig returns and the compiler consumes. | | `TailwindConfigInput` | `{ presets?; preflight?; framework?; theme?: { …; extend?: { … } }; plugins? }` | What you pass to defineConfig. Everything is optional, and theme has an extend branch. | | `VelaPreset` | `TailwindConfigInput` | A shareable slice of config. Same shape as defineConfig's input. Type one with definePreset() so it merges as an input, not a finished config. | | `ThemeScreens` | `Record<string, number>` | Breakpoint widths in pixels, as in theme.screens. | | `VariantDefinition` | `{ attribute: string; equals: string \| number \| boolean }` | A project-defined variant. It matches while the instance has that Roblox attribute with that value. | | `ClassValue` | `string \| number \| boolean \| null \| undefined \| Record<string, boolean \| null \| undefined> \| ClassValue[]` | What the className prop accepts, including the conditional object and nested array forms. | | `StylableProps` | `StylableProps<P = unknown>` | Your props P plus { className?: ClassValue }. Use it on a component that forwards className. | The root also re-exports the rest of the plugin API's types: `AttributeVariant`, `VariantAttributeValue`, `PluginVariants`, `MotionDriver`, `PluginApi`, `PluginHandler`, `PluginPropMap`, `PluginUtilities`, `PluginUtilityValue`, `ResolvedPlugins`, `ResolvedPluginsInput` and `VelaPlugin`. ### The global augmentation Importing `vela-rbxts` adds `className` to every element: ```ts declare global { namespace React { interface Attributes { className?: ClassValue; } } namespace Vide { interface Attributes { className?: ClassValue | (() => ClassValue); } } } ``` It only applies once something in your program imports the package. Use a one-line `.d.ts`: ```ts title="src/vela-env.d.ts" import "vela-rbxts"; ``` Some helpers in `@vela-rbxts/config` are not re-exported from the root. Import them from `@vela-rbxts/config` directly, and expect them to change more often: - Functions and constants: `SHADES`, `PALETTE_DEFAULT_KEY`, `resolveThemeColors`, `mergeColorRegistry`, `normalizeColorRegistry`, `normalizeColorScale`. - Types: `Shade`, `PaletteKey`, `PaletteDefaultKey`, `ThemeScale`, `ColorPalette`, `ColorValue`, `ColorScaleInput`, `ThemeColors`, `ColorInputMap`, `ThemeConfig`, `ThemeConfigInput`. ## From `vela-rbxts/transformer` The program transformer roblox-ts loads. Register it in `tsconfig.json`: ```json title="tsconfig.json" { "compilerOptions": { "plugins": [{ "transform": "vela-rbxts/transformer" }] } } ``` It's a CommonJS module whose export is the transformer factory. `.createTransformer`, `.createRbxtsTailwindProgramTransformer` and `.default` all point to the same function. It throws if roblox-ts doesn't pass it a TypeScript instance. Options are in [Configuration](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#tsconfig-plugin-options). ## Published packages Install `vela-rbxts` and the VS Code extension. Everything else arrives as a dependency. | Package | What it is | Install directly? | |---|---|---| | `vela-rbxts` | Config helpers, types, the global augmentation, the transformer subpath, and the `vela` CLI | Yes. The only one an app installs | | `@vela-rbxts/compiler` | The Rust compiler as an N-API addon: transform, completions, hover, diagnostics, colors, inlay hints, sorting | No, a dependency | | `@vela-rbxts/compiler-wasm` | The same compiler as WebAssembly, for places the native addon can't load, such as a browser | Only to compile outside Node | | `@vela-rbxts/config` | The theme schema, `defineConfig`, `defaultConfig`, and the color helpers | Only for a helper the root doesn't re-export | | `@vela-rbxts/core` | Shared constants, including the supported host element tags | No. Nothing depends on it either | | `@vela-rbxts/ir` | The style representation shared by the compiler and its consumers | No | | `@vela-rbxts/types` | Shared TypeScript types | No | | `@vela-rbxts/rbxtsc-host` | The roblox-ts adapter: file eligibility, config discovery, diagnostic mapping, and `sortSourceForHost`, which `vela sort` runs on | No | | `@rbxts/vela-runtime-core` | The shared runtime: resolution, theme, rem math, rich text, margin and divide | No, comes with each runtime host | | `@rbxts/vela-runtime` | The React runtime host, one ModuleScript shared by the place | No, ships with `vela-rbxts` | | `@rbxts/vela-runtime-vide` | The Vide runtime host, used when the project targets Vide | No, ships with `vela-rbxts` | | `@vela-rbxts/lsp` | The language server and its platform packages | Only for an editor other than VS Code | | `vela-rbxts-lsp` | The VS Code extension, Vela Roblox IntelliSense, published as a VSIX, not to npm | Install `astra-void.vela-rbxts-lsp` from the marketplace | All packages share one version, currently 0.15.0. The VS Code extension ships with each release, but the marketplace lists it under a date-based build number, such as `2026.11.4001`. > **Keep versions in lockstep** > > Don't mix versions across Vela's packages. A runtime at a different version from the compiler fails the build with `runtime-not-installed`. The `@rbxts/vela-runtime*` packages are the only Vela code that reaches your place. They live under `@rbxts` so roblox-ts and Rojo find them with no config change. With pnpm, hoist that scope ([installation](https://docs.astra-void.xyz/vela-rbxts/getting-started/installation.md#install-the-packages)). Each runtime host lists its UI library as an optional peer, so a Vide project never installs React. The host you don't use is an unused ModuleScript. `vela-rbxts` installs the [CLI](https://docs.astra-void.xyz/vela-rbxts/reference/cli.md) as two commands, `vela` and `vela-rbxts`. They are the same. ### Public subpaths | Subpath | What it exposes | | --- | --- | | `@vela-rbxts/rbxtsc-host/project-config` | Config discovery and loading, used by the VS Code extension. Also `projectConfigDependencies(sourceFileName)`: every file a source file's config was built from, including `vela.css` and its imports | | `@vela-rbxts/compiler/native` | The raw N-API binding | Both of those packages also export `./package.json`. `vela-rbxts` ships a `schema.json` for the config. Point a `vela.config.json`'s `$schema` at `./node_modules/vela-rbxts/schema.json`. ## Version requirements | Tool | Tested version | |---|---| | Node | 24 (what CI runs) | | TypeScript | 5.9.3 (6.x also builds, 7 does not) | | roblox-ts | `^3.0.0` | | `@rbxts/react` | `^17.3.7-ts.1` | | `@rbxts/services` | `^1.6.0` | | `@rbxts/types` | `^1.0.958`, the first with `UIBlur` | | VS Code | `^1.91.0`, the extension's only `engines` entry | > **Nothing checks these at install** > > No package declares TypeScript or roblox-ts as a peer, so a wrong version shows up only as a build failure. TypeScript is an upper bound as well as a floor. Vela calls your project's TypeScript directly, not the copy roblox-ts pins for itself. TypeScript 7 fails on the first file with `compiler-invocation-failed: Cannot read properties of undefined (reading 'Latest')`. The React range is narrower than it looks. A caret on a prerelease only matches prereleases of `17.3.7`, so the current `latest`, `17.3.13-ts.1`, is outside it. Under npm that nests the runtime and fails the build with `runtime-not-installed`. See [installation](https://docs.astra-void.xyz/vela-rbxts/getting-started/installation.md#install-the-packages). `@rbxts/services` is needed at runtime. The runtime reads `UserInputService` and `Workspace` from it to evaluate variants. ### Prebuilt compiler binaries The compiler ships native binaries for: - `x86_64-unknown-linux-gnu` - `x86_64-unknown-linux-musl` - `aarch64-unknown-linux-gnu` - `aarch64-apple-darwin` - `x86_64-apple-darwin` - `x86_64-pc-windows-msvc` Windows on ARM (`aarch64-pc-windows-msvc`) and linux arm64 musl have no binary. Build the compiler crate from source there. > **Cannot find native binding** > > On an unsupported platform the loader fails with `Cannot find native binding.` Reinstalling won't help, whatever the message says. The loader's last fallback looks for `@vela-rbxts/compiler-wasm32-wasi`, which isn't published. `@vela-rbxts/compiler-wasm` is a separate package with its own API, not a drop-in replacement. ## The compiler's `sourceMap` option ```ts transform(source, { configJson, sourceMap: true }); ``` With `sourceMap: true`, the result also has `mappings`: a flat, sorted array of `[genLine, genCol, origLine, origCol]` entries, 0-based, with UTF-16 columns. [`vela build`](https://docs.astra-void.xyz/vela-rbxts/reference/cli.md#rbxtsc-and-remap) turns these into the maps under `.vela/maps`. Leave it off unless you write the output to disk. ## See also - [Configuration](https://docs.astra-void.xyz/vela-rbxts/reference/config.md): the schema `defineConfig` accepts. - [Diagnostics](https://docs.astra-void.xyz/vela-rbxts/reference/diagnostics.md): what the transformer reports. --- # Release notes > What changed in each Vela release, and the sharp edges still open. Source: https://docs.astra-void.xyz/vela-rbxts/reference/release-notes/ Every package moves in lockstep, so a fix anywhere bumps everything. Releases are tagged from `v0.3.0`, and the upstream [`CHANGELOG.md`](https://github.com/astra-void/vela-rbxts/blob/main/CHANGELOG.md) carries the per-package detail. Installing for the first time? You are on the current release — skip to [what is still open](#still-open). ## 0.15.0 The current release. It changes the editor and the CLI only. Every file lowers exactly as it did on 0.14.0, so there is nothing to migrate. **The VS Code extension is now called Vela Roblox IntelliSense.** Only the display name changed. The marketplace ID `astra-void.vela-rbxts-lsp`, the `velaRbxts.*` settings and the `@vela-rbxts/lsp` server keep their names, so your install and settings carry over. **The editor reads class lists outside `className`.** A `const` string a `className` names is completed, hovered, checked and sorted where it's declared. It reads the same consts the compiler lowers, so a `let` or a const declared later is skipped. A new `velaRbxts.classFunctions` setting lists helpers, such as `cn`, `cva` or a `tw` tagged template, whose arguments count as class lists wherever they're called. See [editor setup](https://docs.astra-void.xyz/vela-rbxts/guides/editor-setup.md#what-the-language-server-provides). **An arbitrary value points at the named class it equals.** `w-[16px]`, `h-[100%]` and `text-[14px]` lower exactly as `w-4`, `h-full` and `text-sm`. They now get a `canonical-class` info diagnostic with a quickfix to the named form. Your theme's own steps count, and variants are kept. **Diagnostic levels per code.** `velaRbxts.lint` maps a code to `error`, `warning`, `info`, `hint` or `ignore`. `velaRbxts.validate: false` hides every Vela diagnostic and keeps completions, hover and colors. Other editors send both in `initializationOptions` or `workspace/didChangeConfiguration`. **`vela sort` and `vela sort --check`.** The editor's class sort now runs from the command line, over `--src` or the paths you name. `--check` lists unsorted files and exits `1` without writing, for CI and pre-commit hooks. `--class-functions cn,cva` sorts the same helpers as the editor. See [the CLI reference](https://docs.astra-void.xyz/vela-rbxts/reference/cli.md#sort). **Three VS Code commands.** **Vela: Restart Language Server** re-reads every `vela.config` without reloading the window. **Vela: Show Output** opens the server's log, and **Vela: Sort Classes** sorts the active file. For tool authors: `EditorDiagnostic` gains an optional `replacement`, `EditorOptions` gains `classFunctions`, and `@vela-rbxts/rbxtsc-host` exports `sortSourceForHost`. ## 0.14.0 A prop now beats a class, Vela errors fail the build, and the long-open layout edges are closed. It also adds `group-*` / `peer-*`, a `vela.css` config source, inset and text shadows, backdrop blur and `isolate`. Read the first three entries before upgrading. They change what an existing project renders or whether it builds. **A prop written on the element outranks the class that names it.** `<frame className="bg-surface" BackgroundColor3={color} />` used to emit two `BackgroundColor3` attributes. The class's came last and replaced your binding. Now the class's copy is left out of the base, the variants and the branches, and the build warns `explicit-prop-overrides-class`. A helper written as a child beats the class's the same way (`explicit-helper-overrides-class`). A conditional child, or a helper a variant changes, is reported as `possible-duplicate-helper`. **A spread follows JSX order.** What a class lowers to now sits where the `className` is written, and preflight's defaults go first. So `<textbutton className="bg-slate-700" {...props} />` lets `props.BackgroundColor3` win. Before, the class always landed last. Move the `className` after the spread to keep the class winning. **A Vela failure fails the build.** A file with any error is not emitted: the `rbxtsc` plugin keeps the original out of the program, and `vela build` writes nothing and removes what an earlier run wrote. A config that broke after the last incremental build now fails with `config-resolution-failed` even when no file changed. A native compiler that cannot load fails with `compiler-unavailable`. Before, `rbxtsc` downgraded that to a warning and shipped every `className` raw. A runtime that never reached `node_modules/@rbxts` fails with `runtime-not-installed`, naming what is missing. Before, the place built and then stopped on play with "Could not find module: vela-runtime-core". See [installation](https://docs.astra-void.xyz/vela-rbxts/getting-started/installation.md) for the pnpm setting it usually means. **`group-*` and `peer-*` variants.** `group-hover:`, `group-active:` and `group-focus:` read the nearest ancestor marked `group`. `peer-hover:` and the rest read a sibling marked `peer`. Both take a name (`group-hover/card:`) and read attribute variants (`group-selected:`, `group-attr-[State=open]/card:`). A marker lowers to a CollectionService tag, so it works across component boundaries and on Vide. Roblox keeps no sibling order, so any marked sibling counts as a peer. `group`, `peer` and any name starting `group-` or `peer-` are now reserved, so a custom variant by those names is rejected. See [Responsive and input variants](https://docs.astra-void.xyz/vela-rbxts/guides/responsive-and-input-variants.md). **A `vela.css` config source.** `@theme` tokens take CSS values, so `--color-brand-500: #3b82f6` becomes `Color3.fromRGB(59, 130, 246)`. `@custom-variant` registers a variant and `.btn { @apply … }` registers a utility. `@import` folds in a sibling as a preset. It only extends, on top of a `vela.config.ts` or with none at all. Selectors, pseudo-classes and `@media` are diagnosed rather than accepted. See [configuration](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#velacss). **Inset and text shadows.** `inset-shadow-*` and `text-shadow-*` lower to Roblox's upgraded `UIShadow`, each as its own instance, so a drop, an inset and a text shadow can share one element. `shadow-inner` used to warn `unsupported-shadow-inset`. It now lowers as `inset-shadow-sm`, and the diagnostic is gone. Both engine features are in Studio beta and do not render in a live game yet. **`backdrop-blur-*` lowers to `UIBlur`.** Roblox has three strengths where Tailwind has seven sizes: `xs`/`sm` are `Light`, `md`/`lg` `Medium`, and `xl` through `3xl` `Heavy`. Any other size warns `unsupported-backdrop-blur-value`. Not yet checked in Studio. It needs `@rbxts/types` 1.0.958 or later to typecheck. **`isolate` fades a subtree as one layer.** On a `frame` it builds a `canvasgroup`, so `opacity-*` lowers to `GroupTransparency` and overlapping children stop darkening where they overlap. It has to be static: a variant or a branch warns `isolate-not-static`, and any other host warns `isolate-needs-frame`. Before, it was `no-roblox-equivalent`. **The lowercase `<uishadow>` is gone.** A statically lowered `shadow-*` emitted `<uishadow>`, which `@rbxts/react` passed to the case-sensitive `Instance.new`, and the tree around it unmounted. The static path now writes `<__VelaHelper.uishadow>`, whose runtime value is the real class name. Vide keeps the plain tag. **`gap-*` on a `grid` lands on the grid alone.** It used to write a second `UIListLayout` that fought the `UIGridLayout` for the children. A variant gap now recomposes `CellSize` and `CellPadding` too. A gap `CellPadding` cannot carry, such as `gap-[10%]`, still falls back to list padding. **`divide-*` is rebuilt.** Items sit `gap + thickness` apart, as in CSS, instead of `2 × gap + thickness`. Separators follow the children's `LayoutOrder` and `order-*`, fade with `opacity-*`, and `divide-x-0` / `divide-y-0` remove them. A divided element now takes its `UIListLayout` from the runtime host. Three new warnings: `divide-without-list-layout`, `divide-with-grid` and `divide-unreadable-order`. See the [utilities reference](https://docs.astra-void.xyz/vela-rbxts/reference/utilities.md#divide). **Classes rank the way Tailwind's stylesheet does.** A matching variant beats the base wherever it is written, so `hover:bg-blue-500 bg-red-500` is blue under the pointer. A wider breakpoint beats a narrower one. Orientation, `dark:` and the input variants beat every breakpoint. Among equal conditions, the class written last wins. This holds on both paths. **Variant margins, divides, transitions and text decoration apply.** `hover:mt-4`, `md:divide-y` and `dark:underline` were dropped without a diagnostic. They are forwarded to the runtime host now. Motion under a variant on a component warns `motion-on-component`. **Smaller fixes.** A `const` bound to a string literal lowers as the string would. A prop transparency survives a fade that arrives from an ancestor component. `opacity-*` no longer paints a background preflight made transparent. The runtime path composes opacity, negative margins and a color's `/N` the way the static path does. An `m-*` box now tweens with its element. A Vide element built inside a function child no longer throws (see the [Vide guide](https://docs.astra-void.xyz/vela-rbxts/guides/vide.md)). A variant font utility keeps the rest of the font. A variant `max-w-*` no longer zeroes the other axis. **Tooling.** The CLI writes source maps under `.vela/maps`, and `vela rbxtsc` / `vela remap` point rbxtsc's diagnostics back at your sources. It also copies a file the compiler did not change exactly as written. `vela watch` follows every stylesheet the config was built from. The editor flags a class a later class overrides (`overridden-class`, editor only). The language server moved to `tower-lsp-server`. See the [CLI reference](https://docs.astra-void.xyz/vela-rbxts/reference/cli.md). ## 0.13.1 **`border-[#hex]` and `border-red-500/50` resolve on the runtime path.** The in-game parser refused both, so a border color from a dynamic `className` was dropped, and the `UIStroke` stayed Roblox's default black. ## 0.13.0 Added variants you define yourself, responsive ranges, configurable breakpoints, presets, per-corner radius, and transitions that reach the helper instances. **State variants.** `addVariant("open", { attribute: "State", equals: "open" })` registers an `open:` prefix that reads a Roblox attribute off the styled instance. `attr-[State=open]:` reads one inline. Both compose with every other variant. Only the condition travels to the runtime, so `open:rounded-lg` lowers `rounded-lg` exactly as a bare `rounded-lg` does. See [Responsive and input variants](https://docs.astra-void.xyz/vela-rbxts/guides/responsive-and-input-variants.md). **Responsive ranges.** `max-md:` is the exact complement of `md:`, minimum inclusive and maximum exclusive, so the two cover every viewport once. They also chain: `md:max-lg:` addresses one bucket. **Configurable breakpoints.** `theme.screens` is a theme axis like `colors`, so `tablet:` and `max-tablet:` are two lines of config. The default scale gains `xl` (1280) and `2xl` (1536). **Presets.** `presets: [gameUiPreset()]` folds a design system's theme, plugins, utilities and variants into a project in one line. They resolve after the defaults and before the config naming them, so a project always outranks what it pulled in. A JSON config can inline a preset but cannot import one. See [presets](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#presets). **Per-corner radius.** `rounded-l-lg`, `rounded-t-md` and `rounded-tr-[0.625rem]` write the individual `UICorner` properties. They **square off the corners they do not name**, so `rounded-r-lg` alone keeps the left side flat. A directional utility beats the all-corner shorthand on the corners it names, in either order. **Transitions reach the helper instances.** `hover:rounded-xl` and `hover:border-blue-500` used to snap, since a radius and a stroke live on `UICorner` and `UIStroke` rather than on the element. They tween now, and `transition-shadow` joins the property groups. A custom motion driver receives those tweens with a fourth argument naming the helper. It is additive, so a three-argument driver keeps working. **Optional inlay hints.** The editor can show what each class lowers to after the class. Off by default, behind `velaRbxts.inlayHints.enabled`. **A `vela.config.ts` is executed once per build**, resolved per directory and re-read only when it changes. A config that throws is cached alongside one that resolves, so a typo is reported once and the next edit lifts it. **Three new prefix diagnostics.** `unknown-breakpoint` fires on a `max-` in front of something that is not a breakpoint. `malformed-attribute-variant` fires on an `attr-[…]` that does not parse. `invalid-breakpoint-range` fires on a chain whose bounds leave no viewport. Sorting ranks the new variants in bands of their own. The existing variants keep the order they had. ## 0.12.8 **The published editor extension carried no config loader**, so a project's `vela.config.ts` was never read and every key it defined was checked against the default theme. Upgrade if the editor reports your own theme keys as unknown. ## 0.12.7 **`justify-stretch`**, which sets `UIListLayout.HorizontalFlex` to `Enum.UIFlexAlignment.Fill`. `items-stretch` reached `VerticalFlex` from the start, but nothing reached the horizontal axis. A column that wanted its children to fill the width had no class for it. **A config the editor cannot read is now a notification** naming the file and the reason, rather than a line in an output channel nobody opens. ## 0.12.6 Three fixes, all a walk that stopped at a boundary too early. The `SurfaceGui` pin and an `opacity-*` fade now carry through a **fragment, a wrapper or a provider** rather than turning around at one. A component exported without a name, as `export default (props) => …`, is read as a component root like the named form beside it. ## 0.12.5 **A `SurfaceGui` keeps its literal pixels.** It takes its pixel space from the part it is drawn on rather than from the viewport. A `BillboardGui` sizes itself the same way, so following the rem curve there was wrong. Both are pinned now, on the static and runtime paths alike. `theme.rem.pinnedUnder` names them, and emptying it puts them back on the curve. A container the compiler never sees is outside what this reaches. Pin such a project with `theme.rem: { min: 16, max: 16 }`. ## 0.12.4 **A margin side is one signed slot, so the last class written to it lands.** Padding and a negative shift used to accumulate separately. Neither could overwrite the other. `-ml-2 -ml-2` shifted by 16 rather than 8, and `ml-4 -ml-2` applied both a padding *and* a shift. A side that ends up negative moves the element. One that ends up positive pads it. `-mr-*` and `-mb-*` still report `unsupported-negative-margin`. **Sorting leaves the whitespace where its author put it**, so a class list written across several lines is no longer flattened on every save. Two smaller fixes. `placeholder-transparent` is no longer offered by completion, since Roblox has no placeholder transparency to lower to. The language server exits on the `exit` notification instead of waiting for the pipe to close. ## 0.12.3 A patch, mostly in the editor — but two of these move the compiler as well. **A class an interpolation splices into is left alone.** `` `w-[${width}]` `` reaches the editor as two pieces. Both were analyzed as whole classes, warning about a class you did not write. **Whitespace inside an arbitrary value no longer splits it.** `w-[calc(100% - 4px)]` was read as three classes and collected a diagnostic each. It reports the one it is owed now. The runtime splits its class strings under the same rule, so a static class and a deferred one tokenize alike. Four editor fixes behind them. A config pushed by the editor never arrived, so your theme keys stayed unknown for the session. A file opening with a BOM answered one character to the left. Completing inside a variant chain deleted the utility behind it. Sorting a value whose bracket never closes rewrote it. ## 0.12.2 A patch, entirely in the editor — the compiler emits byte for byte what 0.12.0 did. **The editor understands a class value written as a function.** `className={() => "bg-blue-600"}` is how a Vide project writes a dynamic one. The walk had no arm for a function at all, so completions, hover, diagnostics, swatches and sorting saw nothing in it. It follows what a function returns now, along with template interpolations, `as const`, `satisfies`, string concatenation, and an object's computed keys and spreads. Two interpolation bugs went with it. A half-typed file no longer reports `${flag` as an unknown utility, and the sort keeps the whitespace either side of an interpolation. ## 0.12.1 The one to be on if you write Vide. **A Vide project that never named `framework` compiled against the React host**, emitting an import of `@rbxts/vela-runtime` it has no reason to have installed. The tsconfig inference only ran for a project with no `vela.config.ts` at all. A Vide project whose config set a theme or a plugin silently lost it. ## 0.12.0 The largest release since 0.7.0. Offsets became rem units. The runtime became a package instead of a copy. Branches started resolving at compile time, and Vela learned to emit for a second UI library. > **Two of these change what you already have** > > **Rendering moves on any viewport but the base one**, because every pixel offset now scales. And > **`className={a ? "x" : "y"}` now reports diagnostics it used to swallow**, so an upgrade can surface > warnings on code that was already wrong. Neither needs a code change. Nothing about install changes. **Every pixel offset a utility lowers is a rem unit.** `p-4`, `w-40`, `rounded-lg` and `text-sm` are measured against the viewport. One rem is 16px at 1920×1020 and scales from there, with no provider, hook or wrapper involved. Scale-valued utilities are untouched: `w-full` and `translate-x-1/2` stay fractions of the parent. `TextSize` gains a ceiling of 100, where Roblox stops honouring it. To keep literal pixels, close the clamp with `theme: { rem: { min: 16, max: 16 } }`. The compiler then drops the scaling from the emit entirely. See [rem](https://docs.astra-void.xyz/vela-rbxts/guides/theming.md#rem). **The runtime ships as `@rbxts/vela-runtime` instead of being copied into every file.** Ten components used to carry ten copies of the same 5,500 lines. Each copy had its own camera subscription. It is now one ModuleScript the whole place shares. In the reference app `App.luau` went from 190,260 bytes to 27,912. Setup is unchanged — the package installs with `vela-rbxts` and sits under the `@rbxts` scope every roblox-ts project already lists. **The emit sends the theme you changed, not the whole palette.** A module whose host never has to *parse* a class value sends its scales emptied entirely. **A branch's classes are resolved at compile time.** `active ? "text-lg" : "text-sm"` names every token it can apply. The compiler resolves all of them and hands the element the resolved props alongside the tests that decide them. The full utility set applies inside a branch. A bad utility in one reports a diagnostic instead of vanishing, and each test is evaluated once however many branches hang on it. It reads ternaries, `&&`, the literal behind `||`, arrays and object maps. A branch naming `m-*`, `divide-*`, `animate-*`, `transition*`, a text transform or `opacity-*` still takes the whole value down the runtime path. See [dynamic class names](https://docs.astra-void.xyz/vela-rbxts/guides/dynamic-class-names.md#a-branch-lowers-at-compile-time). **`/N` opacity modifiers lower on every family with a transparency channel.** `border-slate-500/25`, `divide-white/10` and the gradient stops previously lost exactly the alpha they were written for. `placeholder-*` is the one family left, and its message now says why. **Vela emits for [Vide](https://centau.github.io/vide/).** One config key, `framework: "vide"`, or nothing at all — it is inferred from a `jsxFactory` beginning with `Vide.`. A statically lowered element is identical under both targets. What differs is the runtime package the emit imports, and that a dynamic class value is written as a thunk. Two limits are inherent. A component element's prop names are fixed when it is called, and a `m-*` arriving out of an opaque call is warned rather than rendered. See [the Vide guide](https://docs.astra-void.xyz/vela-rbxts/guides/vide.md). Smaller things. Hovers and completions read offsets in rem, and arbitrary values read a `rem` unit. A base helper a variant rule overwrote no longer leaves two `UIPadding` under one instance. The rule prop parser learned `Vector2`, `ColorSequence`, `NumberSequence` and `Font`. ## 0.11.1 A patch. The runtime failed to typecheck in a project that sets `noUncheckedIndexedAccess`. That matters because a `className` carrying a state variant pulls it into the emit, where **your** compiler options check it. ## 0.11.0 The first release that does not change how a single class lowers. It makes the transformer optional. **There is a `vela` command now**, for any project that cannot register a roblox-ts transform plugin. A pinned toolchain, a build system that drives `tsc` itself, or a CI step that wants the lowered sources as a reviewable artifact. `vela build` mirrors `src` into `.vela/src`, transforming the files that use `className` and copying everything else byte for byte. `vela watch` re-transforms on change. Both paths call the same compiler, so the output does not depend on which you pick. An identical output is never rewritten, and pruning reads a manifest of what an earlier run emitted, so a file the CLI never wrote is never deleted. See [the CLI reference](https://docs.astra-void.xyz/vela-rbxts/reference/cli.md). **A whole-tree build stops re-evaluating `vela.config.ts` once per file.** Upgrading from 0.10.0 cannot change your output. ## 0.10.0 Finishes the `opacity-*` work 0.9.0 started, and stops the inlined runtime from crowding Luau's local register limit. **`opacity-*` crosses a component boundary, in both directions.** 0.9.0 faded a subtree by walking the JSX, and that walk ends where the JSX does. A fade written *around* a component reached nothing it rendered, and one written *on* a component stopped at `BackgroundTransparency`. The alpha now travels as React context, through a provider that renders no instance, so the tree keeps its shape and names. Providers are *relative*: two nested fades compose rather than the inner one winning. **A class value that settles at render time is left whole to the runtime.** An `opacity-*` written inside a recipe reaches the subtree it is written over. **`opacity-unreachable-child` is gone.** One difference between the paths remains. The static path leaves a transparency *you* declared as a prop alone, while a fade arriving as context composes over both. **A configured motion driver no longer takes the tree down at mount.** A driver written the documented way compiles to a method carrying an implicit `self`. The runtime called it detached, shifting every argument one place left. Methods are called as methods now, and the driver type states them as methods. The arrow form is a compile error rather than a tree that disappears. See [the motion driver](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#motion-driver). **The inlined runtime is grouped into namespaces**, taking the busiest register file in an emitted file from 177 to 65 against Luau's cap of 200. Both the harness and the compiler crate assert a budget of 120, so crowding the limit again fails a test rather than your build. ## 0.9.0 **`opacity-*` fades everything the element draws** — every channel the host paints, not just `BackgroundTransparency`, which was invisible on a label whose background was already transparent. **And into the subtree written under it.** Roblox has no inherited transparency, so the transformer walks the JSX. Every instance below the class is handed the running product `1 - (1 - own) * alpha`. Children written inside an expression count. A `canvasgroup` on the way down ends the walk. Where this parts ways with a real composite is overlapping siblings: each is faded rather than the group, so the overlap darkens. **`opacity-*` stopped being order-dependent.** It is held until the whole class list is read, then composed over whatever alpha the colours settled on. `opacity-50 bg-slate-700` and `bg-slate-700 opacity-50` are the same thing. **The inlined runtime stopped costing every file 96 registers.** It had been failing whole components with `Out of local registers … exceeded limit 200`. That was against code nobody wrote. If you are on 0.9.x and see `opacity-unreachable-child`, it is telling the truth — `{props.children}` and component children stayed out of the compile-time walk. 0.10.0 carries the alpha across both. ## 0.8.0 **Every utility family resolves on the runtime class path.** The runtime host had implemented roughly a third of what the static path lowers. A component whose `className` arrived as a *value*, the normal shape for a variant recipe, silently lost most of the rest. Positioning, box constraints, the grid, gradients, rings, shadows, `z-*`, transforms, `opacity-*`, the ScrollingFrame family and most of the text families. All of them resolve dynamically now, with the static path's semantics. This is the release where [dynamic class names](https://docs.astra-void.xyz/vela-rbxts/guides/dynamic-class-names.md) stopped being a reduced dialect. **A utility the host element cannot carry is dropped at runtime rather than applied**, since writing `TextColor3` onto a `Frame` is a hard Roblox error. The static path still writes it — see [still open](#still-open). **The runtime host names `UIShadow` by its real class.** The lowercase spelling failed to instantiate and unwound the whole tree. Fixed on the runtime path only. ## 0.7.0 The release that drew most of the current configuration surface. - **Plugins.** `addUtilities` registers class names of your own, as a list of existing utilities or as Roblox properties written directly, and `theme()` reads the resolved theme. Registered utilities take variants, resolve on both paths, and sort *ahead* of the plain utilities. See [`plugins`](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#plugins). - **A motion driver seam.** `setMotionDriver` names a module whose `transition`/`animate` methods replace TweenService, one method at a time. - **`dark:`, `active:` and `focus:` variants.** `dark:` reads a `VelaColorScheme` attribute off the local player, since Roblox exposes no color scheme to a running game. - **`theme.fontFamily` and `font-{family}`**, shipping `sans`, `serif` and `mono` and taking any Roblox font family asset. - **Scrolling frame utilities**, arbitrary length values (`[16px]`, `[50%]` and their negatives), and real property filters on `transition-colors`/`-opacity`/`-transform`. - **Class sorting**, exposed as the `source.sortVelaClasses` source action. See [editor setup](https://docs.astra-void.xyz/vela-rbxts/guides/editor-setup.md#sorting-class-names). ## 0.6.0 > **Breaking-ish: grid cells are sized now** > > `UIGridLayout` stamps `CellSize` onto every child, and Vela's grid utilities never set it. Every cell fell back to Roblox's 100×100 default, so a `grid-cols-2` of 430px cards collapsed to 100px squares. `grid-cols-N` now divides the axis into N tracks and hands each cell its share of the gap. > > The cross axis needs its own answer, so **`auto-rows-*` and `auto-cols-*`** set it from the spacing > scale. Without one it stays at 100px, so existing grids keep their row extent and gain correct track > widths — anything compensating for 100px cells needs re-checking. **`text-{color}` resolves on the runtime path.** The resolver had no `text-` branch at all. Every text colour in a dynamic class value was dropped without a diagnostic. **`w-*` and `h-*` stop erasing each other in variant rules**, carrying the 0.5.2 fix into `md:w-32 md:h-32`. ## 0.5.2 **`w-*` and `h-*` stop erasing each other on the runtime path.** `Size` holds both axes. A runtime rule naming one used to state a whole `UDim2` and zero the other. Worth re-reading if you worked around this: the axis that lost was left at zero, which also made a scale-based `rounded-full` compute to nothing. ## 0.5.1 A version-only release — no compiler change. ## 0.5.0 > **Breaking: preflight neutralizes the Roblox host defaults** > > Roblox paints every `GuiObject` as an opaque gray box with a 1px border, and a framework that only > ever *adds* properties can never take that back. > > A supported host element **that carries a `className`** now starts from `BackgroundTransparency = 1` > and `BorderSizePixel = 0`. Anything that actually paints opts back out: a `bg-*` utility, > `opacity-*`, a gradient stop, or a transparency you declared as a prop. A background painted by a > variant reopens it at runtime. An element with no `className` is untouched, and so is a > **component**. > > **Anywhere the gray default was load-bearing, the element now renders invisible.** Add the `bg-*` it > relied on, or set [`preflight: false`](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#preflight). **`order-*` works under `flex`.** Vela's `UIListLayout` did not set `SortOrder`, and the engine default is `Name`, so children sorted alphabetically and every `order-*` was a silent no-op. If you still see `order-*` ignored, the layout instance is one you wrote yourself. ## 0.4.2 **A WebAssembly build of the compiler**, `@vela-rbxts/compiler-wasm`, so lowering can run in a browser. The [playground](https://docs.astra-void.xyz/vela-playground/) compiles with it. **Transitions tween from the right starting value**, instead of jumping to the target the first time a variant introduced the prop. **A base opacity modifier no longer leaks into a variant**, and refs on runtime-path elements are typed from the tag rather than as `Ref<unknown>`. ## 0.4.1 > **Breakpoints did not work in 0.4.0** > > The `0.4.0` runtime helper read `Camera.ViewportSize` **once, at mount**, and Roblox often still reports a 1×1 viewport then. **`sm:`, `md:` and `lg:` never matched, and orientation was always landscape.** `0.4.1` follows the camera's signal, which fixes the initial evaluation and makes > breakpoints react to resizes. The input variants and `hover:` were never affected. **`divide-*` drew one separator too many** whenever the element carried a utility that lowers a helper instance. Config errors name the key that failed, and `tsx-parse-failed` carries a real source range. Malformed `configJson` is an error rather than a silent fallback to the default theme. ## 0.4.0 Where `hover:`, arbitrary hex colors and `/N` opacity modifiers arrived. Breakpoints and orientation are broken in this release, as described above. If you are pinned to it, drive reflow from your own state. See [Responsive and input variants](https://docs.astra-void.xyz/vela-rbxts/guides/responsive-and-input-variants.md#driving-reflow-yourself). ## Earlier **0.3.0** landed most of the surface this documentation describes at once. Far-edge positioning, `content-*`/`self-*`, `order-*`, grid, `translate-*`, `space-x/y-*`, `ring`/`outline`, `leading-*`, the case transforms and decorations, the whole motion layer, and the structural utilities. **0.2.1** added `vela.config.json` and the palette `DEFAULT` key, and moved the declaration file to `src/vela-env.d.ts`. `src/vela-rbxts.d.ts` collides with the package name under a `baseUrl` of `src`, so the augmentation silently never loaded. **0.2.0** was the first public release. ## Still open Known and unfixed as of 0.14.0. **A plugin utility that reaches back into itself expands to nothing** — the depth cap terminates silently, with no diagnostic. **`divide-transparent` is refused while `divide-white/10` resolves.** The `/N` modifier moved to every family with a transparency channel in 0.12.0. The `transparent` *keyword* did not. **The host guards are not symmetric.** The runtime path drops a utility the host element cannot carry. The static path writes it anyway, and only the editor warns `unsupported-host-utility`. Roblox then rejects the assignment far from the class list that caused it. **Overlapping siblings under one `opacity-*` darken where they overlap.** Each is faded on its own. `isolate` on a parent frame composites the subtree as one layer, at a CanvasGroup's cost. **Under Vide, a `m-*` the compiler cannot see is warned rather than rendered**, because a margin box is an instance above one Vide has already parented. **A theme value that is not a valid expression fails silently, three ways.** Vela splices in the first expression that parses and drops the rest. A trailing comment is lost, `"#3b82f6"` becomes a type error, and `"#a1b2c3"` parses as a TypeScript private name and emits bare. See the [theming guide](https://docs.astra-void.xyz/vela-rbxts/guides/theming.md#values-are-source-code-not-values). A [`vela.css`](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#velacss) token avoids this: it is a CSS value, converted for you. **TypeScript 7 is not supported.** 7.x fails the host adapter's call with `compiler-invocation-failed: Cannot read properties of undefined (reading 'Latest')` on the first file. Pin `typescript@5.9.3` or `6.x`. Nothing declares this as a peer range, so the install is clean and the build is not. ## Platform coverage Prebuilt binaries do not cover every target: there is no `aarch64-pc-windows-msvc` build, so **Windows on ARM is unsupported**, and no linux arm64 musl build either. On those two, build the compiler crate and the language server from source. Full target list in the [API reference](https://docs.astra-void.xyz/vela-rbxts/reference/api.md#prebuilt-compiler-binaries). ## See also - [Scope and status](https://docs.astra-void.xyz/vela-rbxts/getting-started/scope-and-status.md) — what is in and out at 0.14.0. - [Configuration](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#preflight) — the `preflight` opt-out, and [`plugins`](https://docs.astra-void.xyz/vela-rbxts/reference/config.md#plugins). - [Troubleshooting](https://docs.astra-void.xyz/vela-rbxts/guides/troubleshooting.md) — symptom-first.