Skip to main content

Radio

 

⚠️ Experimental Component

This component is still being evaluated and may change in future releases.

 

RadioGroup component renders a group of radio buttons, manages the selected value internally, and calls onSelect when a child radio button is pressed.

Implementation Code

import { Radio } from '@nexara/nativeflow';

const Component = () => {
return (
<Radio.Group
defaultValue='others'
name='Gender'
onSelect={(name, value) => console.log(name, value)}
>
<Radio.Item
value='male'
label='Male'
/>
<Radio.Item
value='female'
label='Female'
/>
<Radio.Item
value='others'
label='Others'
/>
</Radio.Group>
);
};

export default Component;

props

RadioGroup

PropTypeDefaultDescription
namestringUnique name for the radio group, useful for forms or multiple groups.
defaultValuestringDefault selected value (uncontrolled usage).
valuestringCurrent selected value (controlled usage).
childrenReactNodeRadioItem components that belong to this group.
onSelectfunctionCallback fired when a radio option is selected. Receives (name: string, value: string).

RadioItem

PropTypeDefaultDescription
sizenumber22Size of the radio circle.
strokenumber2Border width of the outer circle.
colorstringCustom color for the radio item (defaults to theme color).
activebooleanfalseWhether this radio item is selected.
namestringUnique name of the radio item (used in groups).
valuestringValue associated with this radio item.
disabledbooleanfalseIf true, disables the radio item.
labelstringOptional text label displayed beside the radio item.
fsnumberFont size override for the label text.
fScaleTypographyScalebaseTypography scale for the label text.
ffstringFont family for the label text.
labelStyleStyledTextPropsAdditional style props for the label text.