RadioTile
RadioTile provides a larger, more prominent radio button option with optional description text.
Installation
Usage
Props
RadioTile
Extends RadioGroupPrimitive.Item
props.
Prop | Type | Default | Description |
---|---|---|---|
label | string | - | The text label for the radio tile. |
description | string | - | Optional description text displayed below the label. |
value | string | - | The value associated with this radio tile. |
disabled | boolean | false | When true, prevents user interaction. |
className | string | - | Additional Tailwind classes to apply. |
RadioTileGroup
Extends RadioGroupPrimitive.Root
props.
Prop | Type | Default | Description |
---|---|---|---|
value | string | - | The value of the selected radio tile. |
onValueChange | (value: string) => void | - | Callback fired when selection changes. |
Examples
Basic Usage
With Description
Disabled States
Styling
The RadioTile component uses Tailwind CSS classes for styling through class-variance-authority (cva). Default styling includes:
- Container width: 329px
- Rounded corners (2px)
- 2px border width
- Radio indicator: 20px × 20px
- Consistent padding (13px 16px 13px 9px)
- Primary colors when selected
- Light background when selected
- Gap spacing between elements
States
Radio tiles have several visual states:
- Unchecked: White background with light border
- Checked: Light primary background with primary border
- Disabled: White background with gray border and text
Accessibility
The RadioTile component:
- Uses
accessibilityRole="radio"
for proper semantic structure - Supports keyboard navigation within RadioTileGroup
- Maintains WCAG color contrast requirements
- Provides appropriate
accessibilityState
for checked and disabled states - Uses proper labeling with
aria-labelledby
andaria-describedby
- Ensures adequate touch target size