@lattice-ui/radio-group Part of the stable direction toward v1.0.
What It Is For
Use RadioGroup for mutually exclusive selection when the available options should remain visible all at once.
It is best for small, stable option sets where direct comparison matters more than compactness.
import { RadioGroup } from "@lattice-ui/radio-group";
import React from "@rbxts/react";
const OPTIONS = [
{ value: "file", disabled: false },
{ value: "edit", disabled: true },
{ value: "view", disabled: false },
] as const;
export function RadioGroupExample() {
const [value, setValue] = React.useState("file");
return (
<frame BackgroundTransparency={1} Size={UDim2.fromOffset(360, 200)}>
<RadioGroup.Root onValueChange={setValue} value={value}>
<frame BackgroundTransparency={1} Size={UDim2.fromOffset(320, 126)}>
<uilistlayout
FillDirection={Enum.FillDirection.Vertical}
Padding={new UDim(0, 6)}
/>
{OPTIONS.map((option) => (
<RadioGroup.Item
asChild
disabled={option.disabled}
key={option.value}
value={option.value}
>
<textbutton
Active={!option.disabled}
AutoButtonColor={false}
BackgroundColor3={
value === option.value
? Color3.fromRGB(53, 104, 196)
: Color3.fromRGB(34, 41, 54)
}
BorderSizePixel={0}
Selectable={!option.disabled}
Size={UDim2.fromOffset(220, 34)}
Text={
option.disabled ? `${option.value} (disabled)` : option.value
}
TextColor3={
option.disabled
? Color3.fromRGB(140, 148, 162)
: Color3.fromRGB(236, 240, 248)
}
TextSize={14}
TextXAlignment={Enum.TextXAlignment.Left}
>
<uicorner CornerRadius={new UDim(0, 8)} />
<uipadding PaddingLeft={new UDim(0, 10)} />
</textbutton>
</RadioGroup.Item>
))}
</frame>
</RadioGroup.Root>
<textlabel
BackgroundTransparency={1}
Position={UDim2.fromOffset(0, 138)}
Size={UDim2.fromOffset(320, 20)}
Text={`Selected: ${value}`}
TextColor3={Color3.fromRGB(172, 181, 196)}
TextSize={13}
TextXAlignment={Enum.TextXAlignment.Left}
/>
</frame>
);
} Live demo is experimental and may contain bugs.
Install
Global CLI command: lattice add radio-group
Monorepo local script
Use your package manager wrapper when running the local lattice command.
pnpm lattice add radio-groupPublic Exports
-
RadioGroup -
RadioGroup.Root -
RadioGroup.Item -
RadioGroup.Indicator -
RadioGroupIndicator -
RadioGroupItem -
RadioGroupRoot
State Model
RadioGroup.Rootmanages a single selectedvalue, optionalrequiredsemantics, andhorizontalorverticalorientation.- Items register in order so keyboard-style movement can advance through enabled choices.
- Each item gets local
checkedanddisabledstate through context.
Key API
RadioGroup.Root
Use value, defaultValue, onValueChange, orientation, disabled, and required to define group semantics.
RadioGroup.Item
Each item needs a unique value; disabled removes it from selection without changing the rest of the group.
RadioGroup.Indicator
Use forceMount if your indicator visuals need to stay mounted across state transitions.
Composition Patterns
Settings mode selection
Use radios when the user should compare 2-5 modes directly without opening a list.
Inline option matrices
Combine group orientation and custom item visuals to produce pill, tile, or row-style selectors.
Cautions / Limits
- Use
Selectinstead when the option set is long enough that always-visible choices would overwhelm the layout. - The package is single-value by design; use
CheckboxorToggleGroup type="multiple"for multi-select behavior.
Decision Guides
- Choosing between controls
Compare Select vs Combobox vs Radio Group for visible single-choice workflows.
- Overlay and state pitfalls
Review disabled item behavior and controlled ownership before wiring form state.