← Back to Bootstrap Course | Chapter 5: Components — Buttons & Forms | Lesson 7 of 7

Input के Groups

Input groups text, icons, या buttons को एक input के sides से attach करते हैं।

In this page:

  1. Input Groups
Syntax
markup
<div class="input-group">
  <span class="input-group-text">@</span>
  <input type="text" class="form-control">
</div>

Input Groups

एक input को .input-group में wrap करें और इससे पहले या बाद में .input-group-text या button elements add करें। Groups कई inputs hold कर सकते हैं और .input-group-lg जैसी size classes support करते हैं। Accessibility के लिए input से एक label associated रखें।

Note: Labels को input group के बाहर रखें, अंदर नहीं।

उदाहरण: Input groups

markup
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="p-3">
<div class="container">
  <label for="user" class="form-label">Username</label>
  <div class="input-group mb-3"><span class="input-group-text">@</span><input id="user" class="form-control" placeholder="username"></div>
  <div class="input-group"><input class="form-control" placeholder="Search" aria-label="Search"><button class="btn btn-outline-secondary">Go</button></div>
</div>
</body>
</html>
Live Example
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
आम गलतियां
  1. input-group wrapper भूल जाना
  2. text को group के बाहर रखना
  3. accessible labels missing होना
चैप्टर सारांश
  • .input-group controls wrap करता है
  • input-group-text addons add करता है
  • Buttons attach हो सकते हैं
  • Size classes group पर apply होती हैं
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.