ShapeYourPath
(current)
Run Code
Live Code Editor- Bootstrap 5 Radio Button group
Source Code
<!DOCTYPE html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="description" content=""> <!-- Bootstrap CSS --> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" /> <title>Bootstrap 5 Radio Outline Button Group</title> </head> <body> <div class="container mt-5"> <h1 class="my-3">Bootstrap 5 Radio Outline Button group</h1> <p> Bootstrap 5 radio button group can be created easily by placing the radio button and label inside the container having class .btn-group. Add the .btn-check class to every radio button's element base class and the .btn & .btn-outline-* class to the label element's base class. </p> <div class="btn-group" role="group" aria-label="Basic radio toggle button group"> <input type="radio" class="btn-check" name="btnradio" id="btnradio1" autocomplete="off" checked /> <label class="btn btn-outline-primary" for="btnradio1">Radio 1</label> <input type="radio" class="btn-check" name="btnradio" id="btnradio2" autocomplete="off" /> <label class="btn btn-outline-primary" for="btnradio2">Radio 2</label> <input type="radio" class="btn-check" name="btnradio" id="btnradio3" autocomplete="off" /> <label class="btn btn-outline-primary" for="btnradio3">Radio 3</label> </div> </div> <!--/container--> <!-- Option 1: Bootstrap Bundle with Popper --> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js"></script> </body> </html>
Output :
Running