Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • BS5 Tutorial
  • BS5 Interview Questions
  • BS5 Layout
  • BS5 Content
  • BS5 Components
  • BS5 Helpers
  • BS5 Utilities
  • BS4 Tutorial
  • BS Tutorial
  • Bootstrap Cheatsheet
  • Tailwind
  • CSS Frameworks
  • HTML Formatter
Open In App
Next Article:
Bootstrap 5 Dropdowns Options
Next article icon

Bootstrap 5 Dropdowns Menu content Forms

Last Updated : 29 Jul, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Bootstrap 5 Dropdown Menus in forms is a form element that displays a list of options, allowing the user to select one. Dropdown menus are often used for fields such as selection or options from a list. The Menu content Forms facilitates including the form within a dropdown menu or creating a simple dropdown menu by implementing the margin or padding utilities.

Menu content forms Class: There is no specific class used for dropdown menu content forms. To create a button, we use the .btn class, and to create a dropdown menu, we use the .dropdown-menu class.

Syntax:

<div class="dropdown-menu">
<form class="px-* py-*">
<div class="mb-...">
<input type="..." class="form-control"
placeholder="...">
</div>
</form>
</div>

Example 1: In this example, we set the dropdown button in the form of a dropdown using the .dropdown classes.

HTML
<!DOCTYPE html> <html lang="en">  <head>     <meta name="viewport"            content="width=device-width,                     initial-scale=1.0">     <title>         Bootstrap 5-GeeksforGeeks      </title>      <link href= "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"            rel="stylesheet">     <script src= "https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js">     </script>     <script src= "https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js">     </script> </head>  <body class="m-2">     <div class="container text-center ">         <h1 class="text-success">             GeeksforGeeks         </h1>         <h5>             Bootstrap 5 Dropdowns Menu content Forms         </h5>     </div>     <div class="dropdown p-3 border bg-light          text-center dropend" style="height:120px;">         <button class="btn btn-success dropdown-toggle"                  type="button"                  data-bs-toggle="dropdown">             Give The Details         </button>         <div class="dropdown-menu text-bg-light">             <form class="px-2 py-4">                 <div class="mb-2">                     <input type="name"                             class="form-control"                             placeholder="Full name">                 </div>                 <div class="mb-2">                     <input type="address"                             class="form-control"                             placeholder="Address">                 </div>                 <div class="mb-2">                     <input type="number"                             class="form-control"                             placeholder="Contact number">                 </div>                 <div class="mb-2">                     <input type="mail"                             class="form-control"                             placeholder="Email id ">                 </div>                 <div class="mb-2">                     <div class="form-check">                         <input type="checkbox"                                 class="form-check-input">                         <label class="form-check-label"                                 for="dropdownCheck">                             Done                         </label>                     </div>                 </div>             </form>         </div>     </div> </body>  </html> 

Output:

1

Example 2: In this example, we set the multiple dropdown button in the form of a dropdown using the  .dropdown classes.

HTML
<!DOCTYPE html> <html lang="en">  <head>      <meta name="viewport"            content="width=device-width,                     initial-scale=1.0">         <title>             Bootstrap 5-GeeksforGeeks          </title>          <link href= "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"          rel="stylesheet">     <script src= "https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js">     </script>     <script src= "https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js">     </script> </head>  <body class="m-2">     <div class="container text-center ">         <h1 class="text-success">             GeeksforGeeks         </h1>         <h5>             Bootstrap 5 Dropdowns Split button         </h5>     </div>     <div class="p-3 border bg-light text-center" >         <div class="btn-group dropstart">             <button type="button"                      class="btn btn-primary                             dropdown-toggle                             dropdown-toggle-split"                      data-bs-toggle="dropdown">             </button>             <button type="button"                      class="btn btn-secondary">                     Login Account             </button>             <span class="visually-hidden">                     Toggle Dropdown             </span>                          <div class="dropdown-menu">                 <form class="px-2 py-3">                     <div class="mb-4">                         <input type="Name"                                 class="form-control"                                 placeholder="User name">                     </div>                     <div class="mb-4">                         <input type="password"                                 class="form-control"                                 placeholder="password">                     </div>                     <div class="mb-4">                         <input type="security"                                 class="form-control"                                 placeholder="security key">                     </div>                     <div class="mb-4">                         <input type="Number id"                                 class="form-control"                                 placeholder="Captcha">                     </div>                 </form>             </div>         </div>         <div class="btn-group dropdown">             <button type="button"                      class="btn btn-warning                                             dropdown-toggle                             dropdown-toggle-split"                      data-bs-toggle="dropdown">             </button>             <button type="button"                      class="btn btn-danger">                     Fill form             </button>             <span class="visually-hidden">                     Toggle Dropdown             </span>             <div class="dropdown-menu">                 <form class="px-2 py-3">                     <div class="mb-4">                         <input type="Name"                                 class="form-control"                                 placeholder="first name">                     </div>                     <div class="mb-4">                         <input type="name"                                 class="form-control"                                 placeholder="Last name ">                     </div>                     <div class="mb-4">                         <input type="course"                                 class="form-control"                                 placeholder="Course">                     </div>                     <div class="mb-4">                         <input type="college"                                 class="form-control"                                 placeholder="College name">                     </div>                 </form>             </div>         </div>     </div> </body>  </html> 

