Skip to main content

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>
);
}
Hello
Hello

Props

proptypedescription
labelstringlabel text of the radio button
onClick(event) => voidon click handler
colorColorcomponent color
selectedbooleanif true, will set the state as selected
disabledbooleanif true, will set the state as disabled
classNamestringapplies the className to the container of the radio ui
radioClassNamestringapplies the className to the radio component
textClassNamestringapplies the className to the Text Component