RadioButton is an extension to standard radio button element with skinning capabilities.
import { RadioButton } from 'primereact/radiobutton';
<script src="https://unpkg.com/primereact/core/core.min.js"></script>
<script src="https://unpkg.com/primereact/radiobutton/radiobutton.min.js"></script>
RadioButton is used as a controlled input with checked and onChange properties.
<RadioButton value="val1" name="city" onChange={(e) => setValue(e.value)} checked={value === 'val1'} />
<RadioButton value="val2" name="city" onChange={(e) => setValue(e.value)} checked={value === 'val2'} />
Any valid attribute is passed to the root element implicitly, extended properties are as follows;
| Name | Type | Default | Description |
|---|---|---|---|
| id | string | null | Unique identifier of the element. |
| inputId | string | null | Unique identifier of the inner native radiobutton. |
| name | string | null | Name of the checkbox element . |
| value | any | null | Value of the radiobutton. |
| checked | boolean | false | Specifies whether a radiobutton should be checked or not. |
| style | string | null | Inline style of the element. |
| className | string | null | Style class of the element. |
| disabled | boolean | false | When present, it specifies that the element value cannot be altered. |
| required | boolean | false | When present, it specifies that an input field must be filled out before submitting the form. |
| tooltip | any | null | Content of the tooltip. |
| tooltipOptions | object | null | Configuration of the tooltip, refer to the tooltip documentation for more information. |
| Name | Parameters | Description |
|---|---|---|
| onChange | event.originalEvent: Original event event.value: Value of the radiobutton event.checked: Checked state as a boolean. | Callback to invoke on radio button click. |
Following is the list of structural style classes, for theming classes visit theming page.
| Name | Element |
|---|---|
| p-radiobutton | Container element |
| p-radiobutton-box | Container of icon. |
| p-radiobutton-icon | Icon element. |
| p-radiobutton-label | Label element. |
This section is under development. After the necessary tests and improvements are made, it will be shared with the users as soon as possible.
None.
Built-in component themes created by the PrimeReact Theme Designer.
Premium themes are only available exclusively for PrimeReact Theme Designer subscribers and therefore not included in PrimeReact core.
Beautifully crafted premium create-react-app application templates by the PrimeTek design team.