RadioGroup
A radio group with one selected value.
Pass Radio elements as children. onChange returns the selected value. label, description, and errorMessage add a group heading, a hint, and error text. Items keep their own disabled, size, and name.
Live example
Example controls
Usage
import { Radio, RadioGroup } from '@prosazhin/pbcomponents';
<RadioGroup
label='Options'
defaultValue='One'
onChange={(value) => console.log(value)}
>
{['One', 'Two', 'Three', 'Four', 'Five'].map((item) => (
<Radio
key={item}
value={item}
>
{item}
</Radio>
))}
</RadioGroup>;Component API
| Prop | Type / variants | Purpose | Default |
|---|---|---|---|
children | Radio[] | Radio choices; items keep their own disabled, size and name. | — |
size | 's' | 'm's · m | Component size. | — |
label | ReactNode | Group heading (legend). | — |
description | ReactNode | Hint below the group heading. | — |
errorMessage | ReactNode | Error text below the group; linked to it via aria-describedby. | — |
name | string | Shared name of the native inputs. | — |
disabled | boolean | Disables interaction. | false |
value | string | Selected value. | — |
defaultValue | string | Initial value when uncontrolled. | — |
onChange | (value: string) => void | Reports the new selected value. | — |
className | string | Class of the root element. | — |
Native HTML attributes are accepted where the component renders the corresponding element. className props only affect styling.