Skip to content
Docs
Components
Inputs
Radio

Radio

Component to render a radio input.

Import

import { Radio, RadioGroup } from 'react-native-ficus-ui';

Usage

Simple radio

EDITABLE EXAMPLE
<Box>
  <Radio value={1} />
  <Radio value={2} defaultChecked />
  <Radio value={3} colorScheme="green" />
  <Radio value={4} isDisabled />
  <Radio value={5} isLoading />
</Box>

Radio group

EDITABLE EXAMPLE
<RadioGroup colorScheme="red">
  <Radio value={1} prefix={<Text flex={1}>Option 1</Text>} />
  <Radio value={2} prefix={<Text flex={1}>Option 2</Text>} />
  <Radio value={3} prefix={<Text flex={1}>Option 3</Text>} />
</RadioGroup>

Radio sizes

EDITABLE EXAMPLE
<Box>
  <RadioGroup>
    <Radio value={1} size="sm">
      Option 1
    </Radio>
    <Radio value={2} size="lg">
      Option 2
    </Radio>
  </RadioGroup>
  <Radio value={3} size="lg" isLoading>
    Loading option
  </Radio>
</Box>

Custom radio

EDITABLE EXAMPLE
<RadioGroup colorScheme="red" flexDirection="row">
  {['Option 1', 'Option 2', 'Option 3'].map((item) => (
    <Radio value={item}>
      {({ isChecked }) => (
        <Badge
          variant={isChecked ? 'solid' : 'subtle'}
          colorScheme="pink"
          fontSize="lg"
          px="md"
          py="md"
          borderRadius="full"
          mx="sm"
        >
          {item}
        </Badge>
      )}
    </Radio>
  ))}
</RadioGroup>

Props

Radio props

Extends every Box props.

colorScheme

The colorScheme property, will define checkbox color.

TypeRequiredDefault
stringNoblue

defaultChecked

Boolean to indicate if checkbox should be checked by default.

TypeRequiredDefault
booleanNofalse

isChecked

Boolean to indicate if checkbox is checked.

TypeRequiredDefault
booleanNofalse

isDisabled

Boolean to indicate if checkbox is disabled.

TypeRequiredDefault
booleanNofalse

isLoading

Boolean to indicate if checkbox should display a loader/spinner.

TypeRequiredDefault
booleanNofalse

onChecked

Function called when checked status changes on checkbox.

TypeRequired
(newValue: boolean) => voidNo

icon

Custom icon component to replace default checkbox icon.

TypeRequired
React.ReactNodeNo

iconColor

Custom icon color.

TypeRequired
stringNo

size

Size of checkbox.

TypeRequired
number 'sm' 'lg'No

RadioGroup props

onChange

Function called when checked value changes.

TypeRequired
(value: any) => voidNo

value

Value for the checkbox group.

TypeRequired
anyNo

defaultValue

Default value for the checkbox group.

TypeRequired
anyNo

colorScheme

The colorScheme property, will define group checkboxs color.

TypeRequiredDefault
stringNoblue