B Form Radio Group in Bootstrap Vue: A Comprehensive Guide

Ruth Jul 09, 2026

In the dynamic world of web development, Bootstrap and Vue.js have emerged as powerful tools for creating responsive and interactive user interfaces. When it comes to form elements, the humble radio button group often plays a crucial role in user interactions. In this article, we'll delve into the integration of Bootstrap and Vue.js to create a functional and stylish radio group using the <b-form-radio> component.

Last PL:RADIO 280724
Last PL:RADIO 280724

Before we dive into the code, let's briefly understand why combining these libraries can be beneficial. Bootstrap brings a wealth of pre-designed components and responsive styles, while Vue.js offers a flexible and performant way to manage the application's data and behavior. Together, they can significantly speed up the development process and ensure a consistent user experience across various devices.

a woman is sitting in front of a microphone and recording equipment with headphones on
a woman is sitting in front of a microphone and recording equipment with headphones on

Setting Up the Environment

To get started, we'll first need to set up our Vue.js project with Bootstrap. If you haven't already, install Vue CLI using npm (Node Package Manager):

a microphone with the word on air in front of it
a microphone with the word on air in front of it

npm install -g @vue/cli

Next, create a new Vue project and install Bootstrap along with its Vue.js plugin:

three computers are sitting on a desk in an office
three computers are sitting on a desk in an office

vue create my-app

cd my-app

npm install bootstrap-vue bootstrap

three people sitting at a table in front of two computer monitors with microphones around them
three people sitting at a table in front of two computer monitors with microphones around them

Importing Bootstrap and Vue Bootstrap

Once installed, import Bootstrap CSS and Vue Bootstrap in your main.js file:

import 'bootstrap/dist/css/bootstrap.css'

two men and a woman sitting at a table with headphones in front of them
two men and a woman sitting at a table with headphones in front of them

import BootstrapVue from 'bootstrap-vue'

Vue.use(BootstrapVue)

Radio 3 - Listen Live - BBC Sounds
Radio 3 - Listen Live - BBC Sounds
two people sitting at a table in front of microphones with their hands up to the side
two people sitting at a table in front of microphones with their hands up to the side
the 3abn now logo is shown on a blue background with red and yellow lines
the 3abn now logo is shown on a blue background with red and yellow lines
BBC plans ‘Beeb’ voice assistant for its apps and services
BBC plans ‘Beeb’ voice assistant for its apps and services
an old fashioned boombox is shown with the radio on it's front end
an old fashioned boombox is shown with the radio on it's front end
the bbc radio logo is shown in different colors and font styles, including numbers 1 - 5
the bbc radio logo is shown in different colors and font styles, including numbers 1 - 5
a woman wearing headphones standing in front of a microphone
a woman wearing headphones standing in front of a microphone
the bbc radio 1 logo is shown in white on a black background with an oval
the bbc radio 1 logo is shown in white on a black background with an oval
various radio stations are shown in different colors and sizes, including one with the number five
various radio stations are shown in different colors and sizes, including one with the number five
a recording studio with multiple monitors, keyboards and microphones in front of the window
a recording studio with multiple monitors, keyboards and microphones in front of the window
Multi-Channel Internet Radio Hosting: Empowering Broadcast Diversity
Multi-Channel Internet Radio Hosting: Empowering Broadcast Diversity
Radio Broadcast People Recording In Studio Vector
Radio Broadcast People Recording In Studio Vector
Radio Nova dévoile une campagne aussi libre que son antenne
Radio Nova dévoile une campagne aussi libre que son antenne
an old black and white photo of a man showing a woman something on the radio
an old black and white photo of a man showing a woman something on the radio
the sbs logo is shown in black and white
the sbs logo is shown in black and white
the bbc radio 1 logo is shown in black and white
the bbc radio 1 logo is shown in black and white
Interesting Radio & Online Radio & Podcast’s
Interesting Radio & Online Radio & Podcast’s
[Plave] Noah and Bamby
[Plave] Noah and Bamby
BBC RADIO 1 ESSENTIAL MIX (SEPTEMBER 2021)
BBC RADIO 1 ESSENTIAL MIX (SEPTEMBER 2021)
BBC Sounds - The World Tonight - Available Episodes
BBC Sounds - The World Tonight - Available Episodes

Creating the Radio Group Component

Now that our environment is set up, let's create a Vue component for our radio group. In your components folder, create a new file called RadioGroup.vue:

<template>

<b-form-group label="Choose an option" v-slot="{ ariaDescribedby }">

<b-form-radio v-model="selected" name="some-radios" value="option1" :aria-describedby="ariaDescribedby">Option 1</b-form-radio>

<b-form-radio v-model="selected" name="some-radios" value="option2" :aria-describedby="ariaDescribedby">Option 2</b-form-radio>

</b-form-group>

</template>

<script>

export default {

data() {

return {

selected: 'option1'

}

}

</script>

Using the Radio Group Component

Now that we've created our radio group component, let's use it in our App.vue file:

<template>

<div id="app">

<h1>Radio Group Example</h1>

<radio-group></radio-group>

</div>

</template>

With this setup, you should now have a functional and stylish radio group using Bootstrap and Vue.js. The selected option is stored in the 'selected' data property, which you can use to trigger different behaviors or update other parts of your application.

Styling the Radio Group

Bootstrap provides several utility classes to style your radio group. For example, you can add the 'mb-3' class to the <b-form-group> component to add margin-bottom:

<b-form-group label="Choose an option" class="mb-3" v-slot="{ ariaDescribedby }">

Adding Validation

Bootstrap-Vue also offers built-in validation for form components. To add validation to our radio group, we can use the 'isValid' prop and display an error message using the 'invalid-feedback' class:

<b-form-group label="Choose an option" class="mb-3" invalid-feedback="Please select an option" :invalid-feedback="invalidFeedback" v-slot="{ ariaDescribedby }" :state="isValid">

In conclusion, integrating Bootstrap and Vue.js to create a radio group offers a powerful combination of style, functionality, and flexibility. By leveraging the strengths of both libraries, developers can create engaging user interfaces with minimal effort. Happy coding!