Radio Button
BsRadio is a component that let users select one option from a set of options.
Overview
BsRadio component mimics the HTML5 <input type="radio"> element. This means that you can add attributes like required, readonly, or disabled and it will react to them to give the best experience. You can also use v-model directive to create two-way data bindings on the model-value property.
Radio Group
BsRadioGroup is a collection of BsRadio. Rather than create multiple <bs-radio>, it's better to create single <bs-radio-group>. <bs-radio-group> can be integrated with external validator plugin such as Vuelidate.
INFO
<bs-radio-group> will be displayed in one column if the media query matches (max-width: 575px). And if the media query matches (min-width: 576px) it will try to fit up to four columns.
Multi Column
With <bs-radio-group>, collection of <bs-radio> can be arranged in multi-columns. When the number of <bs-radio> exceed the number of maximum columns, then the remaining <bs-radio> will be placed on the next row.
INFO
Multi columns are closely tied to the bootstrap class col-lg-*. Which means if the media query matches (min-width: 992px), it will be displayed correctly. And if the media query matches (min-width: 768px), it will be displayed in two columns only.
Colors
Use color property to change <bs-radio> or <bs-radio-group> color appearance. Additionally, you can set each radio of <bs-radio-group> to have different color.
CSS Variables
As CSS technology evolves, Vue MDBootstrap introduces local CSS variables on .md-radio for better customization.
.md-radio {
--md-radio-size: #{vars.$radio-size};
--md-radio-touch-size: #{vars.$radio-touch-size};
--md-radio-stroke: #{vars.$radio-stroke};
--md-radio-margin: #{vars.$radio-margin};
--md-radio-color: currentColor;
--md-radio-active-color: #{$color};
--md-radio-disabled-bg: transparent;
--md-radio-disabled-opacity: var(--md-field-disabled-opacity);
}API Reference
BsRadio
BsRadioGroup
TRadioInputProps
| Property | Type | Description |
|---|---|---|
| value required | String|Number | The <bs-radio> value. |
| label required | String | The <bs-radio> label. |
| color | String | The <bs-radio> color appearance. Updated in v2.2.0 Built-in color variants are: default, primary, secondary, success, warning, danger and info. |
| disabled | Boolean | Create <bs-radio> in disabled state. |
| readonly | Boolean | Create <bs-radio> in readonly state. |
| id | String | Sets the <bs-radio> element ID attribute. This property value is auto generates. |
| name | Boolean | Sets the <bs-radio> element name attribute. |
