Radio
Choose one of several mutually exclusive options.
Usage guide
#Let users choose exactly one mutually exclusive option. Place items inside sy-radio-group and give each a unique value.
Write the error message in the error slot.
Inside the component, add <span slot="error">Error message</span>. You can include links and other guidance as well as text. For inputs supporting noNativeValidity, enable it to show this guidance instead of a browser popup. Switch always displays errors below the component.
Report business rule failures with setCustomError().
For example, if the server rejects a duplicate value, update the error slot and call setCustomError(). This method does not take a message argument. A custom error also blocks form submission.
Clear the error after resolving it and check whether submission is allowed.
Use clearCustomError() to clear a business rule error. Required-field and format validation remain active. await checkValidity() returns true or false; reportValidity() validates and displays errors. Read valid named values through FormData on submission.
Standard option list
Use regular Radio for forms where users read descriptions before choosing.
Button selection
Show short options such as periods or view modes with sy-radio-button. Adjust group direction, size, and style together.
Examples
#Feature examples
#Choose a feature from 26 topics. Explore property settings, method calls, event results, and slot layouts through live examples and code.
No matching features.
API reference
#Hover over a name or focus it with the keyboard to see the code. On touch screens, tap the name.
<sy-radio-group>
Properties
| Attribute / Property | Type | Default | Description |
|---|---|---|---|
boolean | false | Block user interaction and keyboard focus. | |
string | '' | Initially selected value. | |
boolean | false | Display the current value while preventing edits. | |
boolean | false | Fail form validation when no value is provided. | |
'small' | 'medium' | 'large' | 'medium' | Component size. | |
'horizontal' | 'vertical' | 'horizontal' | Item layout direction. | |
'outlined' | 'solid' | 'outlined' | Component display style. | |
string | '' | Field name used in FormData. | |
boolean | false | Use the app's error UI instead of the browser's built-in error display. checkValidity still performs validation. |
Events
| Event | Detail | Description |
|---|---|---|
CustomEvent<{ value: string; isValid: boolean; status: string }> | Emitted when the value or selection state changes. |
Methods
| Method | Returns | Description |
|---|---|---|
Promise<boolean> | Return true if the current constraints are satisfied, otherwise false. | |
Promise<boolean> | Validate the current value and display errors to the user. | |
Promise<void> | Set a custom error state. | |
Promise<void> | Clear the custom error state. | |
Promise<"" | "custom" | "valueMissing"> | Return the current validation state. |
Slots
| Slot | Description |
|---|---|
| Component body or child items. | |
| Validation error message. |
<sy-radio>
Properties
| Attribute / Property | Type | Default | Description |
|---|---|---|---|
boolean | false | Selected or on state. | |
boolean | false | Block user interaction and keyboard focus. | |
boolean | false | Display the current value while preventing edits. | |
string | '' | Current value or item identifier. |
Events
| Event | Detail | Description |
|---|---|---|
CustomEvent<string> | Emitted when the user selects an item. |
Slots
| Slot | Description |
|---|---|
| Component body or child items. |
<sy-radio-button>
Properties
| Attribute / Property | Type | Default | Description |
|---|---|---|---|
boolean | false | Selected or on state. | |
boolean | false | Block user interaction and keyboard focus. | |
string | undefined | Current value or item identifier. | |
'small' | 'medium' | 'large' | 'medium' | Component size. | |
'outlined' | 'solid' | 'outlined' | Component display style. |
Events
| Event | Detail | Description |
|---|---|---|
CustomEvent<string> | Emitted when the user selects an item. |
Slots
| Slot | Description |
|---|---|
| Component body or child items. |