Categories
HTML

How to create a toggle button in Bootstrap?

Spread the love

Sometimes, we want to create a toggle button in Bootstrap.

In this article, we’ll look at how to create a toggle button in Bootstrap.

How to create a toggle button in Bootstrap?

To create a toggle button in Bootstrap, we add the data-toggle attribute to a button.

For instance, we write

<button type="button" class="btn btn-primary" data-toggle="button">
  Single toggle
</button>

to add data-toggle="button" into the button to make the button a toggle button with Bootstrap.

Conclusion

To create a toggle button in Bootstrap, we add the data-toggle attribute to a button.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *