Skip to main content

RadioButton

Reference

  • The RadioButton component is a styled and customizable radio button.
  • It supports custom labels, disabled states, and theming.

Props

  1. checked

    • Type: boolean
    • Default: false
    • Description: Indicates whether the radio button is selected.
  2. disabled

    • Type: boolean
    • Default: false
    • Description: Disables the radio button if true.
  3. onChange

    • Type: function
    • Description: Callback triggered when the radio button's state changes.
  4. label

    • Type: string
    • Description: Text label displayed next to the radio button.
  5. title

    • Type: string
    • Description: Tooltip text for the label.
  6. className

    • Type: string
    • Description: Custom class name for the container.
  7. option

    • Type: object
    • Description: Additional data for the radio button, such as name.

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.