kodobe-react-radio
v2.0.1
Published
Kodobe React Radio
Downloads
1
Readme
Kodobe React Radio
This is a simple react radio and radio group package.
Install
npm install kodobe-react-radio
or
yarn add kodobe-react-radio
Setup
import Radio from 'kodobe-react-radio';
import Radio, {RadioGroup} from 'kodobe-react-radio';
Usage
import Radio, {RadioGroup} from "kodobe-react-radio";
function App() {
return (
<div>
<h3>Here is how to use a radio</h3>
<Radio isChecked={radio} onCheck={(t) => setRadio(t.target.value)} />
<h3>Here is how to use a radio group</h3>
<RadioGroup
className="rgroup"
value={female}
name="gender"
onChange={(v) => console.log(v.target.value)}
>
<Radio value="female" />
<Radio value="male" />
<Radio value="twice" />
<Radio value="king" />
</RadioGroup>
</div>
);
}
Options
Radio
- isChecked : state of the radio (boolean, default=false)
- disabled : if the switch can be toggled (boolean, default=false)
- onCheck : check a radio button (function, required)
- style : (object)
- className : (string)
- id : (any)
- name : (string)
Radio Group
- value : value corresponding to one of the radio child (any, default="")
- children : list of Radio Components (obj, required)
- onChange : change radio value (function, required)
- style : (object)
- className : (string)
- id : (any)
- name : (string)