Nearby lessons

11 of 39

🔘 BS5 Buttons

📌 What Are Bootstrap 5 Buttons?

Bootstrap 5 buttons are styled elements used to trigger actions like submitting forms, opening modals, or navigating.

You create them by adding the btn class plus a btn-* variant class (for example btn-primary).

🎨 Button Styles & Color Variants (btn, btn-*)

Start with the base btn class, then add a color class to show the meaning of the action.

Common button variants:

  • btn – basic gray button
  • btn-primary – important primary action
  • btn-secondary – secondary action
  • btn-success – success / positive
  • btn-info – information
  • btn-warning – warning
  • btn-danger – danger / delete
  • btn-dark – dark theme button
  • btn-light – light theme button
  • btn-link – button that looks like a link
🅱️

bootstrap Designer

Live Component Playground

html Source
Loading...
Built with Bootstrap 5.3 • Enterprise Ready

⬛ Outline Buttons (.btn-outline-*)

Outline buttons use a colored border with a transparent background.

They are useful when you want a lighter visual style.

🅱️

bootstrap Designer

Live Component Playground

html Source
Loading...
Built with Bootstrap 5.3 • Enterprise Ready

📏 Button Sizes (.btn-sm, .btn-lg)

Change the size of buttons with:

  • .btn-sm – small button
  • .btn-lg – large button
🅱️

bootstrap Designer

Live Component Playground

html Source
Loading...
Built with Bootstrap 5.3 • Enterprise Ready

🔄 Active & Disabled Buttons (including links)

Buttons can show different states:

  • .active – pressed / toggled on
  • disabled attribute – disables <button> and <input>
  • .disabled class – visually disables a link button (<a>)
🅱️

bootstrap Designer

Live Component Playground

html Source
Loading...
Built with Bootstrap 5.3 • Enterprise Ready

🔁 Spinner Buttons (Loading State)

You can add spinners inside buttons to show loading:

  • .spinner-border – border spinner
  • .spinner-grow – growing spinner
🅱️

bootstrap Designer

Live Component Playground

html Source
Loading...
Built with Bootstrap 5.3 • Enterprise Ready

📚 Block & Full-Width Buttons (d-grid, gap-*)

Use the .d-grid helper class on the parent to make block level, full-width buttons.

Add .gap-* to control the space between multiple buttons.

🅱️

bootstrap Designer

Live Component Playground

html Source
Loading...
Built with Bootstrap 5.3 • Enterprise Ready

👆 Button Tags (a, button, input)

You can apply button styles to different HTML elements:

  • <button> – best for actions
  • <a> – navigation links styled as buttons
  • <input type="submit"> – form submit buttons
🅱️

bootstrap Designer

Live Component Playground

html Source
Loading...
Built with Bootstrap 5.3 • Enterprise Ready

✅ Button Best Practices

  • Use semantic HTML: Prefer <button> for actions, <a> for links.
  • Make labels clear: Button text should describe the action (e.g. “Save”, “Delete”).
  • Show feedback: Use disabled and loading states while actions are in progress.
  • Use colors with meaning: Primary for main actions, danger for destructive actions.

🧠 Test Your Knowledge

3 Questions

Progress: 0 / 3
Keep Going!BS5 Button Groups