mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-23 21:53:25 +02:00
Add v5.1.1 docs (#34870)
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="Use Bootstrap’s custom button styles for actions in forms, dialogs, and more with support for multiple sizes, states, and more.">
|
||||
<meta name="author" content="Mark Otto, Jacob Thornton, and Bootstrap contributors">
|
||||
<meta name="generator" content="Hugo 0.87.0">
|
||||
<meta name="generator" content="Hugo 0.88.1">
|
||||
|
||||
<meta name="docsearch:language" content="en">
|
||||
<meta name="docsearch:version" content="5.1">
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<link href="/docs/5.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We" crossorigin="anonymous">
|
||||
<link href="/docs/5.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous">
|
||||
|
||||
<link href="/docs/5.1/assets/css/docs.css" rel="stylesheet">
|
||||
|
||||
@@ -149,7 +149,7 @@
|
||||
<span class="d-none d-lg-inline">Bootstrap</span> v5.1
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="bd-versions">
|
||||
<li><a class="dropdown-item current" aria-current="true" href="/docs/5.1/">Latest (5.0.x)</a></li>
|
||||
<li><a class="dropdown-item current" aria-current="true" href="/docs/5.1/">Latest (5.1.x)</a></li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li><a class="dropdown-item" href="https://getbootstrap.com/docs/4.6/">v4.6.x</a></li>
|
||||
<li><a class="dropdown-item" href="https://getbootstrap.com/docs/3.4/">v3.4.1</a></li>
|
||||
@@ -408,7 +408,11 @@
|
||||
<li><a href="#button-tags">Button tags</a></li>
|
||||
<li><a href="#outline-buttons">Outline buttons</a></li>
|
||||
<li><a href="#sizes">Sizes</a></li>
|
||||
<li><a href="#disabled-state">Disabled state</a></li>
|
||||
<li><a href="#disabled-state">Disabled state</a>
|
||||
<ul>
|
||||
<li><a href="#link-functionality-caveat">Link functionality caveat</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#block-buttons">Block buttons</a></li>
|
||||
<li><a href="#button-plugin">Button plugin</a>
|
||||
<ul>
|
||||
@@ -523,18 +527,21 @@ Some of the button styles use a relatively light foreground color, and should on
|
||||
<ul>
|
||||
<li><code><a></code>s don’t support the <code>disabled</code> attribute, so you must add the <code>.disabled</code> class to make it visually appear disabled.</li>
|
||||
<li>Some future-friendly styles are included to disable all <code>pointer-events</code> on anchor buttons.</li>
|
||||
<li>Disabled buttons should include the <code>aria-disabled="true"</code> attribute to indicate the state of the element to assistive technologies.</li>
|
||||
<li>Disabled buttons using <code><a></code> should include the <code>aria-disabled="true"</code> attribute to indicate the state of the element to assistive technologies.</li>
|
||||
<li>Disabled buttons using <code><a></code> <em>should not</em> include the <code>href</code> attribute.</li>
|
||||
</ul>
|
||||
<div class="bd-example">
|
||||
<a class="btn btn-primary btn-lg disabled" role="button" aria-disabled="true">Primary link</a>
|
||||
<a class="btn btn-secondary btn-lg disabled" role="button" aria-disabled="true">Link</a>
|
||||
</div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="p"><</span><span class="nt">a</span> <span class="na">class</span><span class="o">=</span><span class="s">"btn btn-primary btn-lg disabled"</span> <span class="na">role</span><span class="o">=</span><span class="s">"button"</span> <span class="na">aria-disabled</span><span class="o">=</span><span class="s">"true"</span><span class="p">></span>Primary link<span class="p"></</span><span class="nt">a</span><span class="p">></span>
|
||||
<span class="p"><</span><span class="nt">a</span> <span class="na">class</span><span class="o">=</span><span class="s">"btn btn-secondary btn-lg disabled"</span> <span class="na">role</span><span class="o">=</span><span class="s">"button"</span> <span class="na">aria-disabled</span><span class="o">=</span><span class="s">"true"</span><span class="p">></span>Link<span class="p"></</span><span class="nt">a</span><span class="p">></span></code></pre></div>
|
||||
<h3 id="link-functionality-caveat">Link functionality caveat</h3>
|
||||
<p>To cover cases where you have to keep the <code>href</code> attribute on a disabled link, the <code>.disabled</code> class uses <code>pointer-events: none</code> to try to disable the link functionality of <code><a></code>s. Note that this CSS property is not yet standardized for HTML, but all modern browsers support it. In addition, even in browsers that do support <code>pointer-events: none</code>, keyboard navigation remains unaffected, meaning that sighted keyboard users and users of assistive technologies will still be able to activate these links. So to be safe, in addition to <code>aria-disabled="true"</code>, also include a <code>tabindex="-1"</code> attribute on these links to prevent them from receiving keyboard focus, and use custom JavaScript to disable their functionality altogether.</p>
|
||||
<div class="bd-example">
|
||||
<a href="#" class="btn btn-primary btn-lg disabled" tabindex="-1" role="button" aria-disabled="true">Primary link</a>
|
||||
<a href="#" class="btn btn-secondary btn-lg disabled" tabindex="-1" role="button" aria-disabled="true">Link</a>
|
||||
</div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="p"><</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"#"</span> <span class="na">class</span><span class="o">=</span><span class="s">"btn btn-primary btn-lg disabled"</span> <span class="na">tabindex</span><span class="o">=</span><span class="s">"-1"</span> <span class="na">role</span><span class="o">=</span><span class="s">"button"</span> <span class="na">aria-disabled</span><span class="o">=</span><span class="s">"true"</span><span class="p">></span>Primary link<span class="p"></</span><span class="nt">a</span><span class="p">></span>
|
||||
<span class="p"><</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"#"</span> <span class="na">class</span><span class="o">=</span><span class="s">"btn btn-secondary btn-lg disabled"</span> <span class="na">tabindex</span><span class="o">=</span><span class="s">"-1"</span> <span class="na">role</span><span class="o">=</span><span class="s">"button"</span> <span class="na">aria-disabled</span><span class="o">=</span><span class="s">"true"</span><span class="p">></span>Link<span class="p"></</span><span class="nt">a</span><span class="p">></span></code></pre></div>
|
||||
<div class="bd-callout bd-callout-warning">
|
||||
<h5 id="link-functionality-caveat">Link functionality caveat</h5>
|
||||
<p>The <code>.disabled</code> class uses <code>pointer-events: none</code> to try to disable the link functionality of <code><a></code>s, but that CSS property is not yet standardized. In addition, even in browsers that do support <code>pointer-events: none</code>, keyboard navigation remains unaffected, meaning that sighted keyboard users and users of assistive technologies will still be able to activate these links. So to be safe, in addition to <code>aria-disabled="true"</code>, also include a <code>tabindex="-1"</code> attribute on these links to prevent them from receiving keyboard focus, and use custom JavaScript to disable their functionality altogether.
|
||||
</div>
|
||||
|
||||
<h2 id="block-buttons">Block buttons</h2>
|
||||
<p>Create responsive stacks of full-width, “block buttons” like those in Bootstrap 4 with a mix of our display and gap utilities. By using utilities instead of button specific classes, we have much greater control over spacing, alignment, and responsive behaviors.</p>
|
||||
<div class="bd-example">
|
||||
@@ -594,10 +601,10 @@ Visually, these toggle buttons are identical to the <a href="/docs/5.1/forms/che
|
||||
<div class="bd-example">
|
||||
<a href="#" class="btn btn-primary" role="button" data-bs-toggle="button">Toggle link</a>
|
||||
<a href="#" class="btn btn-primary active" role="button" data-bs-toggle="button" aria-pressed="true">Active toggle link</a>
|
||||
<a href="#" class="btn btn-primary disabled" tabindex="-1" aria-disabled="true" role="button" data-bs-toggle="button">Disabled toggle link</a>
|
||||
<a class="btn btn-primary disabled" aria-disabled="true" role="button" data-bs-toggle="button">Disabled toggle link</a>
|
||||
</div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="p"><</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"#"</span> <span class="na">class</span><span class="o">=</span><span class="s">"btn btn-primary"</span> <span class="na">role</span><span class="o">=</span><span class="s">"button"</span> <span class="na">data-bs-toggle</span><span class="o">=</span><span class="s">"button"</span><span class="p">></span>Toggle link<span class="p"></</span><span class="nt">a</span><span class="p">></span>
|
||||
<span class="p"><</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"#"</span> <span class="na">class</span><span class="o">=</span><span class="s">"btn btn-primary active"</span> <span class="na">role</span><span class="o">=</span><span class="s">"button"</span> <span class="na">data-bs-toggle</span><span class="o">=</span><span class="s">"button"</span> <span class="na">aria-pressed</span><span class="o">=</span><span class="s">"true"</span><span class="p">></span>Active toggle link<span class="p"></</span><span class="nt">a</span><span class="p">></span>
|
||||
<span class="p"><</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"#"</span> <span class="na">class</span><span class="o">=</span><span class="s">"btn btn-primary disabled"</span> <span class="na">tabindex</span><span class="o">=</span><span class="s">"-1"</span> <span class="na">aria-disabled</span><span class="o">=</span><span class="s">"true"</span> <span class="na">role</span><span class="o">=</span><span class="s">"button"</span> <span class="na">data-bs-toggle</span><span class="o">=</span><span class="s">"button"</span><span class="p">></span>Disabled toggle link<span class="p"></</span><span class="nt">a</span><span class="p">></span></code></pre></div>
|
||||
<span class="p"><</span><span class="nt">a</span> <span class="na">class</span><span class="o">=</span><span class="s">"btn btn-primary disabled"</span> <span class="na">aria-disabled</span><span class="o">=</span><span class="s">"true"</span> <span class="na">role</span><span class="o">=</span><span class="s">"button"</span> <span class="na">data-bs-toggle</span><span class="o">=</span><span class="s">"button"</span><span class="p">></span>Disabled toggle link<span class="p"></</span><span class="nt">a</span><span class="p">></span></code></pre></div>
|
||||
<h3 id="methods">Methods</h3>
|
||||
<p>You can create a button instance with the button constructor, for example:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-js" data-lang="js"><span class="kd">var</span> <span class="nx">button</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s1">'myButton'</span><span class="p">)</span>
|
||||
@@ -639,7 +646,7 @@ Visually, these toggle buttons are identical to the <a href="/docs/5.1/forms/che
|
||||
<code>getOrCreateInstance</code>
|
||||
</td>
|
||||
<td>
|
||||
Static method which returns a button instance associated to a DOM element or create a new one in case it wasn't initialised.
|
||||
Static method which returns a button instance associated to a DOM element or create a new one in case it wasn't initialized.
|
||||
You can use it like this: <code>bootstrap.Button.getOrCreateInstance(element)</code>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -853,7 +860,7 @@ Visually, these toggle buttons are identical to the <a href="/docs/5.1/forms/che
|
||||
<ul class="list-unstyled small text-muted">
|
||||
<li class="mb-2">Designed and built with all the love in the world by the <a href="/docs/5.1/about/team/">Bootstrap team</a> with the help of <a href="https://github.com/twbs/bootstrap/graphs/contributors">our contributors</a>.</li>
|
||||
<li class="mb-2">Code licensed <a href="https://github.com/twbs/bootstrap/blob/main/LICENSE" target="_blank" rel="license noopener">MIT</a>, docs <a href="https://creativecommons.org/licenses/by/3.0/" target="_blank" rel="license noopener">CC BY 3.0</a>.</li>
|
||||
<li class="mb-2">Currently v5.1.0.</li>
|
||||
<li class="mb-2">Currently v5.1.1.</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-6 col-lg-2 offset-lg-1 mb-3">
|
||||
@@ -900,7 +907,7 @@ Visually, these toggle buttons are identical to the <a href="/docs/5.1/forms/che
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script src="/docs/5.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj" crossorigin="anonymous"></script>
|
||||
<script src="/docs/5.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-/bQdsTh/da6pkI1MST/rWKFNjaCP5gBSY4sEBT38Q/9RBh9AH40zEOg7Hlq2THRZ" crossorigin="anonymous"></script>
|
||||
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script>
|
||||
|
Reference in New Issue
Block a user