Files
webawesome/docs/components/radio.md

35 lines
983 B
Markdown
Raw Normal View History

2020-07-15 17:30:37 -04:00
# Radio
[component-header:sl-radio]
Radios allow the user to select one option from a group of many.
2021-04-09 08:15:33 -04:00
Radios are designed to be used with [radio groups](/components/radio-group). As such, all of the examples on this page utilize them to demonstrate their correct usage.
2020-07-15 17:30:37 -04:00
```html preview
2021-04-09 08:15:33 -04:00
<sl-radio-group label="Select an option" no-fieldset>
<sl-radio value="1" checked>Option 1</sl-radio>
<sl-radio value="2">Option 2</sl-radio>
<sl-radio value="3">Option 3</sl-radio>
</sl-radio-group>
2020-07-15 17:30:37 -04:00
```
2021-05-13 09:11:24 -04:00
?> This component doesn't work with standard forms. Use [`<sl-form>`](/components/form) instead.
2020-07-15 17:30:37 -04:00
## Examples
### Disabled
2021-04-09 08:15:33 -04:00
Use the `disabled` attribute to disable a radio.
2020-07-15 17:30:37 -04:00
```html preview
2021-04-09 08:15:33 -04:00
<sl-radio-group label="Select an option" no-fieldset>
<sl-radio value="1" checked>Option 1</sl-radio>
<sl-radio value="2">Option 2</sl-radio>
<sl-radio value="3">Option 3</sl-radio>
<sl-radio value="4" disabled>Disabled</sl-radio>
</sl-radio-group>
2020-07-15 17:30:37 -04:00
```
[component-metadata:sl-radio]