RadioButton
Reference
- The
RadioButtoncomponent is a styled and customizable radio button. - It supports custom labels, disabled states, and theming.
Props
-
checked- Type:
boolean - Default:
false - Description: Indicates whether the radio button is selected.
- Type:
-
disabled- Type:
boolean - Default:
false - Description: Disables the radio button if
true.
- Type:
-
onChange- Type:
function - Description: Callback triggered when the radio button's state changes.
- Type:
-
label- Type:
string - Description: Text label displayed next to the radio button.
- Type:
-
title- Type:
string - Description: Tooltip text for the label.
- Type:
-
className- Type:
string - Description: Custom class name for the container.
- Type:
-
option- Type:
object - Description: Additional data for the radio button, such as
name.
- Type:
Usage Example
function Example(pageContext) {
const { protrakComponents } = React.useContext(customWidgetContext);
const { RadioButton } = protrakComponents;
return(
<RadioButton
checked={true}
label="Option 1"
onChange={(event, name) => console.log('Selected:', name)}
option={{ name: 'option1' }}
/>
);
}
- This renders a selected radio button with the label "Option 1" and logs the selected option when clicked.