Radio Button
Single-selection radio button and radio group supporting custom sizes, validation status variants, required indicators, and helper text
The UX4G Radio Button component allows users to select a single option from a set of mutually exclusive choices. It is designed specifically for citizen-facing forms, survey questionnaires, payment gateway options, and administrative workflows.
Key Capabilities
- Generic & Boolean Overloads: Type-safe
<T>selection withvalue/groupValuebinding or directselected/onClickstate control. - Validation & Status Variants: Visual ring status and contextual description messaging (
Helper,Error,Warning,Success) with automatic status icons. - Size Options: Preconfigured sizes:
Small(16dp),Medium(20dp), andLarge(24dp). - Form Controls: Support for required indicator asterisks (
*), trailing icons, custom typography, disabled states, and centered touch ripples.
Import from com.ux4g.designsystemv1.components.radiobutton.*.
Interactive Previews
1. Default Radio Group
Standard radio button selection with multiple options where only one choice can be selected at a time.

2. Status & Validation Variants
Radio button options configured with validation severities (Helper, Error, Warning, Success). Each state renders custom ring coloring and descriptive messages with contextual status icons.

Kotlin Usage
1. Type-Safe Radio Selection Group
import androidx.compose.foundation.layout.*
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.ux4g.designsystemv1.components.radiobutton.*
enum class PaymentMode(val title: String) {
UPI("UPI / Instant Transfer"),
NetBanking("Internet Banking"),
DebitCard("Debit / Credit Card")
}
@Composable
fun PaymentSelectionSection() {
var selectedMode by remember { mutableStateOf(PaymentMode.UPI) }
Column(
modifier = Modifier.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
PaymentMode.values().forEach { mode ->
Ux4gRadioButton(
value = mode,
groupValue = selectedMode,
onValueChange = { selectedMode = it },
label = mode.title,
size = Ux4gRadioButtonSize.Medium
)
}
}
}2. Form Field with Required Asterisk & Validation
import androidx.compose.foundation.layout.*
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.ux4g.designsystemv1.components.radiobutton.*
@Composable
fun CitizenshipDeclaration(
isCitizen: Boolean?,
onStatusChange: (Boolean) -> Unit,
hasValidationError: Boolean
) {
Column(
modifier = Modifier.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(10.dp)
) {
Ux4gRadioButton(
selected = isCitizen == true,
onClick = { onStatusChange(true) },
label = "I am an Indian Citizen",
isRequired = true,
size = Ux4gRadioButtonSize.Medium,
description = if (hasValidationError && isCitizen == null) "Mandatory selection required" else null,
descriptionVariant = if (hasValidationError && isCitizen == null) Ux4gRadioButtonDescriptionVariant.Error else Ux4gRadioButtonDescriptionVariant.Helper,
status = if (hasValidationError && isCitizen == null) Ux4gRadioButtonStatus.Error else Ux4gRadioButtonStatus.DefaultStatus
)
Ux4gRadioButton(
selected = isCitizen == false,
onClick = { onStatusChange(false) },
label = "I am a Foreign National / NRI",
isRequired = true,
size = Ux4gRadioButtonSize.Medium
)
}
}Parameters
Ux4gRadioButton<T> (Generic Model)
| Prop | Type | Description | Default |
|---|---|---|---|
value * | T | The value represented by this individual radio button. | — |
groupValue * | T? | The currently active selected value for the radio group. | — |
onValueChange * | (T) -> Unit | Callback invoked when this radio option is selected. | — |
modifier | Modifier | Compose layout modifier for outer container. | Modifier |
label | String? | Primary label text displayed next to the radio button. | null |
description | String? | Supporting helper message or validation error text. | null |
size | Ux4gRadioButtonSize | Radio button size variant (Small, Medium, Large). | Ux4gRadioButtonSize.Medium |
isRequired | Boolean | Appends a red asterisk (*) next to the label when true. | false |
trailingIcon | Ux4gIcon? | Optional UX4G icon placed inline beside the label text. | null |
trailingImageVector | ImageVector? | Optional Compose ImageVector placed beside the label text. | null |
descriptionVariant | Ux4gRadioButtonDescriptionVariant | Contextual severity style (Helper, Error, Warning, Success). | Ux4gRadioButtonDescriptionVariant.Helper |
status | Ux4gRadioButtonStatus | Outer ring visual state coloring (DefaultStatus, Error, Warning, Success). | Ux4gRadioButtonStatus.DefaultStatus |
color | Color? | Custom tint color for selected circle ring. Takes precedence over status. | null |
labelColor | Color? | Custom text color for the label. | null |
labelStyle | TextStyle? | Custom typography style override for the label text. | null |
descriptionStyle | TextStyle? | Custom typography style override for the description text. | null |
enabled | Boolean | Controls interactive touch state and disabled opacity. | true |
Ux4gRadioButton (Boolean Overload)
| Prop | Type | Description | Default |
|---|---|---|---|
selected * | Boolean | Whether this radio button is in a selected state. | — |
onClick * | () -> Unit | Callback invoked when the radio button is clicked. | — |
modifier | Modifier | Compose layout modifier for outer container. | Modifier |
label | String? | Primary label text displayed next to the radio button. | null |
description | String? | Supporting helper message or validation error text. | null |
size | Ux4gRadioButtonSize | Radio button size variant (Small, Medium, Large). | Ux4gRadioButtonSize.Medium |
isRequired | Boolean | Appends a red asterisk (*) next to the label when true. | false |
trailingIcon | Ux4gIcon? | Optional UX4G icon placed inline beside the label text. | null |
trailingImageVector | ImageVector? | Optional Compose ImageVector placed beside the label text. | null |
descriptionVariant | Ux4gRadioButtonDescriptionVariant | Contextual severity style (Helper, Error, Warning, Success). | Ux4gRadioButtonDescriptionVariant.Helper |
status | Ux4gRadioButtonStatus | Outer ring visual state coloring (DefaultStatus, Error, Warning, Success). | Ux4gRadioButtonStatus.DefaultStatus |
color | Color? | Custom tint color for selected circle ring. Takes precedence over status. | null |
labelColor | Color? | Custom text color for the label. | null |
labelStyle | TextStyle? | Custom typography style override for the label text. | null |
descriptionStyle | TextStyle? | Custom typography style override for the description text. | null |
enabled | Boolean | Controls interactive touch state and disabled opacity. | true |
interactionSource | MutableInteractionSource | Custom interaction stream for ripple feedback. | remember { MutableInteractionSource() } |
Ux4gRadioButtonSize Reference
| Size | Outer Circle (sizeDp) | Inner Dot (dotSizeDp) | Typography Level |
|---|---|---|---|
Small | 16.dp | 8.dp | lM_default (Label), lS_default (Desc) |
Medium | 20.dp | 10.dp | lL_default (Label), lM_default (Desc) |
Large | 24.dp | 12.dp | lXL_default (Label), lL_default (Desc) |
Ux4gRadioButtonDescriptionVariant Reference
| Variant | Icon | Text Color | Usage Context |
|---|---|---|---|
Helper | Icons.Outlined.Info | onSurface (70% alpha) | Informational hints and general guidance |
Error | Icons.Outlined.ErrorOutline | Ux4gTheme.colorScheme.error | Form validation failures and mandatory field alerts |
Warning | Icons.Outlined.WarningAmber | Ux4gColors.secondary600 | Cautionary warnings and soft prerequisite notices |
Success | Icons.Outlined.CheckCircleOutline | Ux4gColors.green600 | Confirmation and successful condition validation |
Ux4gRadioButtonStatus Reference
| Status | Ring Color | Description |
|---|---|---|
DefaultStatus | Ux4gTheme.colorScheme.primary (selected) / neutral300 (unselected) | Standard neutral theme-aware radio ring |
Error | Ux4gTheme.colorScheme.error | Highlighted error ring for invalid selection |
Warning | Ux4gColors.secondary600 | Amber cautionary ring |
Success | Ux4gColors.green600 | Green success ring |
Progress SLA Indicator
Service Level Agreement (SLA) status tracking component featuring Linear and Circular countdown indicators across Normal, Warning, Critical, and Completed SLA tiers
Result List
High-density expandable search results, application tracking cards, and grievance list rows with metadata pills, status tags, and detail grids