Bootstrap 5 Crash Course Tutorial #4 - Buttons & Button Groups

Net Ninja · Beginner ·🌐 Frontend Engineering ·5y ago

Key Takeaways

Demonstrates Bootstrap 5 button and button group classes

Full Transcript

all right then so the first real and probably most simple component that i want to show you is the bottom components now if we take a look at the button on the docs we can see at a glance there's loads of different button styles that we can use and different button sizes too and we can take advantage of the different theme colors for these buttons as well they're really easy to set up and they only use a couple of different classes so let's take a look at a few of them in the code alright so like we said there's loads of variations of buttons we can use so we're going to take a look at a few different examples some basic buttons some anchor tags as buttons different sizes different styles including the outlined one and also button groups so let's start with the basic buttons so i'm going to create a button tag like this first of all and i'll say primary button inside and i'm going to give this a class equal to btn now whatever button we create we always give it this base btn class every button has that and then we can customize it further like colorize it so i could say btn hyphen primary to give it a primary color and if i take a look at this now in the browser we can see this primary button right here and notice it automatically changes the text color to white as well when it has a slightly darker background so let's do another example i'm going to change this to secondary down here and then this to secondary as well and save that preview this and now we can see the gray button right here so we could do that with every different theme color let's also have a look at buttons as anchor tags so this is using the button tag right but any tag can have these button classes including atax so i'm gonna say a dot btn dot btn hyphen info which is another theme color and the href doesn't have to be anything inside here i'll say info anchor tag and save it and preview that and we can see the anchor tag looks the same but now it uses this information color instead and this time because the background's a little bit lighter it doesn't use the white text it keeps it as a darker black text all right so let's do another example i'm going to say button success for this one and change this to success as well save that and preview and we can see the green button awesome so like i said we can use any different tag as a button as long as we have the button class and whatever other class we want to stylize the button all right so these are all the same size buttons right here but we can make them smaller and also larger so if i say down here button and then give this a class of btn and then also a class of btn hyphen and it's going to be lg for a large button and also btn hyphen danger to stylize this remember danger was a theme color and there i'll say large danger button and i'm going to duplicate this so we can show you a small one so instead of lg right here we have small and when we don't apply a size to it it gets the default medium size just like these buttons so this is a larger button this is a smaller button and we'll change danger to warning so it's a different color and we'll say small and oops not the small tag small warning button all right so let's take a look at that and now we can see we have the large button and the small button all right then so let's take a look at the outlined style so i'm going to create down here some more buttons so i'll say button and then btn which is the base class then i'll say btn hyphen outline and then hyphen whatever color i want it to be so primary in our case so that means it's going to be an outline style button and the outline of the button is going to be that primary color so i'll say outlined primary button and then let's do another example down here so instead of primary this time i'll say secondary and also i'm going to make this large because we can apply sizes to these different styles of buttons as well so btn hyphen lg and here i'll say large outlined secondary button save that and preview and now we can see the outline style right here and when we hover over them it gives it the background color and changes the text to white which is nice same for this one but now it's a large button and we can also do the same for small buttons as well if we want to all right so the last thing i want to show you is the button groups and button groups are basically when you've got a series of buttons that belong together so let me show you an example i'm going to create a div first of all with a class of btn hyphen group and then all of the buttons that we're grouping together go inside this button group so i'm going to do anchor tags just for a change and then i'm going to give this a class of btn and also btn hyphen primary to make it the blue color and here i'll say in the href just hash and then as the text will say button one then i'm gonna duplicate these a couple of times so button two and button three so now all of these buttons are inside the button group and when they're inside the button group bootstrap styles the group of buttons a bit differently so if we save this we can see now they're all butted up to each other like that whereas before they have the white space in between them so that is a button group now each of these buttons can also have different colors so i could change this to warning and i could change this down here to success that's still going to work and we can see them all butted up to each other still all right so hopefully that gives you a good idea of how we can use buttons again we can use them on whichever tags we want doesn't have to be a button tag and we always use this base button class but then combine it with the different style classes to either colorize it or make it outlined or size it differently etc and by the way i'd always recommend checking out the docs for these components as well because there's way more examples of buttons and any other component we might use in this series as well then i'm going to show you so whatever component i might be showing you in this series there's probably at least 10 other ways that you can use it and customize it so definitely play around with different components once you've watched the videos next up though we're going to take a look at some of bootstrap 5's utility classes

