Lesson 33: Checkboxes and Radio Buttons in Bootstrap 5

Checkboxes and radio buttons are two useful components when building list items on a website. Below is how to create checkboxes and radio buttons in Bootstrap 5.

Checkboxes and radio buttons are two useful components when building list items on a website. Below is how to create checkboxes and radio buttons in Bootstrap 5 .

 

Checkbox

Checkboxes are commonly used if you want the user to select any number from a given list of options.

Sample code:

  

Detailed explanation:

To style checkboxes, use the 'wrapper' element with the class="form-check" to ensure proper alignment for labels and checkboxes.

Next, add the class .form-check-labelto the label element, and .form-check-inputformat the checkbox appropriately inside the container .form-check.

 

Use the attribute checkedif you want that checkbox to be checked by default.

For example:

 Bootstrap Example 

Checkboxes

To format a checkbox, use a container element with the class .form-check and add .form-check-label to the labels, and .form-check-input to the input field with type="checkbox".

The form below contains 3 checkboxes. The first option is checked by default and the last one is disabled:

     

 

Radio buttons

Radio buttons are used when you want to restrict users to having only one option in the list. Sample code:

 Option 1  Option 2  Option 3  

 

For example:

 Bootstrap Example 

Button radio

The form below contains 3 radio buttons. The first option is checked by default, the last one is disabled:

     

Selection switch

If you want to format the checkbox as a toggle button like a switch, use the class .form-switchalong with the container .form-check.

Basic code:

  

Above is how to create checkboxes and radio buttons for web and application development. Hopefully, this Bootstrap 5 lesson is helpful to you.

Related posts
  • How to customize Bootstrap with Sass

    bootstrap is a fantastic css framework that can help you create stylish and polished websites. some programmers and development teams find that writing code in bootstrap is easier to edit than regular css.
  • Answering frequently asked questions about Bootstrap

    bootstrap is a popular web and application development tool. to help you understand it better, tipsmake.com will compile and answer frequently asked questions about bootstrap.
  • Lesson 41: Grid Medium in Bootstrap 5

    in the previous bootstrap 5 lesson, you learned how to create grids with classes for small screens. however, on medium-sized devices with better designs, the grid is often divided 50%/50%.
  • Lesson 40: Small Grid in Bootstrap 5

    continuing our lesson on grids in bootstrap 5, we'll learn how to create the simplest small grid. basically, creating a small grid using bootstrap 5 isn't difficult.
  • Lesson 1: What is Bootstrap 5? How to get started?

    using bootstrap 5 isn't too difficult. this article will tell you what bootstrap 5 is and how to use it.
  • Update the latest Bootstrap

    with the latest version, bootstrap 5.3.0, this framework has introduced a set of exciting new features and powerful improvements for multi-purpose web and app development.
Other Program articles
  • Lesson 32: Selection Menus in Bootstrap 5

    bootstrap 5 sẽ giúp bạn thêm tính năng hoặc thiết kế lại ô lựa chọn cho web. dưới đây là cách tạo menu lựa chọn trong bootstrap 5.
  • Lesson 31: Creating Forms in Bootstrap 5

    form trong bootstrap 5 giúp lập trình viên dễ dàng xây dựng các biểu mẫu cho web. dưới đây là cách tạo form bằng bootstrap 5.
  • Lesson 30: Flexing in Bootstrap 5

    Điểm khác biệt lớn nhất giữa bootstrap 3 và bootstrap 4 & 5 là bootstrap 5 hiện dùng flexbox, thay cho các float để xử lý bố cục.
  • Lesson 29: Utilities in Bootstrap 5

    utilities trong bootstrap 5 cho bạn rất nhiều class tiện ích/trợ giúp để tạo kiểu các phần tử thật nhanh mà không cần dùng tới code css.
  • Lesson 28: Offcanvas in Bootstrap 5

    offcanvas hay menu trượt ngang có thể dễ dàng tạo trong bootstrap 5. dưới đây là cách làm menu ngang hay offcanvas bằng bootstrap 5.
  • Lesson 27: Scrollspy in Bootstrap 5

    scrollspy là hiệu ứng hiển thị từng nội dung khi cuộn chuột. và bạn có thể tạo scrollspy dễ dàng trong bootstrap 5.
Category

System

Windows XP

Windows Server 2012

Windows 8

Windows 7

Windows 10

Wifi tips

Virus Removal - Spyware

Speed ​​up the computer

Server

Security solution

Mail Server

LAN - WAN

Ghost - Install Win

Fix computer error

Configure Router Switch

Computer wallpaper

Computer security

Mac OS X

Mac OS System software

Mac OS Security

Mac OS Office application

Mac OS Email Management

Mac OS Data - File

Mac hardware

Hardware

USB - Flash Drive

Speaker headset

Printer

PC hardware

Network equipment

Laptop hardware

Computer components

Advice Computer

Game

PC game

Online game

Mobile Game

Pokemon GO

information

Technology story

Technology comments

Quiz technology

New technology

British talent technology

Attack the network

Artificial intelligence

Technology

Smart watches

Raspberry Pi

Linux

Camera

Basic knowledge

Banking services

SEO tips

Science

Strange story

Space Science

Scientific invention

Science Story

Science photo

Science and technology

Medicine

Health Care

Fun science

Environment

Discover science

Discover nature

Archeology

Life

Travel Experience

Tips

Raise up child

Make up

Life skills

Home Care

Entertainment

DIY Handmade

Cuisine

Christmas

Application

Web Email

Website - Blog

Web browser

Support Download - Upload

Software conversion

Social Network

Simulator software

Online payment

Office information

Music Software

Map and Positioning

Installation - Uninstall

Graphic design

Free - Discount

Email reader

Edit video

Edit photo

Compress and Decompress

Chat, Text, Call

Archive - Share

Electric

Water heater

Washing machine

Television

Machine tool

Fridge

Fans

Air conditioning

Program

Unix and Linux

SQL Server

SQL

Python

Programming C

PHP

NodeJS

MongoDB

jQuery

JavaScript

HTTP

HTML

Git

Database

Data structure and algorithm

CSS and CSS3

C ++

C #

AngularJS

Mobile

Wallpapers and Ringtones

Tricks application

Take and process photos

Storage - Sync

Security and Virus Removal

Personalized

Online Social Network

Map

Manage and edit Video

Data

Chat - Call - Text

Browser and Add-on

Basic setup