@berlitz/radio
v2.3.1
Published
Radio component for the Max Design System
Downloads
6,827
Readme
Radio
Radio button input field
Installation
yarn add @berlitz/radio
Props
Radio.propTypes
| Argument | Type | Required | Default | Example | | -------- | ------ | -------- | ------- | ------- | | Name | string | No | No | | | value | string | No | No | | | disabled | bool | No | false | | | required | bool | No | false | | | children | node | ✅ | No | |
Group.propTypes
| Argument | Type | Required | Default | Example | | --------- | ------------------- | -------- | ------- | ------- | | name | string | No | No | | | value | string,number, bool | No | No | | | children | node | ✅ | No | | | onChange | func | No | No | | | fullWidth | bool | No | No | |
RadioController Proptypes
| Argument | Type | Required | Default | Example | | ------------- | ------------------- | -------- | ------- | ------- | | name | string | ✅ | No | | | value | string,number, bool | No | No | | | disabled | bool | No | false | | | required | bool | No | false | | | data | func | ✅ | No | | | setFieldValue | bool | ✅ | No | |
Usage
yarn add @berlitz/radio
import { RadioController } from '@berlitz/radio'
const data = [
{
id: 'value 1',
name: 'radio label 1'
},
{
id: 'value 2',
name: 'radio label 2'
},
{
id: 'value 3',
name: 'radio label 3'
},
]
<RadioController name='my_radio_field' data={data} value='value 2' setFieldValue={() => {}} disabled />
When to use this component
Any input field that requires radio button