Original Description

Hey gang, in this Bootstrap 5 tutorial I'll show you how to use the button classes and the button group component (to group buttons together). 🐱‍👤 View this course in full now - without ads - on Net Ninja Pro: https://netninja.dev/p/bootstrap-5-crash-course 🐱‍💻 Access the course files on GitHub: https://github.com/iamshaunjp/bootstrap-5-tutorial 🐱‍💻 HTML & CSS Crash Course: https://www.youtube.com/watch?v=hu-q2zYwEYs&list=PL4cUxeGkcC9ivBf_eKCPIAYXWzLlPAm6G 🐱‍💻 Node.js Crash Course: https://www.youtube.com/playlist?list=PL4cUxeGkcC9gcy9lrvMJ75z9maRw4byYp 🐱‍💻 SASS Crash Course: https://www.youtube.com/watch?v=St5B7hnMLjg&list=PL4cUxeGkcC9iEwigam3gTjU_7IA3W2WZA 🐱‍💻 VS Code - https://code.visualstudio.com/ 🐱‍💻 Bootstrap 5 Docs - https://getbootstrap.com/docs/5.0/getting-started/download/ 🐱‍💻 Social Links: Facebook - https://www.facebook.com/thenetninjauk Twitter - https://twitter.com/thenetninjauk Instagram - https://www.instagram.com/thenetninja/
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Net Ninja · Net Ninja · 0 of 60

