Radio
Use Radios to make a selection from a mutually exclusive set of options.
To add the Radio
component to your app:
import {Radio} from '@stripe/ui-extension-sdk/ui';
<Radio label="This is a Radio." />
Radio props
Property | Type |
---|---|
| Optional
If |
| Optional
Controls whether the input is selected. When you pass this prop, you must also pass an |
| Optional
Specifies the initial value that a user can change. |
| Optional
Descriptive text that will be rendered adjacent to the control’s label. |
| Optional
Sets whether or not the element should be disabled. Prevents selection. |
| Optional
Error text that will be rendered below the control. |
| Optional
Specifies the |
| Optional
Visually hides the specified elements. The hidden elements will still be present and visible to screen readers. |
| Optional
Sets whether or not the element is in an invalid state. This is a display-only prop, and will not prevent form submission. |
| Optional
Text that describes the control. Will be both visible and clickable. |
| Optional
Used to collect multiple Radios into a single, mutually exclusive group, for uncontrolled use cases. |
| Optional
Required for controlled inputs. Fires immediately when the input’s value is changed by the user (for example, it fires on every keystroke). Behaves like the browser input event. |
| Optional
If |
| Optional
If |
| Optional
Overrides the default Tab button behavior. Avoid using values other than |
| Optional
Controls the input’s text. When you pass this prop, you must also pass an |
Disabled
You can disable a Radio
component, which prevents changes.
<Radio name="group" label="Ah ah ah" disabled /> <Radio name="group" disabled defaultChecked label="You didn't say the magic word" />
Invalid
Radio
can be invalid.
<Radio label="This is an invalid input" invalid />
State management
Use the Radio
component as an uncontrolled input:
<Radio name="group" label="Have some of Column A" onChange={(e) => { console.log(e.target.checked); }} /> <Radio name="group" label="Try all of Column B" onChange={(e) => { console.log(e.target.checked); }} />