# Radio Radio Button presents a list of mutually exclusive options where users can make exactly one selection from the group. It supports user interaction by allowing the selection of a single choice out of multiple predefined items, ensuring that users can easily define precise preferences, answer single choice binary questions, and submit forms with distinct clarity. **Category:** Components **Storybook:** https://doc.ux4g.gov.in/web/?path=/story/ux4g-components-radio--introduction ## Framework setup ### HTML / CDN ```html ``` ### React ```bash npm install ux4g-web-components ``` ```jsx import 'ux4g-web-components/styles.css'; import 'ux4g-web-components/design-system'; ``` ### Angular Update `angular.json`: ```json { "styles": [ "node_modules/ux4g-web-components/styles/ux4g.css", "src/styles.css" ], "scripts": [ "node_modules/ux4g-web-components/dist/runtime/design-system.js" ] } ``` ## Code examples The snippets below are extracted from the Storybook canvas for Radio. Each example shows the rendered HTML, the equivalent React JSX, and the Angular template markup. ### 1. Description Variants — Description Variants HTML: ```html ``` React: ```jsx import React from 'react'; const RadioExample1Demo = () => ( <> {/* Variant: Radio Description - Helper */} {/* Variant: Radio Description - Error */} {/* Warning */} {/* Success */} > ); export default RadioExample1Demo; ``` Angular: ```html ``` ### 2. Introduction — Introduction HTML: ```html
Radio Button presents a list of mutually exclusive options where users can make exactly one selection from the group. It supports user interaction by allowing the selection of a single choice out of multiple predefined items, ensuring that users can easily define precise preferences, answer single choice binary questions, and submit forms with distinct clarity.
A compact tour of the radio patterns used across the source-backed stories.
Quickly copy the radio classes used by the showcased source-backed variants.
| Purpose | Class |
|---|---|
| Base |
ux4g-radio
|
| Input |
ux4g-radio-input
|
| Control |
ux4g-radio-control
|
| Mark |
ux4g-radiomark
|
| Content |
ux4g-radio-content
|
| Header |
ux4g-radio-header
|
| Label |
ux4g-radio-label
|
| Description |
ux4g-radio-description
|
| Required |
ux4g-radio-required
|
| Icon |
ux4g-radio-icon
|
| Helper |
ux4g-radio-desc-helper
|
| Error |
ux4g-radio-desc-error
|
| Warning |
ux4g-radio-desc-warning
|
| Success |
ux4g-radio-desc-success
|
| State |
ux4g-radio-error
|
Radio Button presents a list of mutually exclusive options where users can make exactly one selection from the group. It supports user interaction by allowing the selection of a single choice out of multiple predefined items, ensuring that users can easily define precise preferences, answer single choice binary questions, and submit forms with distinct clarity.
A compact tour of the radio patterns used across the source-backed stories.
Quickly copy the radio classes used by the showcased source-backed variants.
| Purpose | Class |
|---|---|
| Base |
ux4g-radio
|
| Input |
ux4g-radio-input
|
| Control |
ux4g-radio-control
|
| Mark |
ux4g-radiomark
|
| Content |
ux4g-radio-content
|
| Header |
ux4g-radio-header
|
| Label |
ux4g-radio-label
|
| Description |
ux4g-radio-description
|
| Required |
ux4g-radio-required
|
| Icon |
ux4g-radio-icon
|
| Helper |
ux4g-radio-desc-helper
|
| Error |
ux4g-radio-desc-error
|
| Warning |
ux4g-radio-desc-warning
|
| Success |
ux4g-radio-desc-success
|
| State |
ux4g-radio-error
|
Radio Button presents a list of mutually exclusive options where users can make exactly one selection from the group. It supports user interaction by allowing the selection of a single choice out of multiple predefined items, ensuring that users can easily define precise preferences, answer single choice binary questions, and submit forms with distinct clarity.
A compact tour of the radio patterns used across the source-backed stories.
Quickly copy the radio classes used by the showcased source-backed variants.
| Purpose | Class |
|---|---|
| Base |
ux4g-radio
|
| Input |
ux4g-radio-input
|
| Control |
ux4g-radio-control
|
| Mark |
ux4g-radiomark
|
| Content |
ux4g-radio-content
|
| Header |
ux4g-radio-header
|
| Label |
ux4g-radio-label
|
| Description |
ux4g-radio-description
|
| Required |
ux4g-radio-required
|
| Icon |
ux4g-radio-icon
|
| Helper |
ux4g-radio-desc-helper
|
| Error |
ux4g-radio-desc-error
|
| Warning |
ux4g-radio-desc-warning
|
| Success |
ux4g-radio-desc-success
|
| State |
ux4g-radio-error
|