RadioGroup
A headless RadioGroup component for ReactLynx. It manages single-selection state across a group of radio buttons.You can check the source code to understand how it works, and you're welcome to submit PRs to enhance its capabilities.
Basic Usage
Examples
Disabled
RadioGroup supports disabling the entire group or individual options.
Structure
Component API
RadioGroupRoot
The root component of the RadioGroup, containing all of its child components.
State-based styling & rendering
This component exposes runtime states through one or both of the following channels. The table lists only the channels available for each state:
- UI variant class — when supported, a class like
ui-<state>is toggled on the corresponding component node for selectors such as.ui-<state> { ... }. - Render-prop field — when supported and
childrenis a function, the state is passed in viachildren({ <state>: boolean, ... })for runtime-driven rendering.
RadioGroupRoot exposes the following render prop states.
| Render Prop | Type | Description |
|---|---|---|
value | string | null | The current selected value of the RadioGroup. |
disabled | boolean | Whether the RadioGroup is disabled. |
Radio
The item inside RadioGroup.
UI variants applied by Radio.
| Class Name | Description |
|---|---|
| ui-active | Applied while the Radio is pressed and not disabled. |
| ui-checked | Applied when the Radio is checked. |
| ui-disabled | Applied when the Radio is disabled. |
RadioIndicator
The check slot indicating this Radio is now selected. Normally a circle. It's children will only be rendered when selected so it can be a custom inner selected indicator. Can be a ReactNode or a render function returns a ReactNode.
UI variants applied by RadioIndicator.
| Class Name | Description |
|---|---|
| ui-active | Applied while the Radio is pressed and not disabled. |
| ui-checked | Applied when the Radio is checked. |
| ui-disabled | Applied when the Radio is disabled. |