RadioButton

A radio button in a web form. We have a separate component from the browser base so we can style it.

Properties

checked true|false
Same as React <input checked={} />.
defaultChecked true|false
Same as React <input defaultChecked={} />.
disabled true|false
Same as React <input disabled={} />.
id {string}
The DOM id attribute value to use for the underlying <input /> element.
label {string|node}
Label text to place next to the control.
name {string}
The DOM name attribute value to use for the underlying <input /> element.
onChange {function}
Same as React <input onChange={} />.
value {string}
The DOM value attribute to use for the underlying <input /> element.

Usage

import RadioButton from 'grommet/components/RadioButton';

<FormField>
  <RadioButton id='choice1-1'
    name='choice1-1'
    label='Choice 1'
    checked={true}
    onChange={...} />
  <RadioButton id='choice1-2'
    name='choice1-2'
    label='Choice 2'
    checked={false}
    onChange={...} />
</FormField>