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.
Two habits repeat throughout:
- Give everything an explicit size. Roblox instances start at zero size, so most examples set
w-*andh-*. Backgrounds already start transparent (preflight), so you don’t needbg-transparent. - Rows and columns are
UIListLayout. An element withflex,gap-*,justify-*oritems-*gets oneUIListLayoutchild, which positions every child. See layout and sizing.
Buttons
import React from "@rbxts/react";
export function Buttons() { return ( <frame className="flex gap-3 justify-center items-center w-96 h-20 p-4 rounded-lg bg-slate-900"> <textbutton className="w-28 h-10 rounded-md bg-sky-500 text-white text-sm font-semibold" Text="Play" /> <textbutton className="w-28 h-10 rounded-md bg-slate-800 border border-slate-600 text-slate-100 text-sm" Text="Options" /> <textbutton className="w-28 h-10 rounded-md bg-rose-600 text-white text-sm font-semibold" Text="Leave" /> </frame> );}import { __VelaBoundary } from "@rbxts/vela-runtime";import React from "@rbxts/react";export function Buttons() { return <__VelaBoundary.Consume>{(<frame BackgroundColor3={Color3.fromRGB(15, 23, 43)} Size={UDim2.fromOffset(384, 80)} BorderSizePixel={0}><uilistlayout FillDirection={Enum.FillDirection.Horizontal} Padding={new UDim(0, 12)} HorizontalAlignment={Enum.HorizontalAlignment.Center} VerticalAlignment={Enum.VerticalAlignment.Center} 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)}/> <textbutton Text="Play" BackgroundColor3={Color3.fromRGB(0, 166, 244)} TextColor3={Color3.fromRGB(255, 255, 255)} TextSize={14} Size={UDim2.fromOffset(112, 40)} FontFace={new Font("rbxasset://fonts/families/SourceSansPro.json", Enum.FontWeight.SemiBold)} BorderSizePixel={0}><uicorner CornerRadius={new UDim(0, 6)}/></textbutton> <textbutton Text="Options" BackgroundColor3={Color3.fromRGB(29, 41, 61)} TextColor3={Color3.fromRGB(241, 245, 249)} TextSize={14} Size={UDim2.fromOffset(112, 40)} BorderSizePixel={0}><uicorner CornerRadius={new UDim(0, 6)}/><uistroke Thickness={1} Color={Color3.fromRGB(69, 85, 108)} Transparency={0}/></textbutton> <textbutton Text="Leave" BackgroundColor3={Color3.fromRGB(236, 0, 63)} TextColor3={Color3.fromRGB(255, 255, 255)} TextSize={14} Size={UDim2.fromOffset(112, 40)} FontFace={new Font("rbxasset://fonts/families/SourceSansPro.json", Enum.FontWeight.SemiBold)} BorderSizePixel={0}><uicorner CornerRadius={new UDim(0, 6)}/></textbutton> </frame>)}</__VelaBoundary.Consume>;}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:.
Add transition to tween the change:
<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. 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:
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
import React from "@rbxts/react";
export function Badges() { return ( <frame className="flex gap-2 justify-center items-center w-96 h-16 p-3 rounded-lg bg-slate-900"> <textlabel className="w-20 h-6 rounded-full bg-emerald-950 border border-emerald-800 text-emerald-400 text-xs" Text="Online" /> <textlabel className="w-20 h-6 rounded-full bg-amber-950 border border-amber-800 text-amber-400 text-xs" Text="In match" /> <textlabel className="w-20 h-6 rounded-full bg-slate-800 border border-slate-700 text-slate-400 text-xs" Text="Offline" /> <textlabel className="w-20 h-6 rounded-full bg-rose-950 border border-rose-800 text-rose-400 text-xs" Text="Banned" /> </frame> );}import { __VelaBoundary } from "@rbxts/vela-runtime";import React from "@rbxts/react";export function Badges() { return <__VelaBoundary.Consume>{(<frame BackgroundColor3={Color3.fromRGB(15, 23, 43)} Size={UDim2.fromOffset(384, 64)} BorderSizePixel={0}><uilistlayout FillDirection={Enum.FillDirection.Horizontal} Padding={new UDim(0, 8)} HorizontalAlignment={Enum.HorizontalAlignment.Center} VerticalAlignment={Enum.VerticalAlignment.Center} SortOrder={Enum.SortOrder.LayoutOrder}/><uipadding PaddingTop={new UDim(0, 12)} PaddingRight={new UDim(0, 12)} PaddingBottom={new UDim(0, 12)} PaddingLeft={new UDim(0, 12)}/><uicorner CornerRadius={new UDim(0, 8)}/> <textlabel Text="Online" BackgroundColor3={Color3.fromRGB(0, 44, 34)} TextColor3={Color3.fromRGB(0, 212, 146)} TextSize={12} Size={UDim2.fromOffset(80, 24)} BorderSizePixel={0}><uicorner CornerRadius={new UDim(0.5, 0)}/><uistroke Thickness={1} Color={Color3.fromRGB(0, 96, 69)} Transparency={0}/></textlabel> <textlabel Text="In match" BackgroundColor3={Color3.fromRGB(70, 25, 1)} TextColor3={Color3.fromRGB(255, 185, 0)} TextSize={12} Size={UDim2.fromOffset(80, 24)} BorderSizePixel={0}><uicorner CornerRadius={new UDim(0.5, 0)}/><uistroke Thickness={1} Color={Color3.fromRGB(151, 60, 0)} Transparency={0}/></textlabel> <textlabel Text="Offline" BackgroundColor3={Color3.fromRGB(29, 41, 61)} TextColor3={Color3.fromRGB(144, 161, 185)} TextSize={12} Size={UDim2.fromOffset(80, 24)} BorderSizePixel={0}><uicorner CornerRadius={new UDim(0.5, 0)}/><uistroke Thickness={1} Color={Color3.fromRGB(49, 65, 88)} Transparency={0}/></textlabel> <textlabel Text="Banned" BackgroundColor3={Color3.fromRGB(77, 2, 24)} TextColor3={Color3.fromRGB(255, 99, 126)} TextSize={12} Size={UDim2.fromOffset(80, 24)} BorderSizePixel={0}><uicorner CornerRadius={new UDim(0.5, 0)}/><uistroke Thickness={1} Color={Color3.fromRGB(165, 0, 54)} Transparency={0}/></textlabel> </frame>)}</__VelaBoundary.Consume>;}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
import React from "@rbxts/react";
export function StatBars() { return ( <frame className="flex flex-col gap-3 w-96 h-20 p-4 rounded-lg bg-slate-900"> <frame className="flex items-center gap-3 w-full h-4"> <textlabel className="w-10 h-4 text-left text-slate-400 text-xs font-semibold" Text="HP" /> <frame className="w-72 h-2 rounded-full bg-slate-800"> <frame className="w-2/3 h-full rounded-full bg-emerald-500" /> </frame> </frame>
<frame className="flex items-center gap-3 w-full h-4"> <textlabel className="w-10 h-4 text-left text-slate-400 text-xs font-semibold" Text="MP" /> <frame className="w-72 h-2 rounded-full bg-slate-800"> <frame className="w-1/4 h-full rounded-full bg-sky-500" /> </frame> </frame> </frame> );}import { __VelaBoundary } from "@rbxts/vela-runtime";import React from "@rbxts/react";export function StatBars() { return <__VelaBoundary.Consume>{(<frame BackgroundColor3={Color3.fromRGB(15, 23, 43)} Size={UDim2.fromOffset(384, 80)} BorderSizePixel={0}><uilistlayout FillDirection={Enum.FillDirection.Vertical} Padding={new UDim(0, 12)} 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)}/> <frame Size={new UDim2(1, 0, 0, 16)} BorderSizePixel={0} BackgroundTransparency={1}><uilistlayout FillDirection={Enum.FillDirection.Horizontal} VerticalAlignment={Enum.VerticalAlignment.Center} Padding={new UDim(0, 12)} SortOrder={Enum.SortOrder.LayoutOrder}/> <textlabel Text="HP" TextXAlignment={Enum.TextXAlignment.Left} TextColor3={Color3.fromRGB(144, 161, 185)} TextSize={12} Size={UDim2.fromOffset(40, 16)} FontFace={new Font("rbxasset://fonts/families/SourceSansPro.json", Enum.FontWeight.SemiBold)} BorderSizePixel={0} BackgroundTransparency={1}/> <frame BackgroundColor3={Color3.fromRGB(29, 41, 61)} Size={UDim2.fromOffset(288, 8)} BorderSizePixel={0}><uicorner CornerRadius={new UDim(0.5, 0)}/> <frame BackgroundColor3={Color3.fromRGB(0, 188, 125)} Size={UDim2.fromScale(0.6666666667, 1)} BorderSizePixel={0}><uicorner CornerRadius={new UDim(0.5, 0)}/></frame> </frame> </frame>
<frame Size={new UDim2(1, 0, 0, 16)} BorderSizePixel={0} BackgroundTransparency={1}><uilistlayout FillDirection={Enum.FillDirection.Horizontal} VerticalAlignment={Enum.VerticalAlignment.Center} Padding={new UDim(0, 12)} SortOrder={Enum.SortOrder.LayoutOrder}/> <textlabel Text="MP" TextXAlignment={Enum.TextXAlignment.Left} TextColor3={Color3.fromRGB(144, 161, 185)} TextSize={12} Size={UDim2.fromOffset(40, 16)} FontFace={new Font("rbxasset://fonts/families/SourceSansPro.json", Enum.FontWeight.SemiBold)} BorderSizePixel={0} BackgroundTransparency={1}/> <frame BackgroundColor3={Color3.fromRGB(29, 41, 61)} Size={UDim2.fromOffset(288, 8)} BorderSizePixel={0}><uicorner CornerRadius={new UDim(0.5, 0)}/> <frame BackgroundColor3={Color3.fromRGB(0, 166, 244)} Size={UDim2.fromScale(0.25, 1)} BorderSizePixel={0}><uicorner CornerRadius={new UDim(0.5, 0)}/></frame> </frame> </frame> </frame>)}</__VelaBoundary.Consume>;}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:
<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
import React from "@rbxts/react";
export function Leaderboard() { return ( <frame className="flex flex-col gap-2 w-96 h-37 p-3 rounded-lg bg-slate-900 border border-slate-800"> <frame className="flex items-center gap-3 w-full h-9 px-3 rounded-md bg-slate-800"> <textlabel className="w-5 h-5 text-amber-400 text-sm font-semibold" Text="1" /> <frame className="w-6 h-6 rounded-full bg-gradient-to-br from-sky-400 to-indigo-500" /> <textlabel className="w-48 h-5 text-left text-slate-100 text-sm" Text="astra" /> <textlabel className="w-16 h-5 text-right text-amber-400 text-sm font-semibold" Text="2,410" /> </frame>
<frame className="flex items-center gap-3 w-full h-9 px-3 rounded-md bg-slate-800"> <textlabel className="w-5 h-5 text-slate-500 text-sm font-semibold" Text="2" /> <frame className="w-6 h-6 rounded-full bg-gradient-to-br from-emerald-400 to-teal-500" /> <textlabel className="w-48 h-5 text-left text-slate-100 text-sm" Text="void_walker" /> <textlabel className="w-16 h-5 text-right text-slate-300 text-sm" Text="1,984" /> </frame>
<frame className="flex items-center gap-3 w-full h-9 px-3 rounded-md bg-slate-800"> <textlabel className="w-5 h-5 text-slate-500 text-sm font-semibold" Text="3" /> <frame className="w-6 h-6 rounded-full bg-gradient-to-br from-rose-400 to-orange-500" /> <textlabel className="w-48 h-5 text-left text-slate-100 text-sm" Text="bloom" /> <textlabel className="w-16 h-5 text-right text-slate-300 text-sm" Text="1,730" /> </frame> </frame> );}import { __VelaBoundary } from "@rbxts/vela-runtime";import React from "@rbxts/react";export function Leaderboard() { return <__VelaBoundary.Consume>{(<frame BackgroundColor3={Color3.fromRGB(15, 23, 43)} Size={UDim2.fromOffset(384, 148)} BorderSizePixel={0}><uilistlayout FillDirection={Enum.FillDirection.Vertical} Padding={new UDim(0, 8)} SortOrder={Enum.SortOrder.LayoutOrder}/><uipadding PaddingTop={new UDim(0, 12)} PaddingRight={new UDim(0, 12)} PaddingBottom={new UDim(0, 12)} PaddingLeft={new UDim(0, 12)}/><uicorner CornerRadius={new UDim(0, 8)}/><uistroke Thickness={1} Color={Color3.fromRGB(29, 41, 61)} Transparency={0}/> <frame BackgroundColor3={Color3.fromRGB(29, 41, 61)} Size={new UDim2(1, 0, 0, 36)} BorderSizePixel={0}><uilistlayout FillDirection={Enum.FillDirection.Horizontal} VerticalAlignment={Enum.VerticalAlignment.Center} Padding={new UDim(0, 12)} SortOrder={Enum.SortOrder.LayoutOrder}/><uipadding PaddingLeft={new UDim(0, 12)} PaddingRight={new UDim(0, 12)}/><uicorner CornerRadius={new UDim(0, 6)}/> <textlabel Text="1" TextColor3={Color3.fromRGB(255, 185, 0)} TextSize={14} Size={UDim2.fromOffset(20, 20)} FontFace={new Font("rbxasset://fonts/families/SourceSansPro.json", Enum.FontWeight.SemiBold)} BorderSizePixel={0} BackgroundTransparency={1}/> <frame Size={UDim2.fromOffset(24, 24)} BackgroundColor3={Color3.fromRGB(255, 255, 255)} BorderSizePixel={0}><uicorner CornerRadius={new UDim(0.5, 0)}/><uigradient Color={new ColorSequence(Color3.fromRGB(0, 188, 255), Color3.fromRGB(97, 95, 255))} Rotation={45}/></frame> <textlabel Text="astra" TextXAlignment={Enum.TextXAlignment.Left} TextColor3={Color3.fromRGB(241, 245, 249)} TextSize={14} Size={UDim2.fromOffset(192, 20)} BorderSizePixel={0} BackgroundTransparency={1}/> <textlabel Text="2,410" TextXAlignment={Enum.TextXAlignment.Right} TextColor3={Color3.fromRGB(255, 185, 0)} TextSize={14} Size={UDim2.fromOffset(64, 20)} FontFace={new Font("rbxasset://fonts/families/SourceSansPro.json", Enum.FontWeight.SemiBold)} BorderSizePixel={0} BackgroundTransparency={1}/> </frame>
<frame BackgroundColor3={Color3.fromRGB(29, 41, 61)} Size={new UDim2(1, 0, 0, 36)} BorderSizePixel={0}><uilistlayout FillDirection={Enum.FillDirection.Horizontal} VerticalAlignment={Enum.VerticalAlignment.Center} Padding={new UDim(0, 12)} SortOrder={Enum.SortOrder.LayoutOrder}/><uipadding PaddingLeft={new UDim(0, 12)} PaddingRight={new UDim(0, 12)}/><uicorner CornerRadius={new UDim(0, 6)}/> <textlabel Text="2" TextColor3={Color3.fromRGB(98, 116, 142)} TextSize={14} Size={UDim2.fromOffset(20, 20)} FontFace={new Font("rbxasset://fonts/families/SourceSansPro.json", Enum.FontWeight.SemiBold)} BorderSizePixel={0} BackgroundTransparency={1}/> <frame Size={UDim2.fromOffset(24, 24)} BackgroundColor3={Color3.fromRGB(255, 255, 255)} BorderSizePixel={0}><uicorner CornerRadius={new UDim(0.5, 0)}/><uigradient Color={new ColorSequence(Color3.fromRGB(0, 212, 146), Color3.fromRGB(0, 187, 167))} Rotation={45}/></frame> <textlabel Text="void_walker" TextXAlignment={Enum.TextXAlignment.Left} TextColor3={Color3.fromRGB(241, 245, 249)} TextSize={14} Size={UDim2.fromOffset(192, 20)} BorderSizePixel={0} BackgroundTransparency={1}/> <textlabel Text="1,984" TextXAlignment={Enum.TextXAlignment.Right} TextColor3={Color3.fromRGB(202, 213, 226)} TextSize={14} Size={UDim2.fromOffset(64, 20)} BorderSizePixel={0} BackgroundTransparency={1}/> </frame>
<frame BackgroundColor3={Color3.fromRGB(29, 41, 61)} Size={new UDim2(1, 0, 0, 36)} BorderSizePixel={0}><uilistlayout FillDirection={Enum.FillDirection.Horizontal} VerticalAlignment={Enum.VerticalAlignment.Center} Padding={new UDim(0, 12)} SortOrder={Enum.SortOrder.LayoutOrder}/><uipadding PaddingLeft={new UDim(0, 12)} PaddingRight={new UDim(0, 12)}/><uicorner CornerRadius={new UDim(0, 6)}/> <textlabel Text="3" TextColor3={Color3.fromRGB(98, 116, 142)} TextSize={14} Size={UDim2.fromOffset(20, 20)} FontFace={new Font("rbxasset://fonts/families/SourceSansPro.json", Enum.FontWeight.SemiBold)} BorderSizePixel={0} BackgroundTransparency={1}/> <frame Size={UDim2.fromOffset(24, 24)} BackgroundColor3={Color3.fromRGB(255, 255, 255)} BorderSizePixel={0}><uicorner CornerRadius={new UDim(0.5, 0)}/><uigradient Color={new ColorSequence(Color3.fromRGB(255, 99, 126), Color3.fromRGB(255, 105, 0))} Rotation={45}/></frame> <textlabel Text="bloom" TextXAlignment={Enum.TextXAlignment.Left} TextColor3={Color3.fromRGB(241, 245, 249)} TextSize={14} Size={UDim2.fromOffset(192, 20)} BorderSizePixel={0} BackgroundTransparency={1}/> <textlabel Text="1,730" TextXAlignment={Enum.TextXAlignment.Right} TextColor3={Color3.fromRGB(202, 213, 226)} TextSize={14} Size={UDim2.fromOffset(64, 20)} BorderSizePixel={0} BackgroundTransparency={1}/> </frame> </frame>)}</__VelaBoundary.Consume>;}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:
{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
import React from "@rbxts/react";
export function LeaveDialog() { return ( <frame className="flex flex-col gap-3 w-96 h-40 p-4 rounded-xl bg-slate-900 border border-slate-700"> <textlabel className="w-full h-6 text-left text-slate-100 text-lg font-semibold" Text="Leave match?" /> <textlabel className="w-full h-10 text-left text-slate-400 text-sm text-wrap" Text="You will lose your streak bonus and any unclaimed round rewards." /> <frame className="flex justify-end items-center gap-2 w-full h-9"> <textbutton className="w-24 h-9 rounded-md bg-slate-800 border border-slate-700 text-slate-200 text-sm" Text="Cancel" /> <textbutton className="w-24 h-9 rounded-md bg-rose-600 text-white text-sm font-semibold" Text="Leave" /> </frame> </frame> );}import { __VelaBoundary } from "@rbxts/vela-runtime";import React from "@rbxts/react";export function LeaveDialog() { return <__VelaBoundary.Consume>{(<frame BackgroundColor3={Color3.fromRGB(15, 23, 43)} Size={UDim2.fromOffset(384, 160)} BorderSizePixel={0}><uilistlayout FillDirection={Enum.FillDirection.Vertical} Padding={new UDim(0, 12)} 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, 12)}/><uistroke Thickness={1} Color={Color3.fromRGB(49, 65, 88)} Transparency={0}/> <textlabel Text="Leave match?" TextXAlignment={Enum.TextXAlignment.Left} TextColor3={Color3.fromRGB(241, 245, 249)} TextSize={18} Size={new UDim2(1, 0, 0, 24)} FontFace={new Font("rbxasset://fonts/families/SourceSansPro.json", Enum.FontWeight.SemiBold)} BorderSizePixel={0} BackgroundTransparency={1}/> <textlabel Text="You will lose your streak bonus and any unclaimed round rewards." TextXAlignment={Enum.TextXAlignment.Left} TextColor3={Color3.fromRGB(144, 161, 185)} TextSize={14} TextWrapped={true} Size={new UDim2(1, 0, 0, 40)} BorderSizePixel={0} BackgroundTransparency={1}/> <frame Size={new UDim2(1, 0, 0, 36)} BorderSizePixel={0} BackgroundTransparency={1}><uilistlayout FillDirection={Enum.FillDirection.Horizontal} HorizontalAlignment={Enum.HorizontalAlignment.Right} VerticalAlignment={Enum.VerticalAlignment.Center} Padding={new UDim(0, 8)} SortOrder={Enum.SortOrder.LayoutOrder}/> <textbutton Text="Cancel" BackgroundColor3={Color3.fromRGB(29, 41, 61)} TextColor3={Color3.fromRGB(226, 232, 240)} TextSize={14} Size={UDim2.fromOffset(96, 36)} BorderSizePixel={0}><uicorner CornerRadius={new UDim(0, 6)}/><uistroke Thickness={1} Color={Color3.fromRGB(49, 65, 88)} Transparency={0}/></textbutton> <textbutton Text="Leave" BackgroundColor3={Color3.fromRGB(236, 0, 63)} TextColor3={Color3.fromRGB(255, 255, 255)} TextSize={14} Size={UDim2.fromOffset(96, 36)} FontFace={new Font("rbxasset://fonts/families/SourceSansPro.json", Enum.FontWeight.SemiBold)} BorderSizePixel={0}><uicorner CornerRadius={new UDim(0, 6)}/></textbutton> </frame> </frame>)}</__VelaBoundary.Consume>;}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:
<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/60fades only the scrim’s background.opacity-60would fade the card too, because it applies to everything inside the element.origin-centersetsAnchorPointto(0.5, 0.5), soleft-1/2 top-1/2centers the card.z-50raisesZIndexabove 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:orfocus:, ideally withtransition.
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, or the short version in the
five rules.
See also
- Your first component: the same walkthrough, one utility at a time.
- Layout and sizing: the layout model these recipes use.
- Troubleshooting: when a recipe doesn’t look like its preview.