1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2025-12-16 04:23:36 +01:00
Files
foris-js/src/bootstrap/RadioSet.md
Maciej Lenartowicz 50a1bfd9b5 Release 0.1.0
2019-10-07 15:16:27 +00:00

634 B

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.

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}
        onChange={event =>setValue(event.target.value)}
    />
    <p>Selected value: {value}</p>
</>