Bootstrap 5: Button Groups


فهرست مطالب

    نمایش فهرست مطالب

ﻪﻤﮐﺩ ﯼﺎﻫ ﻩﻭﺮﮔ

Bootstrap 5 ﺪﯿﻨﮐ ﯼﺪﻨﺑ ﻩﻭﺮﮔ ﻪﻤﮐﺩ ﻩﻭﺮﮔ ﮏﯾ ﺭﺩ (ﻂﺧ ﮏﯾ ﺭﺩ) ﻢﻫ ﺎﺑ ﺍﺭ ﻪﻤﮐﺩ ﯼﺮﺳ ﮏﯾ ﺪﻫﺩ

:ﺪﯿﻨﮐ ﻩﺩﺎﻔﺘﺳﺍ ﻪﻤﮐﺩ ﻩﻭﺮﮔ ﮏﯾ ﺩﺎﺠﯾﺍ ﯼﺍﺮﺑ .btn-group

ﻝﺎﺜﻣ

<div class="btn-group">
   <button type="button" class="btn btn-primary">Apple</button>
   <button type="button" class="btn btn-primary">Samsung</button>
   <button type="button" class="btn btn-primary">Sony</button>
 </div>

→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
</head>
<body>

<div class="container mt-3">
  <h2>Button Group</h2>
  <p>The .btn-group class creates a button group:</p>
  <div class="btn-group">
    <button type="button" class="btn btn-primary">Apple</button>
    <button type="button" class="btn btn-primary">Samsung</button>
    <button type="button" class="btn btn-primary">Sony</button>
  </div>
</div>

</body>
</html>

ﻪﺘﮑﻧ: ﻪﺑﻩﺯﺍﺪﻧﺍ ﻝﺎﻤﻋﺍ ﯼﺎﺟﺭﺩ ﻪﻤﮐﺩ ﺮﻫ ﯼﺍﺮﺑ ﻪﻤﮐﺩ ﯼﺎﻫ a

:ﮒﺭﺰﺑ ﯼﺎﻫ ﻪﻤﮐﺩ

:ﺽﺮﻓ ﺶﯿﭘ ﯼﺎﻫ ﻪﻤﮐﺩ

:ﮏﭼﻮﮐ ﯼﺎﻫ ﻪﻤﮐﺩ

ﻝﺎﺜﻣ

<div class="btn-group btn-group-lg">
   <button type="button" class="btn btn-primary">Apple</button>
   <button type="button" class="btn btn-primary">Samsung</button>
   <button type="button" class="btn btn-primary">Sony</button>
</div>

→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
</head>
<body>

<div class="container mt-3">
  <h2>Button Groups Sizes</h2>
  <p>Add class .btn-group-* to size all buttons in a button group.</p>
  <h3>Large Buttons:</h3>
  <div class="btn-group btn-group-lg">
    <button type="button" class="btn btn-primary">Apple</button>
    <button type="button" class="btn btn-primary">Samsung</button>
    <button type="button" class="btn btn-primary">Sony</button>
  </div>
  <hr>
  <h3>Default Buttons:</h3>
  <div class="btn-group">
    <button type="button" class="btn btn-primary">Apple</button>
    <button type="button" class="btn btn-primary">Samsung</button>
    <button type="button" class="btn btn-primary">Sony</button>
  </div>
  <hr>
  <h3>Small Buttons:</h3>
  <div class="btn-group btn-group-sm">
    <button type="button" class="btn btn-primary">Apple</button>
    <button type="button" class="btn btn-primary">Samsung</button>
    <button type="button" class="btn btn-primary">Sony</button>
  </div>
</div>

</body>
</html>

ﯼﺩﻮﻤﻋ ﻪﻤﮐﺩ ﯼﺎﻫ ﻩﻭﺮﮔ

Bootstrap 5 ﺪﻨﮐ ﯽﻣ ﯽﻧﺎﺒﯿﺘﺸﭘ ﯼﺩﻮﻤﻋ ﻪﻤﮐﺩ ﯼﺎﻫ ﻩﻭﺮﮔ ﺯﺍ ﻦﯿﻨﭽﻤﻫ:

:ﺪﯿﻨﮐ ﻩﺩﺎﻔﺘﺳﺍ ﯼﺩﻮﻤﻋ ﻪﻤﮐﺩ ﻩﻭﺮﮔ ﮏﯾ ﺩﺎﺠﯾﺍ ﯼﺍﺮﺑ .btn-gro

ﻝﺎﺜﻣ