← Previous Next →
1 Regular Expressions (RegEx) Tutorial #14 - Matching a Username
Regular Expressions (RegEx) Tutorial #14 - Matching a Username
Net Ninja
2 Regular Expressions (RegEx) Tutorial #15 - Email RegEx Pattern
Regular Expressions (RegEx) Tutorial #15 - Email RegEx Pattern
Net Ninja
3 Regular Expressions (RegEx) Tutorial #16 - Finishing Touches
Regular Expressions (RegEx) Tutorial #16 - Finishing Touches
Net Ninja
4 GraphQL Tutorial #1 - Introduction to GraphQL
GraphQL Tutorial #1 - Introduction to GraphQL
Net Ninja
5 GraphQL Tutorial #2 - A Birdseye View of GraphQL
GraphQL Tutorial #2 - A Birdseye View of GraphQL
Net Ninja
6 GraphQL Tutorial #3 - Project (stack) Overview
GraphQL Tutorial #3 - Project (stack) Overview
Net Ninja
7 GraphQL Tutorial #4 - Making Queries (front-end preview)
GraphQL Tutorial #4 - Making Queries (front-end preview)
Net Ninja
8 GraphQL Tutorial #5 - Express App Setup
GraphQL Tutorial #5 - Express App Setup
Net Ninja
9 GraphQL Tutorial #6 - Setting up GraphQL
GraphQL Tutorial #6 - Setting up GraphQL
Net Ninja
10 GraphQL Tutorial #7 - GraphQL Schema
GraphQL Tutorial #7 - GraphQL Schema
Net Ninja
11 GraphQL Tutorial #8 - Root Query
GraphQL Tutorial #8 - Root Query
Net Ninja
12 GraphQL Tutorial #9 - The Resolve Function
GraphQL Tutorial #9 - The Resolve Function
Net Ninja
13 GraphQL Tutorial #10 - Testing Queries in Graphiql
GraphQL Tutorial #10 - Testing Queries in Graphiql
Net Ninja
14 GraphQL Tutorial #11 - GraphQL ID Type
GraphQL Tutorial #11 - GraphQL ID Type
Net Ninja
15 GraphQL Tutorial #12 - Author Type
GraphQL Tutorial #12 - Author Type
Net Ninja
16 GraphQL Tutorial #13 - Type Relations
GraphQL Tutorial #13 - Type Relations
Net Ninja
17 GraphQL Tutorial #14 - GraphQL Lists
GraphQL Tutorial #14 - GraphQL Lists
Net Ninja
18 GraphQL Tutorial #15 - More on Root Queries
GraphQL Tutorial #15 - More on Root Queries
Net Ninja
19 GraphQL Tutorial #16 - Connecting to mLab
GraphQL Tutorial #16 - Connecting to mLab
Net Ninja
20 GraphQL Tutorial #17 - Mongoose Models
GraphQL Tutorial #17 - Mongoose Models
Net Ninja
21 GraphQL Tutorial #18 - Mutations
GraphQL Tutorial #18 - Mutations
Net Ninja
22 GraphQL Tutorial #19 - More on Mutations
GraphQL Tutorial #19 - More on Mutations
Net Ninja
23 GraphQL Tutorial #20 - Updating the Resolve Functions
GraphQL Tutorial #20 - Updating the Resolve Functions
Net Ninja
24 GraphQL Tutorial #21 - GraphQL NonNull
GraphQL Tutorial #21 - GraphQL NonNull
Net Ninja
25 GraphQL Tutorial #22 - Adding a Front-end
GraphQL Tutorial #22 - Adding a Front-end
Net Ninja
26 GraphQL Tutorial #23 - Create React App
GraphQL Tutorial #23 - Create React App
Net Ninja
27 GraphQL Tutorial #24 - Book List Component
GraphQL Tutorial #24 - Book List Component
Net Ninja
28 GraphQL Tutorial #25 - Apollo Client Setup
GraphQL Tutorial #25 - Apollo Client Setup
Net Ninja
29 GraphQL Tutorial #26 - Making Queries from React
GraphQL Tutorial #26 - Making Queries from React
Net Ninja
30 GraphQL Tutorial #27 - Rendering Data in a Component
GraphQL Tutorial #27 - Rendering Data in a Component
Net Ninja
31 GraphQL Tutorial #28 - Add Book Component
GraphQL Tutorial #28 - Add Book Component
Net Ninja
32 GraphQL Tutorial #29 - External Query File
GraphQL Tutorial #29 - External Query File
Net Ninja
33 GraphQL Tutorial #30 - Updating Component State
GraphQL Tutorial #30 - Updating Component State
Net Ninja
34 GraphQL Tutorial #31 - Composing Queries
GraphQL Tutorial #31 - Composing Queries
Net Ninja
35 GraphQL Tutorial #32 - query variables
GraphQL Tutorial #32 - query variables
Net Ninja
36 GraphQL Tutorial #33 - Re-fetching Queries
GraphQL Tutorial #33 - Re-fetching Queries
Net Ninja
37 GraphQL Tutorial #34 - Book Details Component
GraphQL Tutorial #34 - Book Details Component
Net Ninja
38 GraphQL Tutorial #36 - Styling the App
GraphQL Tutorial #36 - Styling the App
Net Ninja
39 GraphQL Tutorial #35 - Making a Single Query
GraphQL Tutorial #35 - Making a Single Query
Net Ninja
40 Build Apps with Vue & Firebase - Udemy Course
Build Apps with Vue & Firebase - Udemy Course
Net Ninja
41 Updated Vue & Firebase Course (Udemy)
Updated Vue & Firebase Course (Udemy)
Net Ninja
42 Vue & Firebase Real-time Chat (Preview) #1 - Intro
Vue & Firebase Real-time Chat (Preview) #1 - Intro
Net Ninja
43 Vue & Firebase Real-time Chat (Preview) #2 - Project Structure
Vue & Firebase Real-time Chat (Preview) #2 - Project Structure
Net Ninja
44 Vue & Firebase Real-time Chat (Preview) #3 - Firestore Setup
Vue & Firebase Real-time Chat (Preview) #3 - Firestore Setup
Net Ninja
45 Vue & Firebase Real-time Chat (Preview) #4 - Welcome Screen
Vue & Firebase Real-time Chat (Preview) #4 - Welcome Screen
Net Ninja
46 Vue & Firebase Real-time Chat (Preview) #5 - Props in Routes
Vue & Firebase Real-time Chat (Preview) #5 - Props in Routes
Net Ninja
47 Vue & Firebase Real-time Chat (Preview) #6 - Route Guards
Vue & Firebase Real-time Chat (Preview) #6 - Route Guards
Net Ninja
48 Vue & Firebase Real-time Chat (Preview) #7 - Chat Window
Vue & Firebase Real-time Chat (Preview) #7 - Chat Window
Net Ninja
49 Vue & Firebase Real-time Chat (Preview) #8 - New Message Component
Vue & Firebase Real-time Chat (Preview) #8 - New Message Component
Net Ninja
50 Object Oriented JavaScript Tutorial #1 - Introduction
Object Oriented JavaScript Tutorial #1 - Introduction
Net Ninja
51 Object Oriented JavaScript Tutorial #2 - Object Literals
Object Oriented JavaScript Tutorial #2 - Object Literals
Net Ninja
52 Object Oriented JavaScript Tutorial #3 - Updating Properties
Object Oriented JavaScript Tutorial #3 - Updating Properties
Net Ninja
53 Object Oriented JavaScript Tutorial #4 - Classes
Object Oriented JavaScript Tutorial #4 - Classes
Net Ninja
54 Object Oriented JavaScript Tutorial #5  - Class Constructors
Object Oriented JavaScript Tutorial #5 - Class Constructors
Net Ninja
55 Object Oriented JavaScript Tutorial #6 - Class Methods
Object Oriented JavaScript Tutorial #6 - Class Methods
Net Ninja
56 Object Oriented JavaScript Tutorial #7 - Method Chaining
Object Oriented JavaScript Tutorial #7 - Method Chaining
Net Ninja
57 Object Oriented JavaScript Tutorial #8 - Class Inheritance
Object Oriented JavaScript Tutorial #8 - Class Inheritance
Net Ninja
58 Object Oriented JavaScript Tutorial #9 - Constructors (under the hood)
Object Oriented JavaScript Tutorial #9 - Constructors (under the hood)
Net Ninja
59 Object Oriented JavaScript Tutorial #10 - Prototype
Object Oriented JavaScript Tutorial #10 - Prototype
Net Ninja
60 Object Oriented JavaScript Tutorial #11 - Prototype Inheritance
Object Oriented JavaScript Tutorial #11 - Prototype Inheritance
Net Ninja

Related Reads

📰
Next.js vs Remix vs SvelteKit: Which Framework Should You Learn?
Learn how to choose between Next.js, Remix, and SvelteKit for your next project and why it matters for your career as a developer
Dev.to · Etrit Neziri
📰
Had my Frontend Developer interview with Capgemini (Application Developer) today, and I wanted to…
Prepare for a frontend developer interview with Capgemini by reviewing JavaScript fundamentals and practicing common interview questions
Medium · JavaScript
📰
10 Frontend Developer Tools to Boost Productivity in 2026
Boost frontend productivity with 10 essential tools for modern web app development
Medium · Programming
📰
10 Frontend Developer Tools to Boost Productivity in 2026
Boost frontend productivity with top 10 developer tools in 2026
Medium · JavaScript
Up next
The masks we wear | Zora Krstić | TEDxLuxembourgCity
TEDx Talks
Watch →