Category: Courses

Courses

  • Lesson 29: Adding Interactive Components (Forms, Modals, Sliders) in Bootstrap

    ๐Ÿ“Œ Objective: Learn how to add interactive UI components like forms, modals, and sliders to enhance user experience.


    ๐Ÿ”น 1. Why Add Interactive Components?

    Interactive components make a website more engaging and user-friendly.

    ๐Ÿ’ก Key Benefits:
    โœ”๏ธ Enhances user experience โ€“ Forms for data collection, modals for popups.
    โœ”๏ธ Reduces page reloads โ€“ Users can interact without navigating away.
    โœ”๏ธ Improves engagement โ€“ Sliders & animations keep users interested.


    ๐Ÿ”น 2. Adding Forms for User Input

    Forms allow users to submit data like contact information or feedback.

    1๏ธโƒฃ Creating a Basic Bootstrap Form

    โœ… Example: Contact Form

    html
    <section class="container mt-5">
    <h2>Contact Us</h2>
    <form>
    <div class="mb-3">
    <label class="form-label">Your Name</label>
    <input type="text" class="form-control" placeholder="Enter your name">
    </div>
    <div class="mb-3">
    <label class="form-label">Your Email</label>
    <input type="email" class="form-control" placeholder="Enter your email">
    </div>
    <div class="mb-3">
    <label class="form-label">Message</label>
    <textarea class="form-control" rows="4" placeholder="Enter your message"></textarea>
    </div>
    <button type="submit" class="btn btn-primary">Send Message</button>
    </form>
    </section>

    ๐Ÿ”น What happens?

    • The form collects user data and provides a submit button.

    2๏ธโƒฃ Form Validation & Error Handling

    โœ… Example: Bootstrap Form with Validation

    html
    <form class="needs-validation" novalidate>
    <div class="mb-3">
    <label class="form-label">Email</label>
    <input type="email" class="form-control" required>
    <div class="invalid-feedback">Please enter a valid email.</div>
    </div>
    <button type="submit" class="btn btn-success">Submit</button>
    </form>

    <script>
    document.querySelector("form").addEventListener("submit", function(event) {
    if (!this.checkValidity()) {
    event.preventDefault();
    this.classList.add("was-validated");
    }
    });
    </script>

    ๐Ÿ”น What happens?

    • If the email field is empty, an error message appears.

    ๐Ÿ”น 3. Adding Bootstrap Modals (Popups)

    Modals are pop-up dialogs used for alerts, forms, or additional content.

    1๏ธโƒฃ Creating a Simple Modal

    โœ… Example: Bootstrap Modal

    html
    <!-- Button to Open Modal -->
    <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#myModal">
    Open Modal
    </button>

    <!-- Modal Structure -->
    <div class="modal fade" id="myModal">
    <div class="modal-dialog">
    <div class="modal-content">
    <div class="modal-header">
    <h5 class="modal-title">My Bootstrap Modal</h5>
    <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
    </div>
    <div class="modal-body">
    This is a simple Bootstrap modal!
    </div>
    </div>
    </div>
    </div>

    ๐Ÿ”น What happens?

    • Clicking the button triggers the modal popup.

    2๏ธโƒฃ Using Modals for Forms

    โœ… Example: Contact Form Inside a Modal

    html
    <!-- Button to Open Modal -->
    <button type="button" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#contactModal">
    Contact Us
    </button>

    <!-- Modal -->
    <div class="modal fade" id="contactModal">
    <div class="modal-dialog">
    <div class="modal-content">
    <div class="modal-header">
    <h5 class="modal-title">Contact Us</h5>
    <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
    </div>
    <div class="modal-body">
    <form>
    <div class="mb-3">
    <label class="form-label">Your Name</label>
    <input type="text" class="form-control" placeholder="Enter your name">
    </div>
    <div class="mb-3">
    <label class="form-label">Your Email</label>
    <input type="email" class="form-control" placeholder="Enter your email">
    </div>
    <button type="submit" class="btn btn-primary">Send</button>
    </form>
    </div>
    </div>
    </div>
    </div>

    ๐Ÿ”น What happens?

    • The modal contains a contact form, improving user experience.

    ๐Ÿ”น 4. Adding Bootstrap Sliders (Carousels)

    A slider (carousel) rotates images or content automatically.

    1๏ธโƒฃ Basic Image Carousel

    โœ… Example: Bootstrap Image Slider

    html
    <div id="imageCarousel" class="carousel slide" data-bs-ride="carousel">
    <div class="carousel-inner">
    <div class="carousel-item active">
    <img src="https://via.placeholder.com/800x400" class="d-block w-100" alt="Slide 1">
    </div>
    <div class="carousel-item">
    <img src="https://via.placeholder.com/800x400" class="d-block w-100" alt="Slide 2">
    </div>
    </div>
    <button class="carousel-control-prev" type="button" data-bs-target="#imageCarousel" data-bs-slide="prev">
    <span class="carousel-control-prev-icon"></span>
    </button>
    <button class="carousel-control-next" type="button" data-bs-target="#imageCarousel" data-bs-slide="next">
    <span class="carousel-control-next-icon"></span>
    </button>
    </div>

    ๐Ÿ”น What happens?

    • The slider cycles through images automatically.
    • Navigation buttons allow users to move between slides.

    2๏ธโƒฃ Adding Captions & Indicators

    โœ… Example: Slider with Captions

    html
    <div id="captionCarousel" class="carousel slide" data-bs-ride="carousel">
    <div class="carousel-indicators">
    <button type="button" data-bs-target="#captionCarousel" data-bs-slide-to="0" class="active"></button>
    <button type="button" data-bs-target="#captionCarousel" data-bs-slide-to="1"></button>
    </div>

    <div class="carousel-inner">
    <div class="carousel-item active">
    <img src="https://via.placeholder.com/800x400" class="d-block w-100" alt="Slide 1">
    <div class="carousel-caption">
    <h5>First Slide</h5>
    <p>Example caption for Slide 1</p>
    </div>
    </div>
    <div class="carousel-item">
    <img src="https://via.placeholder.com/800x400" class="d-block w-100" alt="Slide 2">
    <div class="carousel-caption">
    <h5>Second Slide</h5>
    <p>Example caption for Slide 2</p>
    </div>
    </div>
    </div>
    </div>

    ๐Ÿ”น What happens?

    • Each slide has captions and navigation indicators.

    ๐Ÿ“ Lesson Recap Quiz

    ๐ŸŽฏ Test your knowledge of Bootstrap interactive components.

    ๐Ÿ“Œ Multiple-Choice Questions (MCQs)

    1๏ธโƒฃ What Bootstrap component is used for popups?
    a) .popup-box
    b) .modal
    c) .alert
    d) .tooltip

    โœ… Correct Answer: b) .modal


    2๏ธโƒฃ What Bootstrap class adds form validation?
    a) .form-check
    b) .form-validate
    c) .was-validated
    d) .needs-validation

    โœ… Correct Answer: d) .needs-validation


    ๐ŸŽฏ Practical Challenge

    โœ… Build a contact form with validation.
    โœ… Create a modal popup with a form inside.
    โœ… Add a Bootstrap slider with captions and navigation buttons.
    โœ… Post your solution in the discussion forum for feedback!

  • Lesson 28: Building the Homepage & Navigation

    ๐Ÿ“Œ Objective: Learn how to build a fully responsive homepage with Bootstrap navigation, hero section, and call-to-action buttons.


    ๐Ÿ”น 1. Homepage Structure & Key Components

    A well-designed homepage includes:
    1๏ธโƒฃ Navigation Bar โ€“ Provides links to key pages.
    2๏ธโƒฃ Hero Section โ€“ Showcases a headline & call-to-action (CTA).
    3๏ธโƒฃ About/Features Section โ€“ Describes the websiteโ€™s purpose.
    4๏ธโƒฃ Testimonials/Portfolio โ€“ Builds trust with users.
    5๏ธโƒฃ Contact Section โ€“ Allows visitors to reach out.

    โœ… Example: Homepage Layout

    markdown
    -------------------------------------------------
    | LOGO | NAVBAR (Home, About, Services) |
    -------------------------------------------------

    | HERO SECTION (Image + Headline + CTA) |
    -------------------------------------------------

    | ABOUT / FEATURES |
    -------------------------------------------------

    | TESTIMONIALS / PORTFOLIO |
    -------------------------------------------------

    | CONTACT FORM |
    -------------------------------------------------

    | FOOTER |
    -------------------------------------------------

    ๐Ÿ”น What happens?

    • The layout follows a structured flow for better user experience.

    ๐Ÿ”น 2. Creating the Navigation Bar

    Bootstrap makes it easy to create a responsive navbar.

    โœ… Example: Bootstrap Navigation Bar

    html
    <nav class="navbar navbar-expand-lg navbar-light bg-light">
    <div class="container">
    <a class="navbar-brand" href="#">MyWebsite</a>
    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
    <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav ms-auto">
    <li class="nav-item"><a class="nav-link active" href="#home">Home</a></li>
    <li class="nav-item"><a class="nav-link" href="#about">About</a></li>
    <li class="nav-item"><a class="nav-link" href="#services">Services</a></li>
    <li class="nav-item"><a class="nav-link" href="#contact">Contact</a></li>
    </ul>
    </div>
    </div>
    </nav>

    ๐Ÿ”น What happens?

    • The logo is on the left, and links are on the right.
    • The menu collapses into a hamburger icon on mobile.

    ๐Ÿ”น 3. Creating a Hero Section

    A hero section grabs attention and includes a headline, text, and call-to-action (CTA) buttons.

    โœ… Example: Bootstrap Hero Section

    html
    <section id="home" class="bg-primary text-white text-center p-5">
    <div class="container">
    <h1>Welcome to My Website</h1>
    <p>Your one-stop solution for web development.</p>
    <a href="#services" class="btn btn-light btn-lg">Get Started</a>
    <a href="#contact" class="btn btn-outline-light btn-lg">Contact Us</a>
    </div>
    </section>

    ๐Ÿ”น What happens?

    • The hero section has a background color and CTA buttons.

    ๐Ÿ”น 4. Adding an About/Features Section

    This section introduces your business/services.

    โœ… Example: About/Features Section

    html
    <section id="about" class="container mt-5">
    <div class="row align-items-center">
    <div class="col-md-6">
    <h2>About Us</h2>
    <p>We provide high-quality web development services using modern technologies.</p>
    </div>
    <div class="col-md-6">
    <img src="about-image.jpg" class="img-fluid rounded">
    </div>
    </div>
    </section>

    ๐Ÿ”น What happens?

    • Text is on the left, and an image is on the right.

    ๐Ÿ”น 5. Adding a Services Section

    This section displays key offerings using Bootstrap cards.

    โœ… Example: Services Section

    html
    <section id="services" class="container mt-5">
    <h2 class="text-center">Our Services</h2>
    <div class="row">
    <div class="col-md-4">
    <div class="card p-3">
    <h4>Web Development</h4>
    <p>We create stunning, responsive websites for your business.</p>
    </div>
    </div>
    <div class="col-md-4">
    <div class="card p-3">
    <h4>SEO Optimization</h4>
    <p>Boost your websiteโ€™s visibility on search engines.</p>
    </div>
    </div>
    <div class="col-md-4">
    <div class="card p-3">
    <h4>Digital Marketing</h4>
    <p>Increase engagement with targeted digital campaigns.</p>
    </div>
    </div>
    </div>
    </section>

    ๐Ÿ”น What happens?

    • Services are displayed in a responsive grid using Bootstrap cards.

    ๐Ÿ”น 6. Adding Testimonials (Optional)

    A testimonial section builds trust with new visitors.

    โœ… Example: Testimonials Section

    html
    <section id="testimonials" class="bg-light p-5">
    <div class="container text-center">
    <h2>What Our Clients Say</h2>
    <blockquote class="blockquote">
    <p>"Amazing service! Our website traffic increased by 200%!"</p>
    <footer class="blockquote-footer">John Doe, CEO</footer>
    </blockquote>
    </div>
    </section>

    ๐Ÿ”น What happens?

    • Testimonials improve credibility and social proof.

    ๐Ÿ”น 7. Adding a Contact Section

    A contact form allows visitors to reach out.

    โœ… Example: Bootstrap Contact Form

    html
    <section id="contact" class="container mt-5">
    <h2>Contact Us</h2>
    <form>
    <div class="mb-3">
    <label class="form-label">Your Name</label>
    <input type="text" class="form-control">
    </div>
    <div class="mb-3">
    <label class="form-label">Your Email</label>
    <input type="email" class="form-control">
    </div>
    <div class="mb-3">
    <label class="form-label">Message</label>
    <textarea class="form-control" rows="4"></textarea>
    </div>
    <button type="submit" class="btn btn-primary">Send Message</button>
    </form>
    </section>

    ๐Ÿ”น What happens?

    • A simple contact form is included with name, email, and message fields.

    ๐Ÿ”น 8. Adding a Footer

    A footer provides essential links and social media icons.

    โœ… Example: Footer Section

    html
    <footer class="bg-dark text-white text-center p-3 mt-5">
    <p>&copy; 2025 MyWebsite. All rights reserved.</p>
    </footer>

    ๐Ÿ”น What happens?

    • A simple footer is added at the bottom of the page.

    ๐Ÿ“ Lesson Recap Quiz

    ๐ŸŽฏ Test your knowledge of Bootstrap homepage building.

    ๐Ÿ“Œ Multiple-Choice Questions (MCQs)

    1๏ธโƒฃ What is the purpose of a hero section?
    a) Display testimonials
    b) Introduce the website with a headline & CTA
    c) List services
    d) Show a footer

    โœ… Correct Answer: b) Introduce the website with a headline & CTA


    2๏ธโƒฃ What Bootstrap class makes a navbar collapse on mobile?
    a) .navbar-mobile
    b) .navbar-small
    c) .navbar-collapse
    d) .navbar-hide

    โœ… Correct Answer: c) .navbar-collapse


    ๐Ÿ“Œ True or False

    3๏ธโƒฃ The contact form requires Bootstrap JavaScript to function.
    โœ… Answer: False

    4๏ธโƒฃ The homepage should include a clear call-to-action (CTA).
    โœ… Answer: True


    ๐ŸŽฏ Practical Challenge

    โœ… Build a complete homepage with Bootstrap.
    โœ… Add a responsive navbar, hero section, and services section.
    โœ… Include a contact form and footer.
    โœ… Post your solution in the discussion forum for feedback!


    ๐ŸŽ“ Lesson Summary

    โœ… The homepage includes navigation, hero, services, testimonials, and contact sections.
    โœ… Bootstrap components like cards, buttons, and grids help structure the page.
    โœ… A responsive navbar ensures easy mobile navigation.

  • Lesson 27: Planning & Wireframing a Bootstrap Website

    ๐Ÿ“Œ Objective: Learn how to plan, wireframe, and prototype a website before building it with Bootstrap.


    ๐Ÿ”น 1. Introduction to Website Planning

    Before coding a website, itโ€™s important to plan the structure, layout, and features.

    ๐Ÿ’ก Why Plan & Wireframe First?
    โœ”๏ธ Saves time โ€“ Avoid unnecessary revisions.
    โœ”๏ธ Improves user experience โ€“ Ensures a clear navigation structure.
    โœ”๏ธ Enhances collaboration โ€“ Helps designers and developers stay aligned.


    ๐Ÿ”น 2. Steps to Plan a Bootstrap Website

    1๏ธโƒฃ Define Website Goals

    Before designing, ask:

    • What is the purpose of the website? (e.g., business, blog, e-commerce)
    • Who is the target audience?
    • What features are needed? (e.g., contact form, testimonials, navbar)

    โœ… Example: Goals for a Portfolio Website

    • Showcase projects and skills.
    • Provide contact information.
    • Have a simple, mobile-friendly design.

    2๏ธโƒฃ Create a Sitemap

    A sitemap is a visual representation of the websiteโ€™s pages.

    โœ… Example: Sitemap for a Portfolio Website

    Home
    โ”œโ”€โ”€ About
    โ”œโ”€โ”€ Projects
    โ”‚ โ”œโ”€โ”€ Project 1
    โ”‚ โ”œโ”€โ”€ Project 2
    โ”‚ โ”œโ”€โ”€ Project 3
    โ”œโ”€โ”€ Blog
    โ”œโ”€โ”€ Contact

    ๐Ÿ”น What happens?

    • The sitemap helps plan which pages to include.

    3๏ธโƒฃ Choose a Bootstrap Layout

    Bootstrap offers predefined grid layouts:

    โœ… Common Bootstrap Layout Choices:

    • Single-page layout (for portfolios & landing pages)
    • Multi-page layout (for blogs & businesses)
    • Dashboard layout (for admin panels)

    ๐Ÿ”น 3. Wireframing a Bootstrap Website

    A wireframe is a basic sketch of a websiteโ€™s layout.

    โœ… Best Wireframing Tools:

    • Pen & Paper โ€“ Quick & simple.
    • Figma โ€“ Free, web-based design tool.
    • Balsamiq โ€“ Easy low-fidelity wireframing.
    • Adobe XD โ€“ Professional UI/UX design tool.

    1๏ธโƒฃ Example Wireframe for a Portfolio Website

    markdown
    -------------------------------------------------
    | LOGO | NAVBAR (Home, About, Work) |
    -------------------------------------------------

    | HERO SECTION (Image + Headline + CTA) |
    -------------------------------------------------

    | ABOUT ME (Text + Image) |
    -------------------------------------------------

    | PROJECTS (Grid of 3 projects) |
    -------------------------------------------------

    | CONTACT FORM |
    -------------------------------------------------

    | FOOTER |
    -------------------------------------------------

    ๐Ÿ”น What happens?

    • The wireframe helps visualize where elements should go.

    ๐Ÿ”น 4. Converting a Wireframe into Bootstrap Code

    1๏ธโƒฃ Building a Navbar

    โœ… Example: Bootstrap Navbar

    html
    <nav class="navbar navbar-expand-lg navbar-light bg-light">
    <div class="container">
    <a class="navbar-brand" href="#">My Portfolio</a>
    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
    <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav">
    <li class="nav-item"><a class="nav-link" href="#about">About</a></li>
    <li class="nav-item"><a class="nav-link" href="#projects">Projects</a></li>
    <li class="nav-item"><a class="nav-link" href="#contact">Contact</a></li>
    </ul>
    </div>
    </div>
    </nav>

    ๐Ÿ”น What happens?

    • A responsive navigation menu is created.

    2๏ธโƒฃ Building a Hero Section

    โœ… Example: Bootstrap Hero Section

    html
    <section class="bg-primary text-white text-center p-5">
    <h1>Welcome to My Portfolio</h1>
    <p>Frontend Developer | UI Designer</p>
    <a href="#projects" class="btn btn-light">View My Work</a>
    </section>

    ๐Ÿ”น What happens?

    • A hero banner with a button is created.

    3๏ธโƒฃ Creating a Responsive Grid for Projects

    โœ… Example: Bootstrap Project Grid

    html
    <section class="container mt-5">
    <div class="row">
    <div class="col-md-4">
    <div class="card">
    <img src="project1.jpg" class="card-img-top">
    <div class="card-body">
    <h5 class="card-title">Project 1</h5>
    </div>
    </div>
    </div>
    <div class="col-md-4">
    <div class="card">
    <img src="project2.jpg" class="card-img-top">
    <div class="card-body">
    <h5 class="card-title">Project 2</h5>
    </div>
    </div>
    </div>
    </div>
    </section>

    ๐Ÿ”น What happens?

    • The grid layout adapts to different screen sizes.

    4๏ธโƒฃ Adding a Contact Form

    โœ… Example: Bootstrap Contact Form

    html
    <section class="container mt-5">
    <h2>Contact Me</h2>
    <form>
    <div class="mb-3">
    <label class="form-label">Your Name</label>
    <input type="text" class="form-control">
    </div>
    <div class="mb-3">
    <label class="form-label">Your Email</label>
    <input type="email" class="form-control">
    </div>
    <button type="submit" class="btn btn-primary">Send Message</button>
    </form>
    </section>

    ๐Ÿ”น What happens?

    • A simple contact form is added.

    ๐Ÿ”น 5. Testing the Wireframe with Bootstrap

    โœ… Testing the Layout on Different Devices

    • Use Chrome DevTools (F12) to test responsiveness.
    • Adjust columns (col-md-4, col-lg-6) for better layouts.

    โœ… Example: Adjusting Columns for Mobile

    html
    <div class="col-12 col-md-6 col-lg-4">Project</div>

    ๐Ÿ”น What happens?

    • The layout stacks on small screens and displays in a grid on larger screens.

    ๐Ÿ“ Lesson Recap Quiz

    ๐ŸŽฏ Test your knowledge of planning and wireframing.

    ๐Ÿ“Œ Multiple-Choice Questions (MCQs)

    1๏ธโƒฃ What is the first step in website planning?
    a) Start coding immediately
    b) Define website goals
    c) Download Bootstrap
    d) Design a logo

    โœ… Correct Answer: b) Define website goals


    2๏ธโƒฃ What tool can be used for wireframing?
    a) Photoshop
    b) Figma
    c) Microsoft Word
    d) Bootstrap

    โœ… Correct Answer: b) Figma


    ๐Ÿ“Œ True or False

    3๏ธโƒฃ A wireframe should include detailed colors and images.
    โœ… Answer: False

    4๏ธโƒฃ A sitemap helps define the websiteโ€™s structure.
    โœ… Answer: True


    ๐ŸŽฏ Practical Challenge

    โœ… Create a wireframe for a personal portfolio website.
    โœ… Build a Bootstrap layout based on your wireframe.
    โœ… Adjust columns and sections to be fully responsive.
    โœ… Post your solution in the discussion forum for feedback!


    ๐ŸŽ“ Lesson Summary

    โœ… Website planning includes defining goals, creating a sitemap, and wireframing.
    โœ… Wireframing tools like Figma or Balsamiq help visualize layouts.
    โœ… Bootstrapโ€™s grid system makes layouts responsive.
    โœ… Testing wireframes in Bootstrap ensures a functional design.

  • Lesson 26: Bootstrap with Vue.js (BootstrapVue)

    ๐Ÿ“Œ Objective: Learn how to use Bootstrap with Vue.js, including BootstrapVue, and compare it with other UI frameworks like Vuetify.


    ๐Ÿ”น 1. Introduction to Bootstrap in Vue.js

    Bootstrap is a popular UI framework for building responsive designs. When using Vue.js, BootstrapVue provides Vue-specific components.

    ๐Ÿ’ก Why Use Bootstrap with Vue.js?
    โœ”๏ธ Pre-built responsive UI components.
    โœ”๏ธ Works well with Vueโ€™s reactivity system.
    โœ”๏ธ No need for jQuery โ€“ Fully Vue-friendly.


    ๐Ÿ”น 2. Installing Bootstrap in a Vue Project

    There are two ways to use Bootstrap with Vue.js:

    1๏ธโƒฃ Method 1: Using Bootstrap CDN

    โœ… Add Bootstrapโ€™s CDN to index.html

    html
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">

    ๐Ÿ”น What happens?

    • You can use Bootstrap classes in your Vue templates, but you wonโ€™t have Vue components.

    2๏ธโƒฃ Method 2: Installing Bootstrap via npm

    โœ… Run the following command in your Vue project:

    sh
    npm install bootstrap

    โœ… Import Bootstrap in main.js:

    javascript
    import 'bootstrap/dist/css/bootstrap.min.css';
    import 'bootstrap/dist/js/bootstrap.bundle.min.js';

    ๐Ÿ”น What happens?

    • This allows Bootstrap styles and JavaScript components to work in Vue.

    ๐Ÿ”น 3. Installing & Using BootstrapVue

    BootstrapVue provides Vue components that work with Bootstrap.

    1๏ธโƒฃ Installing BootstrapVue

    โœ… Run the following command:

    sh
    npm install bootstrap-vue

    โœ… Import BootstrapVue in main.js:

    javascript
    import { createApp } from "vue";
    import App from "./App.vue";
    import { BootstrapVue3 } from "bootstrap-vue-3";
    import "bootstrap/dist/css/bootstrap.css";
    import "bootstrap-vue-3/dist/bootstrap-vue-3.css";

    const app = createApp(App);
    app.use(BootstrapVue3);
    app.mount("#app");

    ๐Ÿ”น What happens?

    • BootstrapVue components are now available in your Vue app.

    ๐Ÿ”น 4. Using Bootstrap Components in Vue.js

    Now you can use BootstrapVueโ€™s prebuilt Vue components.

    1๏ธโƒฃ Example: Using BootstrapVue Button

    โœ… Example: Simple BootstrapVue Button

    vue
    <template>
    <b-button variant="primary">Click Me</b-button>
    </template>

    ๐Ÿ”น What happens?

    • The button uses Bootstrapโ€™s primary button styling without needing classes.

    2๏ธโƒฃ Example: BootstrapVue Grid System

    โœ… Example: Responsive Layout

    vue
    <template>
    <b-container>
    <b-row>
    <b-col cols="6" class="bg-primary text-white p-3">Column 1</b-col>
    <b-col cols="6" class="bg-secondary text-white p-3">Column 2</b-col>
    </b-row>
    </b-container>
    </template>

    ๐Ÿ”น What happens?

    • A responsive layout is created with two columns.

    ๐Ÿ”น 5. Using BootstrapVue Forms

    โœ… Example: Form with Validation

    vue
    <template>
    <b-form @submit.prevent="handleSubmit">
    <b-form-group label="Email">
    <b-form-input v-model="email" type="email" required></b-form-input>
    </b-form-group>
    <b-form-group label="Password">
    <b-form-input v-model="password" type="password" required></b-form-input>
    </b-form-group>
    <b-button type="submit" variant="success">Submit</b-button>
    </b-form>
    </template>

    <script>
    export default {
    data() {
    return {
    email: "",
    password: "",
    };
    },
    methods: {
    handleSubmit() {
    alert(`Email: ${this.email}, Password: ${this.password}`);
    },
    },
    };
    </script>

    ๐Ÿ”น What happens?

    • The form validates inputs and displays alerts on submit.

    ๐Ÿ”น 6. BootstrapVue Tables

    BootstrapVue provides custom table components for displaying data.

    โœ… Example: Dynamic Table

    vue
    <template>
    <b-table :items="users" :fields="fields"></b-table>
    </template>

    <script>
    export default {
    data() {
    return {
    fields: ["id", "name", "email"],
    users: [
    { id: 1, name: "Alice", email: "alice@example.com" },
    { id: 2, name: "Bob", email: "bob@example.com" },
    ],
    };
    },
    };
    </script>

    ๐Ÿ”น What happens?

    • The table dynamically displays user data.

    ๐Ÿ”น 7. BootstrapVue vs Vuetify

    BootstrapVue and Vuetify are two popular UI frameworks for Vue.

    Feature BootstrapVue Vuetify
    Design Style Traditional Bootstrap Google Material Design
    Grid System Uses Bootstrap grid Uses Material Design grid
    Components Prebuilt Vue components Advanced Material components
    Customization SCSS variables Uses Theme Provider
    Flexibility Works with any design system Strict Material Design rules

    โœ… Use BootstrapVue if:

    • You want familiar Bootstrap styling.
    • You need easy-to-use responsive layouts.

    โœ… Use Vuetify if:

    • You need a modern Material Design UI.
    • You want advanced Vue-specific components.

    ๐Ÿ”น 8. Adding BootstrapVue Modals

    Modals are popups for forms or alerts.

    โœ… Example: BootstrapVue Modal

    vue
    <template>
    <b-button v-b-modal.modal1>Open Modal</b-button>

    <b-modal id="modal1" title="BootstrapVue Modal">
    <p>Modal content goes here.</p>
    </b-modal>
    </template>

    ๐Ÿ”น What happens?

    • Clicking the button opens a modal dialog.

    ๐Ÿ”น 9. Adding BootstrapVue Alerts

    Alerts are useful for notifications and messages.

    โœ… Example: Alert Message

    vue
    <template>
    <b-alert show variant="danger">Error: Something went wrong!</b-alert>
    </template>

    ๐Ÿ”น What happens?

    • A red error message is displayed.

    ๐Ÿ“ Lesson Recap Quiz

    ๐ŸŽฏ Test your knowledge of BootstrapVue.

    ๐Ÿ“Œ Multiple-Choice Questions (MCQs)

    1๏ธโƒฃ What command installs BootstrapVue?
    a) npm install bootstrap-vue
    b) npm install vue-bootstrap
    c) npm install bootstrapjs-vue
    d) npm install vue-bootstrap-ui

    โœ… Correct Answer: a) npm install bootstrap-vue


    2๏ธโƒฃ What is the main difference between BootstrapVue and Vuetify?
    a) BootstrapVue uses Material Design principles
    b) Vuetify follows Bootstrapโ€™s grid system
    c) BootstrapVue uses Bootstrapโ€™s design, while Vuetify follows Material Design
    d) BootstrapVue requires jQuery

    โœ… Correct Answer: c) BootstrapVue uses Bootstrapโ€™s design, while Vuetify follows Material Design


    ๐Ÿ“Œ True or False

    3๏ธโƒฃ BootstrapVue provides Vue-specific components like <b-button>.
    โœ… Answer: True

    4๏ธโƒฃ You can use Bootstrapโ€™s CDN with Vue, but wonโ€™t have BootstrapVue components.
    โœ… Answer: True


    ๐ŸŽฏ Practical Challenge

    โœ… Install BootstrapVue and create a responsive form with BootstrapVue components.
    โœ… Add a BootstrapVue table to display sample data.
    โœ… Create a modal popup with BootstrapVue.
    โœ… Post your solution in the discussion forum for feedback!


    ๐ŸŽ“ Lesson Summary

    โœ… BootstrapVue adds Vue-friendly components for Bootstrap.
    โœ… It provides prebuilt components like <b-button> and <b-form>.
    โœ… BootstrapVue is great for traditional UI, while Vuetify follows Material Design.

  • Lesson 25: Bootstrap with React (Bootstrap vs Material UI)

    ๐Ÿ“Œ Objective: Learn how to integrate Bootstrap with React.js, compare it with Material UI, and decide which framework best suits your project.


    ๐Ÿ”น 1. Introduction to Bootstrap in React

    Bootstrap is a popular CSS framework used for building responsive UIs in React applications.

    ๐Ÿ’ก Why Use Bootstrap with React?
    โœ”๏ธ Easy to integrate โ€“ Works with or without third-party libraries.
    โœ”๏ธ Prebuilt UI components โ€“ Saves development time.
    โœ”๏ธ Fully responsive โ€“ Works on all screen sizes.


    ๐Ÿ”น 2. Installing Bootstrap in a React Project

    To use Bootstrap in React, install it via npm or use a CDN.

    1๏ธโƒฃ Method 1: Using Bootstrap via npm

    โœ… Run the following command:

    sh
    npm install bootstrap

    ๐Ÿ”น What happens?

    • This installs Bootstrap locally in your React project.

    โœ… Import Bootstrap in src/index.js or src/App.js:

    javascript
    import 'bootstrap/dist/css/bootstrap.min.css';

    ๐Ÿ”น What happens?

    • This loads Bootstrap styles into your React application.

    2๏ธโƒฃ Method 2: Using Bootstrap via CDN

    โœ… Add Bootstrapโ€™s CDN in public/index.html:

    html
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">

    ๐Ÿ”น What happens?

    • Bootstrap loads globally, but wonโ€™t be part of your package dependencies.

    ๐Ÿ”น 3. Using Bootstrap Components in React

    You can use Bootstrap classes just like in normal HTML.

    โœ… Example: Bootstrap Button in React

    javascript
    import React from "react";

    function App() {
    return (
    <div className="container mt-5">
    <button className="btn btn-primary">Click Me</button>
    </div>

    );
    }

    export default App;

    ๐Ÿ”น What happens?

    • The button uses Bootstrapโ€™s primary button style.

    ๐Ÿ”น 4. Using react-bootstrap for Better Component Support

    react-bootstrap provides Bootstrap components as React components.

    1๏ธโƒฃ Installing react-bootstrap

    โœ… Run the following command:

    sh
    npm install react-bootstrap bootstrap

    ๐Ÿ”น What happens?

    • This installs Bootstrap and its React-specific components.

    2๏ธโƒฃ Using Bootstrap Components in React

    โœ… Example: Bootstrap Button Component

    javascript
    import React from "react";
    import { Button } from "react-bootstrap";
    import "bootstrap/dist/css/bootstrap.min.css";

    function App() {
    return (
    <div className="container mt-5">
    <Button variant="primary">Click Me</Button>
    </div>

    );
    }

    export default App;

    ๐Ÿ”น What happens?

    • Instead of using <button class="btn btn-primary">, we use <Button variant="primary">.

    ๐Ÿ”น 5. Bootstrap vs Material UI in React

    Both Bootstrap and Material UI (MUI) are popular UI frameworks for React.

    Feature Bootstrap Material UI (MUI)
    Design Language Traditional Modern, Google Material Design
    Customization Uses SCSS variables Uses Theme Provider
    Components Prebuilt components Advanced, customizable components
    Integration Requires Bootstrap or react-bootstrap Uses @mui/material library
    Flexibility Can work with any design system Strictly follows Material Design

    ๐Ÿ”น 6. Installing & Using Material UI in React

    โœ… Run the following command:

    sh
    npm install @mui/material @emotion/react @emotion/styled

    ๐Ÿ”น What happens?

    • This installs Material UI components for React.

    โœ… Example: Material UI Button

    javascript
    import React from "react";
    import { Button } from "@mui/material";

    function App() {
    return (
    <div className="container mt-5">
    <Button variant="contained" color="primary">Click Me</Button>
    </div>

    );
    }

    export default App;

    ๐Ÿ”น What happens?

    • The button follows Material UI design principles.

    ๐Ÿ”น 7. When to Use Bootstrap vs Material UI?

    โœ… Use Bootstrap if:

    • You need fast development and a traditional UI.
    • Your app is lightweight and performance-focused.
    • You want more flexibility in design.

    โœ… Use Material UI if:

    • You want a modern, app-like UI.
    • You need prebuilt themes and consistent styling.
    • Your project follows Material Design principles.

    ๐Ÿ“ Lesson Recap Quiz

    ๐ŸŽฏ Test your knowledge of Bootstrap & Material UI in React.

    ๐Ÿ“Œ Multiple-Choice Questions (MCQs)

    1๏ธโƒฃ What is the easiest way to add Bootstrap to a React project?
    a) npm install bootstrap
    b) react-bootstrap install
    c) bootstrap-react-cli
    d) npm start bootstrap

    โœ… Correct Answer: a) npm install bootstrap


    2๏ธโƒฃ What command installs Material UI?
    a) npm install material-ui
    b) npm install @mui/material
    c) npm install react-mui
    d) npm install material-design

    โœ… Correct Answer: b) npm install @mui/material


    ๐Ÿ“Œ True or False

    3๏ธโƒฃ Bootstrap requires JavaScript to work with React.
    โœ… Answer: False

    4๏ธโƒฃ Material UI provides a better modern UI than Bootstrap.
    โœ… Answer: True


    ๐ŸŽฏ Practical Challenge

    โœ… Install Bootstrap and create a React component with a Bootstrap button.
    โœ… Install react-bootstrap and use Bootstrap’s Button component.
    โœ… Install Material UI and create a modern-looking form using MUI components.
    โœ… Post your solution in the discussion forum for feedback!


    ๐ŸŽ“ Lesson Summary

    โœ… Bootstrap can be used in React via npm or CDN.
    โœ… react-bootstrap provides React components for Bootstrap UI.
    โœ… Material UI offers a modern, Google-style UI for React.
    โœ… Bootstrap is flexible, while Material UI follows a strict design system.

  • Lesson 24: Creating Interactive Sliders & Carousels in Bootstrap

    ๐Ÿ“Œ Objective: Learn how to create interactive sliders and carousels using Bootstrapโ€™s built-in Carousel component.


    ๐Ÿ”น 1. Introduction to Bootstrap Carousels & Sliders

    A carousel (slider) is used to display multiple images, text, or content slides in a rotating fashion.

    ๐Ÿ’ก Why Use Bootstrap Carousels?
    โœ”๏ธ Pre-built structure โ€“ No extra JavaScript needed.
    โœ”๏ธ Responsive and touch-friendly โ€“ Works on all devices.
    โœ”๏ธ Supports images, text, and even videos.


    ๐Ÿ”น 2. Basic Bootstrap Carousel

    A basic carousel contains:
    1๏ธโƒฃ .carousel โ€“ The container
    2๏ธโƒฃ .carousel-inner โ€“ Holds slides
    3๏ธโƒฃ .carousel-item โ€“ Individual slides
    4๏ธโƒฃ Controls & indicators for navigation

    โœ… Example: Simple Image Carousel

    html
    <div id="carouselExample" class="carousel slide" data-bs-ride="carousel">
    <div class="carousel-inner">
    <div class="carousel-item active">
    <img src="https://via.placeholder.com/800x400" class="d-block w-100" alt="Slide 1">
    </div>
    <div class="carousel-item">
    <img src="https://via.placeholder.com/800x400" class="d-block w-100" alt="Slide 2">
    </div>
    <div class="carousel-item">
    <img src="https://via.placeholder.com/800x400" class="d-block w-100" alt="Slide 3">
    </div>
    </div>

    <!-- Navigation Buttons -->
    <button class="carousel-control-prev" type="button" data-bs-target="#carouselExample" data-bs-slide="prev">
    <span class="carousel-control-prev-icon"></span>
    </button>
    <button class="carousel-control-next" type="button" data-bs-target="#carouselExample" data-bs-slide="next">
    <span class="carousel-control-next-icon"></span>
    </button>
    </div>

    ๐Ÿ”น What happens?

    • The carousel cycles through images automatically.
    • Left & right navigation buttons allow manual control.

    ๐Ÿ”น 3. Adding Indicators & Captions

    Indicators allow users to jump between slides, while captions provide slide descriptions.

    โœ… Example: Carousel with Indicators & Captions

    html
    <div id="carouselWithCaptions" class="carousel slide" data-bs-ride="carousel">
    <!-- Indicators -->
    <div class="carousel-indicators">
    <button type="button" data-bs-target="#carouselWithCaptions" data-bs-slide-to="0" class="active"></button>
    <button type="button" data-bs-target="#carouselWithCaptions" data-bs-slide-to="1"></button>
    <button type="button" data-bs-target="#carouselWithCaptions" data-bs-slide-to="2"></button>
    </div>

    <div class="carousel-inner">
    <div class="carousel-item active">
    <img src="https://via.placeholder.com/800x400" class="d-block w-100" alt="Slide 1">
    <div class="carousel-caption">
    <h5>First Slide</h5>
    <p>Example caption for the first slide.</p>
    </div>
    </div>
    <div class="carousel-item">
    <img src="https://via.placeholder.com/800x400" class="d-block w-100" alt="Slide 2">
    <div class="carousel-caption">
    <h5>Second Slide</h5>
    <p>Example caption for the second slide.</p>
    </div>
    </div>
    </div>

    <button class="carousel-control-prev" type="button" data-bs-target="#carouselWithCaptions" data-bs-slide="prev">
    <span class="carousel-control-prev-icon"></span>
    </button>
    <button class="carousel-control-next" type="button" data-bs-target="#carouselWithCaptions" data-bs-slide="next">
    <span class="carousel-control-next-icon"></span>
    </button>
    </div>

    ๐Ÿ”น What happens?

    • Indicators allow users to navigate between slides.
    • Each slide has a caption with a title and description.

    ๐Ÿ”น 4. Controlling Carousel Speed & Autoplay

    You can customize speed and autoplay behavior using data-bs-interval.

    โœ… Example: Slower Auto-Scrolling Carousel

    html
    <div id="slowCarousel" class="carousel slide" data-bs-ride="carousel">
    <div class="carousel-inner">
    <div class="carousel-item active" data-bs-interval="5000">
    <img src="https://via.placeholder.com/800x400" class="d-block w-100" alt="Slow Slide">
    </div>
    <div class="carousel-item" data-bs-interval="7000">
    <img src="https://via.placeholder.com/800x400" class="d-block w-100" alt="Slow Slide 2">
    </div>
    </div>

    <button class="carousel-control-prev" type="button" data-bs-target="#slowCarousel" data-bs-slide="prev">
    <span class="carousel-control-prev-icon"></span>
    </button>
    <button class="carousel-control-next" type="button" data-bs-target="#slowCarousel" data-bs-slide="next">
    <span class="carousel-control-next-icon"></span>
    </button>
    </div>

    ๐Ÿ”น What happens?

    • Each slide remains visible for a longer time before transitioning.

    ๐Ÿ”น 5. Creating a Manual (Non-Auto) Carousel

    โœ… Example: Disabling Auto Sliding

    html
    <div id="manualCarousel" class="carousel slide">
    <div class="carousel-inner">
    <div class="carousel-item active">
    <img src="https://via.placeholder.com/800x400" class="d-block w-100" alt="Manual Slide 1">
    </div>
    <div class="carousel-item">
    <img src="https://via.placeholder.com/800x400" class="d-block w-100" alt="Manual Slide 2">
    </div>
    </div>

    <button class="carousel-control-prev" type="button" data-bs-target="#manualCarousel" data-bs-slide="prev">
    <span class="carousel-control-prev-icon"></span>
    </button>
    <button class="carousel-control-next" type="button" data-bs-target="#manualCarousel" data-bs-slide="next">
    <span class="carousel-control-next-icon"></span>
    </button>
    </div>

    ๐Ÿ”น What happens?

    • The carousel only moves when users click next or previous buttons.

    ๐Ÿ”น 6. Controlling Carousel with JavaScript

    โœ… Example: JavaScript-Powered Carousel Control

    html
    <button id="startCarousel" class="btn btn-success">Start</button>
    <button id="stopCarousel" class="btn btn-danger">Stop</button>

    <div id="controlledCarousel" class="carousel slide" data-bs-ride="false">
    <div class="carousel-inner">
    <div class="carousel-item active">
    <img src="https://via.placeholder.com/800x400" class="d-block w-100" alt="Slide 1">
    </div>
    <div class="carousel-item">
    <img src="https://via.placeholder.com/800x400" class="d-block w-100" alt="Slide 2">
    </div>
    </div>
    </div>

    <script>
    const myCarousel = new bootstrap.Carousel(document.getElementById('controlledCarousel'));
    document.getElementById('startCarousel').addEventListener('click', () => myCarousel.cycle());
    document.getElementById('stopCarousel').addEventListener('click', () => myCarousel.pause());
    </script>

    ๐Ÿ”น What happens?

    • Clicking “Start” resumes autoplay, and “Stop” pauses the slider.

    ๐Ÿ“ Lesson Recap Quiz

    ๐ŸŽฏ Test your knowledge of Bootstrap Carousels.

    ๐Ÿ“Œ Multiple-Choice Questions (MCQs)

    1๏ธโƒฃ Which class is used to create a Bootstrap carousel?
    a) .slider-bootstrap
    b) .carousel
    c) .bs-slider
    d) .slideshow

    โœ… Correct Answer: b) .carousel


    2๏ธโƒฃ How do you disable auto-sliding in a Bootstrap carousel?
    a) data-bs-autoplay="false"
    b) data-bs-slide="none"
    c) data-bs-ride="false"
    d) data-bs-stop="true"

    โœ… Correct Answer: c) data-bs-ride="false"


    ๐ŸŽฏ Practical Challenge

    โœ… Create a Bootstrap carousel with three images and captions.
    โœ… Customize the interval speed of each slide.
    โœ… Add buttons to start and stop the carousel using JavaScript.
    โœ… Post your solution in the discussion forum for feedback!

  • Lesson 23: Using Bootstrapโ€™s JavaScript Plugins

    ๐Ÿ“Œ Objective: Learn how to use Bootstrapโ€™s built-in JavaScript plugins to add interactive functionality to your website.


    ๐Ÿ”น 1. Introduction to Bootstrap JavaScript Plugins

    Bootstrap comes with powerful JavaScript plugins that enhance UI elements without requiring additional third-party libraries.

    ๐Ÿ’ก Why Use Bootstrap JavaScript Plugins?
    โœ”๏ธ Lightweight & Fast โ€“ No extra dependencies required.
    โœ”๏ธ Pre-built UI interactions โ€“ Modals, dropdowns, carousels, tooltips, etc.
    โœ”๏ธ Works with data attributes โ€“ No need to write custom JavaScript.


    ๐Ÿ”น 2. How to Use Bootstrapโ€™s JavaScript Plugins

    Bootstrap plugins can be used in two ways:
    1๏ธโƒฃ Using Data Attributes (No JavaScript required)
    2๏ธโƒฃ Using JavaScript API (More control and flexibility)


    ๐Ÿ”น 3. Bootstrap Modal Plugin

    The Modal plugin creates popup dialogs for forms, alerts, and messages.

    1๏ธโƒฃ Using a Modal with Data Attributes

    โœ… Example: Basic Modal

    html
    <!-- Button to Open Modal -->
    <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#myModal">
    Open Modal
    </button>

    <!-- Modal -->
    <div class="modal fade" id="myModal">
    <div class="modal-dialog">
    <div class="modal-content">
    <div class="modal-header">
    <h5 class="modal-title">My Modal</h5>
    <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
    </div>
    <div class="modal-body">
    This is a Bootstrap modal.
    </div>
    </div>
    </div>
    </div>

    ๐Ÿ”น What happens?

    • Clicking the button opens a popup modal.

    2๏ธโƒฃ Controlling Modal with JavaScript

    โœ… Example: Opening & Closing a Modal Using JavaScript

    html
    <button id="openModal" class="btn btn-success">Open Modal</button>

    <div class="modal fade" id="jsModal">
    <div class="modal-dialog">
    <div class="modal-content">
    <div class="modal-header">
    <h5 class="modal-title">JavaScript Modal</h5>
    <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
    </div>
    <div class="modal-body">
    This modal is controlled with JavaScript.
    </div>
    </div>
    </div>
    </div>

    <script>
    const myModal = new bootstrap.Modal(document.getElementById('jsModal'));
    document.getElementById('openModal').addEventListener('click', function () {
    myModal.show();
    });
    </script>

    ๐Ÿ”น What happens?

    • Clicking “Open Modal” triggers the modal via JavaScript.

    ๐Ÿ”น 4. Bootstrap Tooltip Plugin

    The Tooltip plugin adds hover-based text popups.

    1๏ธโƒฃ Adding Tooltips with Data Attributes

    โœ… Example: Tooltip on a Button

    html
    <button class="btn btn-info" data-bs-toggle="tooltip" title="This is a tooltip">
    Hover Me
    </button>

    <script>
    var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
    var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
    return new bootstrap.Tooltip(tooltipTriggerEl);
    });
    </script>

    ๐Ÿ”น What happens?

    • Hovering over the button displays a tooltip.

    ๐Ÿ”น 5. Bootstrap Popover Plugin

    The Popover plugin adds clickable tooltips with extra content.

    1๏ธโƒฃ Popover Using Data Attributes

    โœ… Example: Clickable Popover

    html
    <button type="button" class="btn btn-warning" data-bs-toggle="popover" title="Popover Title" data-bs-content="This is a popover">
    Click Me
    </button>

    <script>
    var popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'));
    var popoverList = popoverTriggerList.map(function (popoverTriggerEl) {
    return new bootstrap.Popover(popoverTriggerEl);
    });
    </script>

    ๐Ÿ”น What happens?

    • Clicking the button displays a popover with extra information.

    ๐Ÿ”น 6. Bootstrap Toast Plugin

    The Toast plugin is used for lightweight notifications.

    1๏ธโƒฃ Creating a Toast Notification

    โœ… Example: Basic Toast Notification

    html
    <!-- Toast Container -->
    <div class="toast show position-fixed bottom-0 end-0 p-3" role="alert">
    <div class="toast-header">
    <strong class="me-auto">Notification</strong>
    <button type="button" class="btn-close" data-bs-dismiss="toast"></button>
    </div>
    <div class="toast-body">
    This is a Bootstrap toast notification!
    </div>
    </div>

    ๐Ÿ”น What happens?

    • A notification appears in the bottom right corner.

    ๐Ÿ”น 7. Bootstrap Collapse Plugin

    The Collapse plugin toggles the visibility of content.

    1๏ธโƒฃ Collapsible Content

    โœ… Example: Click to Show/Hide

    html
    <button class="btn btn-danger" data-bs-toggle="collapse" data-bs-target="#collapseExample">
    Toggle Content
    </button>

    <div id="collapseExample" class="collapse">
    <div class="card card-body">
    This is hidden content that appears when clicked.
    </div>
    </div>

    ๐Ÿ”น What happens?

    • Clicking the button shows or hides the content.

    ๐Ÿ”น 8. Bootstrap Carousel Plugin

    The Carousel plugin creates image sliders.

    1๏ธโƒฃ Creating an Image Slider

    โœ… Example: Image Carousel

    html
    <div id="carouselExample" class="carousel slide" data-bs-ride="carousel">
    <div class="carousel-inner">
    <div class="carousel-item active">
    <img src="https://via.placeholder.com/800x400" class="d-block w-100" alt="Slide 1">
    </div>
    <div class="carousel-item">
    <img src="https://via.placeholder.com/800x400" class="d-block w-100" alt="Slide 2">
    </div>
    </div>
    <button class="carousel-control-prev" type="button" data-bs-target="#carouselExample" data-bs-slide="prev">
    <span class="carousel-control-prev-icon"></span>
    </button>
    <button class="carousel-control-next" type="button" data-bs-target="#carouselExample" data-bs-slide="next">
    <span class="carousel-control-next-icon"></span>
    </button>
    </div>

    ๐Ÿ”น What happens?

    • The carousel automatically cycles through images.

    ๐Ÿ“ Lesson Recap Quiz

    ๐ŸŽฏ Test your knowledge of Bootstrap JavaScript Plugins.

    ๐Ÿ“Œ Multiple-Choice Questions (MCQs)

    1๏ธโƒฃ Which attribute is used to open a Bootstrap modal?
    a) data-bs-modal="open"
    b) data-bs-target="modal"
    c) data-bs-toggle="modal"
    d) data-bs-popup="true"

    โœ… Correct Answer: c) data-bs-toggle="modal"


    2๏ธโƒฃ What plugin displays hover-based text popups?
    a) Toast
    b) Tooltip
    c) Collapse
    d) Dropdown

    โœ… Correct Answer: b) Tooltip


    ๐Ÿ“Œ True or False

    3๏ธโƒฃ Bootstrap modals require JavaScript to function.
    โœ… Answer: True

    4๏ธโƒฃ The Carousel plugin can be controlled with JavaScript.
    โœ… Answer: True


    ๐ŸŽฏ Practical Challenge

    โœ… Add a Bootstrap tooltip to a button.
    โœ… Create a popover that appears when clicked.
    โœ… Build a toast notification that appears on page load.
    โœ… Post your solution in the discussion forum for feedback!


    ๐ŸŽ“ Lesson Summary

    โœ… Bootstrap JavaScript plugins add modals, tooltips, popovers, carousels, and more.
    โœ… Data attributes (data-bs-toggle) enable plugins without JavaScript.
    โœ… Bootstrapโ€™s JavaScript API (new bootstrap.Modal()) provides more control.

  • Lesson 22: Form Validation & Error Handling

    ๐Ÿ“Œ Objective: Learn how to implement form validation and handle errors using Bootstrapโ€™s built-in validation system and JavaScript.


    ๐Ÿ”น 1. Introduction to Form Validation & Error Handling

    Form validation ensures that users enter valid data before submission.

    ๐Ÿ’ก Why Use Form Validation?
    โœ”๏ธ Prevents incorrect data submission.
    โœ”๏ธ Enhances user experience with instant feedback.
    โœ”๏ธ Bootstrap provides built-in styles for validation.


    ๐Ÿ”น 2. Bootstrapโ€™s Built-in Form Validation

    Bootstrap uses CSS classes to indicate form validation states.

    โœ… Example: Basic Validation with .is-invalid & .is-valid

    html
    <form>
    <div class="mb-3">
    <label class="form-label">Email</label>
    <input type="email" class="form-control is-invalid" placeholder="Enter your email">
    <div class="invalid-feedback">Please enter a valid email.</div>
    </div>

    <div class="mb-3">
    <label class="form-label">Username</label>
    <input type="text" class="form-control is-valid" placeholder="Valid username">
    <div class="valid-feedback">Looks good!</div>
    </div>

    <button type="submit" class="btn btn-primary">Submit</button>
    </form>

    ๐Ÿ”น What happens?

    • Red input field (is-invalid) appears for incorrect input.
    • Green input field (is-valid) appears for correct input.

    ๐Ÿ”น 3. Adding JavaScript-Powered Validation

    Bootstrapโ€™s validation system works with JavaScript.

    โœ… Example: JavaScript-Powered Validation

    html
    <form class="needs-validation" novalidate>
    <div class="mb-3">
    <label class="form-label">Email</label>
    <input type="email" class="form-control" required>
    <div class="invalid-feedback">Please enter a valid email.</div>
    </div>

    <div class="mb-3">
    <label class="form-label">Password</label>
    <input type="password" class="form-control" required>
    <div class="invalid-feedback">Password is required.</div>
    </div>

    <button type="submit" class="btn btn-success">Submit</button>
    </form>

    <script>
    document.querySelector("form").addEventListener("submit", function(event) {
    if (!this.checkValidity()) {
    event.preventDefault();
    event.stopPropagation();
    }
    this.classList.add("was-validated");
    });
    </script>

    ๐Ÿ”น What happens?

    • Invalid fields show an error message (invalid-feedback).
    • If fields are valid, the form submits.

    ๐Ÿ”น 4. Customizing Error Messages

    You can customize validation messages for better UX.

    โœ… Example: Custom Validation Messages

    html
    <form class="needs-validation" novalidate>
    <div class="mb-3">
    <label class="form-label">Username</label>
    <input type="text" class="form-control" id="username" required>
    <div class="invalid-feedback">Username cannot be empty!</div>
    </div>

    <button type="submit" class="btn btn-danger">Submit</button>
    </form>

    <script>
    document.querySelector("form").addEventListener("submit", function(event) {
    let username = document.getElementById("username");
    if (username.value.trim() === "") {
    username.classList.add("is-invalid");
    event.preventDefault();
    } else {
    username.classList.remove("is-invalid");
    }
    });
    </script>

    ๐Ÿ”น What happens?

    • The error message appears if the username field is empty.

    ๐Ÿ”น 5. Adding Regex Pattern Validation

    Use regex patterns to enforce specific input formats.

    โœ… Example: Phone Number Validation

    html
    <form>
    <div class="mb-3">
    <label class="form-label">Phone Number</label>
    <input type="tel" class="form-control" id="phone" pattern="[0-9]{10}" required>
    <div class="invalid-feedback">Please enter a 10-digit phone number.</div>
    </div>

    <button type="submit" class="btn btn-info">Submit</button>
    </form>

    ๐Ÿ”น What happens?

    • Only 10-digit numbers are accepted.

    ๐Ÿ”น 6. Displaying Real-Time Validation Messages

    โœ… Example: Live Validation Feedback

    html
    <form>
    <div class="mb-3">
    <label class="form-label">Email</label>
    <input type="email" class="form-control" id="liveEmail" required>
    <div class="invalid-feedback">Invalid email format.</div>
    </div>
    </form>

    <script>
    document.getElementById("liveEmail").addEventListener("input", function () {
    if (this.checkValidity()) {
    this.classList.remove("is-invalid");
    this.classList.add("is-valid");
    } else {
    this.classList.remove("is-valid");
    this.classList.add("is-invalid");
    }
    });
    </script>

    ๐Ÿ”น What happens?

    • The input turns green (is-valid) when correct and red (is-invalid) when incorrect.

    ๐Ÿ”น 7. Adding Password Strength Validation

    Password validation ensures secure passwords.

    โœ… Example: Password Strength Indicator

    html
    <form>
    <div class="mb-3">
    <label class="form-label">Password</label>
    <input type="password" class="form-control" id="password" required>
    <small id="passwordHelp" class="form-text">Must be 8+ characters, include numbers & symbols.</small>
    <div class="invalid-feedback">Weak password.</div>
    </div>
    </form>

    <script>
    document.getElementById("password").addEventListener("input", function () {
    let password = this.value;
    let regex = /^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/;

    if (regex.test(password)) {
    this.classList.add("is-valid");
    this.classList.remove("is-invalid");
    } else {
    this.classList.add("is-invalid");
    this.classList.remove("is-valid");
    }
    });
    </script>

    ๐Ÿ”น What happens?

    • Green input when password meets criteria.
    • Red input when password is weak.

    ๐Ÿ”น 8. Handling Server-Side Validation Errors

    Sometimes validation errors come from the backend.

    โœ… Example: Displaying Server Errors

    html
    <form>
    <div class="mb-3">
    <label class="form-label">Email</label>
    <input type="email" class="form-control is-invalid">
    <div class="invalid-feedback">This email is already taken.</div>
    </div>
    </form>

    ๐Ÿ”น What happens?

    • Server response triggers an error message.

    ๐Ÿ“ Lesson Recap Quiz

    ๐ŸŽฏ Test your knowledge of Bootstrap Form Validation.

    ๐Ÿ“Œ Multiple-Choice Questions (MCQs)

    1๏ธโƒฃ What class highlights invalid fields in Bootstrap?
    a) .error-input
    b) .invalid
    c) .is-invalid
    d) .form-error

    โœ… Correct Answer: c) .is-invalid


    2๏ธโƒฃ What Bootstrap class enables real-time validation?
    a) .form-live
    b) .needs-validation
    c) .input-validation
    d) .validate-now

    โœ… Correct Answer: b) .needs-validation


    ๐Ÿ“Œ True or False

    3๏ธโƒฃ Bootstrap validation works without JavaScript.
    โœ… Answer: False

    4๏ธโƒฃ Password strength validation can be done using Regex.
    โœ… Answer: True


    ๐ŸŽฏ Practical Challenge

    โœ… Implement live email validation using .is-invalid and .is-valid.
    โœ… Create a signup form with password strength validation.
    โœ… Display server-side validation errors for a taken email.
    โœ… Post your solution in the discussion forum for feedback!


    ๐ŸŽ“ Lesson Summary

    โœ… Bootstrap validation (is-invalid, is-valid) highlights form errors.
    โœ… JavaScript validation (checkValidity()) prevents incorrect submissions.
    โœ… Regex patterns (pattern="...") enforce correct input formats.
    โœ… Server-side validation errors can be displayed with .invalid-feedback.

  • Lesson 20: Customizing Bootstrap Variables with SCSS

    ๐Ÿ“Œ Objective: Learn how to customize Bootstrap styles using SCSS variables and build a custom Bootstrap theme.


    ๐Ÿ”น 1. Introduction to Bootstrap SCSS Customization

    Bootstrap is built using SCSS (Sassy CSS), which allows customization of colors, typography, spacing, and other styles.

    ๐Ÿ’ก Why Use SCSS for Bootstrap Customization?
    โœ”๏ธ Modify Bootstrap colors, fonts, and layout without overriding CSS.
    โœ”๏ธ Improve performance by compiling only the necessary Bootstrap components.
    โœ”๏ธ Make your theme unique while using Bootstrapโ€™s framework.


    ๐Ÿ”น 2. Setting Up Bootstrap SCSS

    To customize Bootstrap, follow these steps:

    1๏ธโƒฃ Install Bootstrap with npm

    โœ… Run the following command:

    sh
    npm install bootstrap

    ๐Ÿ”น What happens?

    • This installs Bootstrap and its SCSS files in node_modules/bootstrap/.

    2๏ธโƒฃ Create a SCSS File for Customization

    Inside your project, create a custom SCSS file (e.g., custom.scss).

    โœ… Example: Import Bootstrap in SCSS

    scss
    // Import Bootstrap functions and variables
    @import "node_modules/bootstrap/scss/functions";
    @import "node_modules/bootstrap/scss/variables";
    // Override Bootstrap variables
    $primary: #ff6600; // Custom primary color
    $secondary: #333333; // Custom secondary color
    $body-font-family: ‘Poppins’, sans-serif; // Custom font

    // Import Bootstrap SCSS (after overriding variables)
    @import “node_modules/bootstrap/scss/bootstrap”;

    ๐Ÿ”น What happens?

    • Bootstrap variables are modified before importing Bootstrap styles.

    ๐Ÿ”น 3. Customizing Bootstrap Colors

    Bootstrap uses SCSS variables to define colors.

    โœ… Example: Changing Bootstrap Colors

    scss
    $primary: #ff6600;
    $success: #28a745;
    $danger: #dc3545;
    $warning: #ffc107;
    $info: #17a2b8;
    // Import Bootstrap with new colors
    @import “node_modules/bootstrap/scss/bootstrap”;

    ๐Ÿ”น What happens?

    • The primary color changes from blue to orange (#ff6600).

    ๐Ÿ”น 4. Customizing Bootstrap Typography

    Modify Bootstrapโ€™s default font family, sizes, and weights.

    โœ… Example: Custom Font & Typography

    scss
    $font-family-sans-serif: 'Poppins', sans-serif;
    $font-size-base: 1rem; // Default font size
    $h1-font-size: 2.5rem; // Custom H1 size
    // Import Bootstrap with updated typography
    @import “node_modules/bootstrap/scss/bootstrap”;

    ๐Ÿ”น What happens?

    • The default font changes to Poppins.
    • H1 headers become larger.

    ๐Ÿ”น 5. Customizing Bootstrap Buttons

    Bootstrap buttons are styled using SCSS variables.

    โœ… Example: Custom Button Styles

    scss
    $btn-padding-y: 0.75rem;
    $btn-padding-x: 1.5rem;
    $btn-border-radius: 10px;
    // Import Bootstrap with new button styles
    @import “node_modules/bootstrap/scss/bootstrap”;

    ๐Ÿ”น What happens?

    • Buttons become larger and rounded.

    ๐Ÿ”น 6. Creating a Custom Theme

    You can define a completely custom theme using SCSS.

    โœ… Example: Custom Theme

    scss
    $primary: #6f42c1; // Purple theme
    $secondary: #f8f9fa;
    $body-bg: #f4f4f4;
    $body-color: #333;
    // Custom button styles
    $btn-border-radius: 30px;
    $btn-font-weight: bold;

    // Import Bootstrap with custom theme
    @import “node_modules/bootstrap/scss/bootstrap”;

    ๐Ÿ”น What happens?

    • The entire site follows a custom theme with purple primary color.

    ๐Ÿ”น 7. Compiling SCSS to CSS

    To apply your SCSS changes, compile SCSS into CSS.

    โœ… Example: Compile SCSS to CSS

    sh
    sass custom.scss custom.css

    ๐Ÿ”น What happens?

    • The SCSS file compiles into a CSS file (custom.css).

    ๐Ÿ”น 8. Using Compiled CSS in HTML

    Once compiled, link the custom CSS in your HTML file.

    โœ… Example: Using Custom Bootstrap Styles

    html
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <link rel="stylesheet" href="custom.css">
    </head>
    <body>
    <button class="btn btn-primary">Custom Button</button>
    </body>
    </html>

    ๐Ÿ”น What happens?

    • Bootstrap now uses your customized styles.

    ๐Ÿ“ Lesson Recap Quiz

    ๐ŸŽฏ Test your knowledge of Bootstrap SCSS Customization.

    ๐Ÿ“Œ Multiple-Choice Questions (MCQs)

    1๏ธโƒฃ What command installs Bootstrap with SCSS?
    a) npm install bootstrap
    b) bootstrap install
    c) sass install bootstrap
    d) bootstrap-cli install

    โœ… Correct Answer: a) npm install bootstrap


    2๏ธโƒฃ Where should you override Bootstrap variables?
    a) After importing Bootstrap
    b) Before importing Bootstrap
    c) Inside HTML
    d) In JavaScript

    โœ… Correct Answer: b) Before importing Bootstrap


    ๐Ÿ“Œ True or False

    3๏ธโƒฃ Bootstrapโ€™s SCSS variables can be customized without JavaScript.
    โœ… Answer: True

    4๏ธโƒฃ You must recompile SCSS whenever you change Bootstrap variables.
    โœ… Answer: True


    ๐ŸŽฏ Practical Challenge

    โœ… Modify Bootstrapโ€™s primary color to #ff5722.
    โœ… Customize Bootstrap buttons to have rounded corners and a larger size.
    โœ… Set Bootstrapโ€™s default font to “Roboto”.
    โœ… Post your solution in the discussion forum for feedback!


    ๐ŸŽ“ Lesson Summary

    โœ… Bootstrap SCSS customization allows deep style modifications.
    โœ… Variables ($primary, $font-family-sans-serif) control Bootstrap styles.
    โœ… SCSS must be compiled into CSS using sass or a build tool.
    โœ… Customizing Bootstrap SCSS makes your theme unique.