<div class="btn-group-vertical">
   <button type="button" class="btn btn-primary">Apple</button>
   <button type="button" class="btn btn-primary">Samsung</button>
   <button type="button" class="btn btn-primary">Sony</button>
 </div>

→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
</head>
<body>

<div class="container mt-3">
  <h2>Vertical Button Group</h2>
  <p>Use the .btn-group-vertical class to create a vertical button group:</p>
  <div class="btn-group-vertical">
    <button type="button" class="btn btn-primary">Apple</button>
    <button type="button" class="btn btn-primary">Samsung</button>
    <button type="button" class="btn btn-primary">Sony</button>
  </div>
</div>

</body>
</html>

ﻢﻫ ﺭﺎﻨﮐ ﯼﺎﻫ ﻩﻭﺮﮔ ﯼﺎﻫ ﻪﻤﮐﺩ

:ﺪﻧﻮﺷ ﺮﻫﺎﻇ ﻢﻫ ﺭﺎﻨﮐ ﺭﺩ ﻩﻭﺮﮔ ﻦﯾﺪﻨﭼ ﻦﺘﺷﺍﺩ ﺕﺭﻮﺻ ﺭﺩ ﺩﻮﺷﯽﻣ ﺚﻋﺎﺑ ﻪﮐ ،ﺪﻨﺘﺴﻫ «ﯽﻠﺧﺍ

ﻝﺎﺜﻣ

 <div class="btn-group">
  <button type="button" class="btn btn-primary">Apple</button>
  <button type="button" class="btn btn-primary">Samsung</button>
  <button type="button" class="btn btn-primary">Sony</button>
</div>
<div class="btn-group">
  <button type="button" class="btn btn-primary">BMW</button>
  <button type="button" class="btn btn-primary">Mercedes</button>
  <button type="button" class="btn btn-primary">Volvo</button>
</div>

→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
</head>
<body>

<div class="container mt-3">
  <h2>Button Group</h2>
  <p>Button groups are "inline" by default, which makes them appear side by side when you have multiple groups:</p>
  <div class="btn-group">
    <button type="button" class="btn btn-primary">Apple</button>
    <button type="button" class="btn btn-primary">Samsung</button>
    <button type="button" class="btn btn-primary">Sony</button>
  </div>
  <div class="btn-group">
    <button type="button" class="btn btn-primary">BMW</button>
    <button type="button" class="btn btn-primary">Mercedes</button>
    <button type="button" class="btn btn-primary">Volvo</button>
  </div>
</div>

</body>
</html>

ﯽﯾﻮﺸﮐ ﯼﺎﻫﻮﻨﻣ ﻭ ﻮﺗﺭﺩﻮﺗ ﻪﻤﮐﺩ ﯼﺎﻫﻩﻭﺮﮔ

:(ﺖﺧﻮﻣﺁ ﺪﯿﻫﺍﻮﺧ ﺮﺘﺸﯿﺑ ﯽﯾﻮﺸﮐ ﯼﺎﻫﺖﺳﺮﻬﻓ ﻩﺭﺎﺑﺭﺩ ﯼﺪﻌﺑ ﻞﺼﻓ ﺭﺩ) ﯽﯾﻮﺸﮐ ﯼﺎﻫﻮﻨﻣ ﺩﺎﺠﯾ

ﻝﺎﺜﻣ

<div class="btn-group">
 <button type="button" class="btn btn-primary">Apple</button>
 <button type="button" class="btn btn-primary">Samsung</button>
 <div class="btn-group">
   <button type="button" class="btn btn-primary dropdown-toggle"data-bs-toggle="dropdown">Sony</button>
   <div class="dropdown-menu">
     <a class="dropdown-item" href="#">Tablet</a>     
     <a class="dropdown-item" href="#">Smartphone</a>
   </div>
 </div>
</div>

→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
</head>
<body>

<div class="container mt-3">
  <h2>Nesting Button Groups</h2>
  <p>Nest button groups to create dropdown menus:</p>
  <div class="btn-group">
    <button type="button" class="btn btn-primary">Apple</button>
    <button type="button" class="btn btn-primary">Samsung</button>
    <div class="btn-group">
      <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown">Sony</button>
      <ul class="dropdown-menu">
        <li><a class="dropdown-item" href="#">Tablet</a></li>
        <li><a class="dropdown-item" href="#">Smartphone</a></li>
      </ul>
    </div>
  </div>
</div>

</body>
</html>

تمامی حقوق محفوظ است. © BasicIT.org • 2023-2024