https://github.com/jossmac/react-radios
🔘 Proper handling of HTML radios in react
https://github.com/jossmac/react-radios
radio-buttons react
Last synced: about 1 year ago
JSON representation
🔘 Proper handling of HTML radios in react
- Host: GitHub
- URL: https://github.com/jossmac/react-radios
- Owner: jossmac
- License: mit
- Created: 2018-04-20T07:56:45.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-10-12T01:53:48.000Z (over 7 years ago)
- Last Synced: 2025-03-28T07:22:56.762Z (over 1 year ago)
- Topics: radio-buttons, react
- Language: JavaScript
- Homepage: https://jossmac.github.io/react-radios
- Size: 146 KB
- Stars: 60
- Watchers: 2
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# React Radios
Brings radio group behavior into line with other input types in React like the [select tag](https://reactjs.org/docs/forms.html#the-select-tag).
[https://jossmac.github.io/react-radios](https://jossmac.github.io/react-radios)
### Install
```bash
yarn add react-radios
```
### Use
```js
import { Radio, RadioGroup } from 'react-radios';
Apple
Orange
Banana
```
If you'd like to use the same single-value pattern for checkboxes,
there's components for that too:
```js
import { Checkbox, CheckboxGroup } from 'react-radios';
One
Two
Three
```
### Props
#### RadioGroup / CheckboxGroup
| Property | Description |
| --------------- | -------------------------------- |
| children `Node` | Required. Radios or Checkboxes. |
| component `$ReactComponent` | Default: `$ReactFragment`. Replace the underlying component. |
| onChange `value => mixed` | Required. Function to handle the onChange event. |
| name `string` | Name to be passed onto each child. |
| value `string \| number` | The value of the group. |
#### Radio / Checkbox
| Property | Description |
| --------------- | -------------------------------- |
| component `$ReactComponent` | Default: `'input'`. Replace the underlying component. |
| value `string \| number` | The value of the control. |