Output:

2

Reference: https://getbootstrap.com/docs/5.0/components/dropdowns/#forms


Next Article
Bootstrap 5 Dropdowns Options

P

prashantrathore1159
Improve
Article Tags :
  • Web Technologies
  • Bootstrap
  • Bootstrap-5

Similar Reads

  • Bootstrap 5 Dropdowns Single Button
    Bootstrap 5 Dropdowns Single button is used to turn a button into a dropdown toggle with some basic markup. A dropdown button lets the user select from a number of items. Bootstrap 5 Dropdowns Single Button class:dropdown-toggle: This class is used to make the button drop down.Syntax:<div class="
    2 min read
  • Bootstrap 5 Dropdowns Split Button
    Bootstrap 5 Dropdowns split button is used to turn a button into a dropdown toggle with some basic markup. A dropdown button lets the user select from a number of items.  Bootstrap 5  Dropdowns split button class: dropdown-toggle-split: This class is used for proper spacing around the dropdown caret
    3 min read
  • Bootstrap 5 Dropdowns Sizing
    Bootstrap 5 Dropdowns Sizing is used to create dropdowns on different sizes of buttons. It normally works on any size of a button, there can be a single large button or a split small button. Bootstrap 5 Dropdowns Sizing Class: There is no pre-defined class for this you can use the Bootstrap 5 Dropdo
    2 min read
  • Bootstrap 5 Dropdowns Dark dropdowns
    Bootstrap 5 Dropdowns Dark dropdowns are needed to match the navbar or site theme. Add .dropdown-menu-dark to an existing .dropdown-menu to enable darker dropdowns to match a dark navbar or custom style. No changes are necessary for the dropdowns. Prerequisites: Refer to buttons and dropdowns for cu
    2 min read
  • Bootstrap 5 Dropdowns Directions
    Bootstrap 5 Dropdowns Directions are used to change the direction in which we want the dropdown to pop up. The arrow direction is changed based on the direction set for the dropdown to appear. Bootstrap 5 Dropdowns Directions: Dropdown Dropleft: This is used to show dropdown menus left-side of the r
    2 min read
  • Bootstrap 5 Dropdowns Dropup
    Bootstrap 5 Dropdowns Dropup is used to show dropdown menus above the parent elements by using the .dropup class. Bootstrap 5 Dropdowns Dropup Class: dropup: To launch dropdown menus above elements.Syntax: <div class="btn-group dropup"> ...</div>Example 1: This example describes the basi
    2 min read
  • Bootstrap 5 Dropdowns Dropright
    Bootstrap 5 Dropdowns Dropright is used to open the dropdown on the right-hand side of the user, We can one the dropdowns anywhere Bootstrap 5 Dropdowns Dropright Class: dropend: This class is used to launch dropdown menus to the right of the button. Syntax <div class="btn-group dropend"> <
    2 min read
  • Bootstrap 5 Dropdowns Dropleft
    Bootstrap 5 Dropdowns Dropleft is used to open the dropdown on the left-hand side of the user. Dropdown menus can be set up to the left of the elements by adding .dropstart to the parent element. Bootstrap 5 Dropdowns Dropleft Class: dropstart: This class is used to launch dropdown menus to the righ
    2 min read
  • Bootstrap 5 Dropdowns Menu items
    Bootstrap 5 Dropdowns Menu items are a list of options on a website that appears only when a user interacts with the menu, like by clicking on it or hovering over it.  Bootstrap 5  Dropdowns Menu items: Bootstrap 5 Dropdowns Menu items Active: It helps to set the state of any item in the dropdown me
    2 min read
  • Bootstrap 5 Dropdowns Active
    Bootstrap5 Dropdowns Active helps to set the state of any item in the dropdown menu as active. By default, the active item's background color will be set to blue and the text color will be set to white to make it different from the surrounding items. Dropdowns Active Class: active: This class is use
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences