mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-22 13:13:03 +02:00
add a base class style display for toggle buttons
This commit is contained in:
@@ -178,15 +178,29 @@ Visually, these toggle buttons are identical to the [checkbox toggle buttons]({{
|
||||
Add `data-bs-toggle="button"` to toggle a button's `active` state. If you're pre-toggling a button, you must manually add the `.active` class **and** `aria-pressed="true"` to ensure that it is conveyed appropriately to assistive technologies.
|
||||
|
||||
{{< example >}}
|
||||
<button type="button" class="btn btn-primary" data-bs-toggle="button">Toggle button</button>
|
||||
<button type="button" class="btn btn-primary active" data-bs-toggle="button" aria-pressed="true">Active toggle button</button>
|
||||
<button type="button" class="btn btn-primary" disabled data-bs-toggle="button">Disabled toggle button</button>
|
||||
<p class="d-inline-flex gap-1">
|
||||
<button type="button" class="btn" data-bs-toggle="button">Toggle button</button>
|
||||
<button type="button" class="btn active" data-bs-toggle="button" aria-pressed="true">Active toggle button</button>
|
||||
<button type="button" class="btn" disabled data-bs-toggle="button">Disabled toggle button</button>
|
||||
</p>
|
||||
<p class="d-inline-flex gap-1">
|
||||
<button type="button" class="btn btn-primary" data-bs-toggle="button">Toggle button</button>
|
||||
<button type="button" class="btn btn-primary active" data-bs-toggle="button" aria-pressed="true">Active toggle button</button>
|
||||
<button type="button" class="btn btn-primary" disabled data-bs-toggle="button">Disabled toggle button</button>
|
||||
</p>
|
||||
{{< /example >}}
|
||||
|
||||
{{< 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 class="btn btn-primary disabled" aria-disabled="true" role="button" data-bs-toggle="button">Disabled toggle link</a>
|
||||
<p class="d-inline-flex gap-1">
|
||||
<a href="#" class="btn" role="button" data-bs-toggle="button">Toggle link</a>
|
||||
<a href="#" class="btn active" role="button" data-bs-toggle="button" aria-pressed="true">Active toggle link</a>
|
||||
<a class="btn disabled" aria-disabled="true" role="button" data-bs-toggle="button">Disabled toggle link</a>
|
||||
</p>
|
||||
<p class="d-inline-flex gap-1">
|
||||
<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 class="btn btn-primary disabled" aria-disabled="true" role="button" data-bs-toggle="button">Disabled toggle link</a>
|
||||
</p>
|
||||
{{< /example >}}
|
||||
|
||||
### Methods
|
||||
|
Reference in New Issue
Block a user