Skip to content

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.

Select an option
Value:

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.

Selected color:


Selected fruit:

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.

Updated on v2.0.0
Selected item:

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.


TIP

Any MDBootstrap Color variants and Material Color variants can be applied to the color property.

CSS Variables

Added since v2.0.0
scss
--md-radio-margin: .5rem 1rem .5rem 0;
--md-radio-size: 20px;
--md-radio-stroke: 2px;
--md-radio-touch-size: 40px;
--md-radio-disabled-bg: transparent;
--md-radio-disabled-opacity: calc(var(--md-field-disabled-opacity) - .2);

--md-radio-color: currentColor;
--md-radio-active-color: #{$color};

API Reference

BsRadio

BsRadioGroup

TRadioProps

The TRadioProps has properties as described below:

PropertyTypeDescription
value requiredString/NumberThe <bs-radio> value.
label requiredStringThe <bs-radio> label.
colorStringThe <bs-radio> color appearance.
disabledBooleanCreate <bs-radio> in disabled state.
readonlyBooleanCreate <bs-radio> in readonly state.
idStringSets the <bs-radio> element ID attribute. This property value is auto generates.
nameBooleanSets the <bs-radio> element name attribute.

Released under the BSD-3-Clause License.