Skip to main content

RadioButton

Content

Radio button component.

Params

NameTypeRequiredDefault valueDescription
isSelectedbooleanTrue-Changes the design based on selection
idstringTrue-ID of radio button item
labelstringTrue-Label of radio button
onPress(id: string, nextValue: boolean) => voidTrue-On item press callback
disabledbooleanFalseUndefinedIf disabled then not allows to select it and shows different design
IconComponentFunctionComponent<IIconComponentProps>FalseRadioIconRadio icon component

Usage example

const [isSelected, setSelected] = useState<boolean>(false);

const onPress = useCallback((id, nextSelection) => {
setSelected(nextSelection);
}, []);

return (
<ScrollView style={CommonStyles.flexPlatformBackground} contentContainerStyle={CommonStyles.flexColumnCenterStretch}>
<RadioButton id={"0"} label={"Radio button label"} isSelected={isSelected} onPress={onPress} />
</ScrollView>
);