Skip to content

Radio.Button

The Radio.Button slot represents a single option within a Radio. It renders a clickable control with a label.

To create a Radio.Button you need to wrap it in the Radio component and provide a value to it. You must also provide the selected prop to the Radio.Button you wish to be selected by default.

import Radio from '@components/Basic/RadioGroup/Radio';
const App = () => {
return (
<>
<Radio>
<Radio.Button selected value="red">red</Radio.Button>
<Radio.Button value="green">green</Radio.Button>
<Radio.Button value="blue">blue</Radio.Button>
</Radio>
</>
);
};
export default App;
Prop NameTypeDefaultDescription
styleJSX.CSSProperties{}Inline styles to apply directly to the component’s root element.
classstring""Additional CSS classes to apply to the component.
valuestringundefinedThe string value the radio button is associated with.
selectedbooleanfalseSpecify if the radio button is selected.
disabledbooleanfalseSpecify if the radio button is disabled.
class-selectedstring""Additional CSS classes to apply to the button when selected.
class-disabledstring""Additional CSS classes to apply to the button when disabled.

Allows customization of the radio button’s label. This slot can be used to include additional elements in the label or place the label before the control of the radio button.

Prop NameTypeDefaultDescription
beforebooleanfalseSpecify if the label should be put before the radio button control
childrenJSX.ElementundefinedContent to render inside the label, which can be any valid JSX element.
import Radio from '@components/Basic/RadioGroup/Radio';
import Block from '@components/Layout/Block/Block';
const App = () => {
return (
<Radio>
<Radio.Button value="windowed">Windowed</Radio.Button>
<Radio.Button value="fullscreen">Fullscreen Mode</Radio.Button>
<Radio.Button value="borderless">
<Radio.ButtonLabel>
<Block style={{ 'font-weight': 'bold' }}>Borderless</Block>
</Radio.ButtonLabel>
</Radio.Button>
</Radio>
);
};
export default App;

This slot allows you to customize the control of the Radio.Button component when it is not selected. Use it to apply custom styles, classes or include additional elements in the control of the radio button.

Prop NameTypeDefaultDescription
styleJSX.CSSProperties{}Inline styles to apply directly to the radio button control.
classstring""Additional CSS classes to style the radio button control.
childrenJSX.ElementundefinedContent to render inside the radio button control, which can be any valid JSX element.
import Radio from '@components/Basic/RadioGroup/Radio';
import Block from '@components/Layout/Block/Block';
const App = () => {
return (
<Radio>
<Radio.Button value="windowed">Windowed</Radio.Button>
<Radio.Button value="fullscreen">Fullscreen Mode</Radio.Button>
<Radio.Button value="borderless">
Borderless
<Radio.ButtonControl style={{'border-color': 'blueviolet', "background-color": 'black'}} />
</Radio.Button>
</Radio>
);
};
export default App;

This slot allows you to override the default indicator displayed when the radio button is selected. Use it to apply custom styles, classes or include additional elements in the indicator of the radio button.

Prop NameTypeDefaultDescription
styleJSX.CSSProperties{}Inline styles to apply directly to the radio button indicator.
classstring""Additional CSS classes to style the radio button indicator.
childrenJSX.ElementundefinedContent to render inside the radio button indicator, which can be any valid JSX element.
import Radio from '@components/Basic/RadioGroup/Radio';
import Block from '@components/Layout/Block/Block';
import Icon from '@assets/check-mark.svg?component-solid';
const App = () => {
return (
<Radio>
<Radio.Button value="windowed">Windowed</Radio.Button>
<Radio.Button value="fullscreen">Fullscreen Mode</Radio.Button>
<Radio.Button value="borderless">
Borderless
<Radio.ButtonControl style={{'border-color': 'blueviolet', "background-color": 'black'}}>
<Radio.ButtonIndicator style={{"background-color": 'green'}}>
<Icon style={{width: '100%', height: '100%' }}/>
</Radio.ButtonIndicator>
</Radio.ButtonControl>
</Radio.Button>
</Radio>
);
};
export default App;

You can find examples of how to work with the radio buttons in the Radio documentation.