Skip to main content

Radio

Radio

Check out how awesome these radio buttons look! Who wouldn't want to use them?

Usage

Imports:

import { Radio } from 'galio-framework';

Basic examples:

<Radio label="Primary color Radio" color="primary"  />
<Radio label="Info color Radio" color="info" />
<Radio label="Error color Radio" color="error" />
<Radio label="Warning color Radio" color="warning" />
<Radio label="Success color Radio" color="success" />

Advanced examples:

<Radio label="initialValue = true" initialValue />
<Radio label="radioInnerStyle used" initialValue radioInnerStyle={{ backgroundColor: "#FE2472" }} />
<Radio label="radioOuterStyle used" radioOuterStyle={{ backgroundColor: '#FF9C09' }} />
<Radio label="containerStyle and labelStyle used" containerStyle={{ backgroundColor: "#FE247220" }} labelStyle={{ color: '#1232FF' }} />

Modern usage with hooks:

const [selectedValue, setSelectedValue] = useState('option1');

<Radio
label="Option 1"
value="option1"
selected={selectedValue === 'option1'}
onPress={() => setSelectedValue('option1')}
/>

Props

PropTypeDefaultDescription
labelstringnullRadio button label
colorstring'primary'Radio button color
valuestringnullRadio button value
selectedboolfalseWhether this radio is selected
onPressfunctionnullCallback when radio is pressed
containerStyleobjectnullCustom container styles
radioOuterStyleobjectnullCustom outer radio styles
radioInnerStyleobjectnullCustom inner radio styles
labelStyleobjectnullCustom label styles
disabledboolfalseDisables the radio button
initialValueboolfalseInitial selection state
styleobjectnullCustom styles