Text classes work on the three Roblox text elements: textlabel, textbutton and textbox.
<textlabel className="text-2xl font-semibold text-slate-100 text-center align-middle" Text="Match found"/>import React from "@rbxts/react";
export function TextSamples() { return ( <frame className="flex flex-col gap-2 w-80 h-32 p-4 rounded-lg bg-slate-900"> <textlabel className="w-full h-7 text-left text-slate-100 text-2xl font-bold" Text="Match found" /> <textlabel className="w-full h-5 text-left text-slate-300 text-base font-medium" Text="Ranked · Duo queue" /> <textlabel className="w-full h-4 text-right text-slate-500 text-sm" Text="starting in 5s" /> </frame> );}import { __VelaBoundary } from "@rbxts/vela-runtime";import React from "@rbxts/react";export function TextSamples() { return <__VelaBoundary.Consume>{(<frame BackgroundColor3={Color3.fromRGB(15, 23, 43)} Size={UDim2.fromOffset(320, 128)} BorderSizePixel={0}><uilistlayout FillDirection={Enum.FillDirection.Vertical} Padding={new UDim(0, 8)} SortOrder={Enum.SortOrder.LayoutOrder}/><uipadding PaddingTop={new UDim(0, 16)} PaddingRight={new UDim(0, 16)} PaddingBottom={new UDim(0, 16)} PaddingLeft={new UDim(0, 16)}/><uicorner CornerRadius={new UDim(0, 8)}/> <textlabel Text="Match found" TextXAlignment={Enum.TextXAlignment.Left} TextColor3={Color3.fromRGB(241, 245, 249)} TextSize={24} Size={new UDim2(1, 0, 0, 28)} FontFace={new Font("rbxasset://fonts/families/SourceSansPro.json", Enum.FontWeight.Bold)} BorderSizePixel={0} BackgroundTransparency={1}/> <textlabel Text="Ranked · Duo queue" TextXAlignment={Enum.TextXAlignment.Left} TextColor3={Color3.fromRGB(202, 213, 226)} TextSize={16} Size={new UDim2(1, 0, 0, 20)} FontFace={new Font("rbxasset://fonts/families/SourceSansPro.json", Enum.FontWeight.Medium)} BorderSizePixel={0} BackgroundTransparency={1}/> <textlabel Text="starting in 5s" TextXAlignment={Enum.TextXAlignment.Right} TextColor3={Color3.fromRGB(98, 116, 142)} TextSize={14} Size={new UDim2(1, 0, 0, 16)} BorderSizePixel={0} BackgroundTransparency={1}/> </frame>)}</__VelaBoundary.Consume>;}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:
<frame className="text-red-500" /> 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 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:
<Title className="text-2xl font-semibold" Text="Match found" />This only works if Title passes the classes on to a text element. See
className on components.
How text-* is disambiguated
text-* can mean size, alignment, wrapping or color. Vela checks in this order:
- A size key (
xsthrough9xl) setsTextSize. left,center,rightorjustifysetsTextXAlignment.wrapornowrapsetsTextWrapped.- 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.
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:
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:
export default defineConfig({ theme: { extend: { fontFamily: { display: "rbxassetid://12345678", body: "rbxasset://fonts/families/Nunito.json", }, }, },});<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:
<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:
<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:
<textlabel className="uppercase" Text="match found" /><textlabel Text="MATCH FOUND" />If Text is a variable, the change happens in game instead. The element then uses the
runtime path.
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.
Typography families that cannot exist
These Tailwind classes have no Roblox equivalent. They report no-roblox-equivalent:
tracking-*(letter spacing).indent-*,break-*,hyphens-*andlist-*.decoration-*andoverline. RichText only has underline and strikethrough.
See also
- Colors and surfaces: the color half of
text-*, plustransparentand the shade rules. - Theming: where
text-{color}keys come from. - Editor setup: getting the host warnings the build doesn’t give you.
- Diagnostics: every code and what triggers it.