@tdcerhverv/radio-button
v4.0.0
Published
Radio Button component
Downloads
5
Maintainers
Keywords
Readme
RadioButton component
- Documentation: https://material-ui.com/components/radio-buttons/#radio
- Repository: https://github.com/mui-org/material-ui/tree/master/docs/src/pages/components/radio-buttons
- Figma: https://www.figma.com/file/yl8T5ivrlqO2TELws3XRrp/Material-components?node-id=1%3A4
Usage 1
Import like this:
// Default Material UI components
import RadioGroup from '@material-ui/core/RadioGroup';
import FormControl from '@material-ui/core/FormControl';
// Styled Material UI component
import { RadioButton } from '@tdcerhverv/radiobutton';
import { FormHelperText } from '@tdcerhverv/radiobutton';
import { FormControlLabel } from '@tdcerhverv/radiobutton';
Use like this:
const handleChange = () => {};
<FormControl component="fieldset" error={true}>
<RadioGroup aria-label="quiz" name="quiz1">
<FormControlLabel
value="radio1"
control={<RadioButton onChange={handleChange} />}
label="Radio label 1"
/>
<FormControlLabel
value="radio2"
control={<RadioButton onChange={handleChange} />}
label="Radio label 2"
/>
<FormControlLabel
value="radio3"
control={<RadioButton onChange={handleChange} />}
label="Radio label 3"
/>
</RadioGroup>
<FormHelperText>Choose already!</FormHelperText>
</FormControl>;
Usage 2 - Standalone
Import like this:
// Styled Material UI component
import { RadioButton } from '@tdcerhverv/radiobutton';
Use like this:
const handleChange = () => {};
<RadioButton onChange={handleChange} />;
Props
RadioButton
Spreads the default RadioButton props
FormHelperText
Insert error icon before the provided text. Spreads the default FormHelperText props
FormControlLabel
Spreads the default FormControlLabel props