RadioButton
Example
import { useState } from 'react';
import RadioButton from '@mavvy/m3-ui/RadioButton';
function RadioExample() {
const [selected, setSelected] = useState(false);
const handleSelect = () => {
setSelected((v) => !v);
};
return (
<div>
<RadioButton onClick={handleSelect} selected={selected} label="Hello" />
<RadioButton
color="primary"
onClick={handleSelect}
selected={selected}
label="Hello"
/>
</div>
);
}
Props
prop | type | description |
---|---|---|
label | string | label text of the radio button |
onClick | (event) => void | on click handler |
color | Color | component color |
selected | boolean | if true, will set the state as selected |
disabled | boolean | if true, will set the state as disabled |
className | string | applies the className to the container of the radio ui |
radioClassName | string | applies the className to the radio component |
textClassName | string | applies the className to the Text Component |