1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-07-05 20:53:12 +00:00
foris-js/src/bootstrap/RadioSet.md

27 lines
710 B
Markdown
Raw Normal View History

2019-08-23 13:20:22 +00:00
Set of radio Bootstrap component input with label and predefined sizes and structure for using in foris forms.
All additional `props` are passed to the `<input type="number">` HTML component.
2019-10-24 08:12:39 +00:00
Unless `helpText` is set for one of the options they are displayed inline.
2019-08-23 13:20:22 +00:00
```js
import {useState} from 'react';
const CHOICES=[
{value:'one',label:'1'},
{value:'two',label:'2'},
{value:'three',label:'3'},
];
const [value, setValue] = useState(CHOICES[0].value);
<>
{/*Yeah, it gets event, not value!*/}
<RadioSet
value={value}
name='some-radio'
choices={CHOICES}
2019-09-30 09:26:06 +00:00
onChange={event =>setValue(event.target.value)}
2019-08-23 13:20:22 +00:00
/>
<p>Selected value: {value}</p>
</>
```