diff options
Diffstat (limited to 'vendor/twbs/bootstrap/site/docs/4.5/components')
24 files changed, 9464 insertions, 0 deletions
diff --git a/vendor/twbs/bootstrap/site/docs/4.5/components/alerts.md b/vendor/twbs/bootstrap/site/docs/4.5/components/alerts.md new file mode 100644 index 000000000..5df7faa29 --- /dev/null +++ b/vendor/twbs/bootstrap/site/docs/4.5/components/alerts.md @@ -0,0 +1,118 @@ +--- +layout: docs +title: Alerts +description: Provide contextual feedback messages for typical user actions with the handful of available and flexible alert messages. +group: components +redirect_from: + - "/components/" + - "/docs/4.5/components/" +toc: true +--- + +## Examples + +Alerts are available for any length of text, as well as an optional dismiss button. For proper styling, use one of the eight **required** contextual classes (e.g., `.alert-success`). For inline dismissal, use the [alerts jQuery plugin](#dismissing). + +{% capture example %} +{% for color in site.data.theme-colors %} +<div class="alert alert-{{ color.name }}" role="alert"> + A simple {{ color.name }} alert—check it out! +</div>{% endfor %} +{% endcapture %} +{% include example.html content=example %} + +{% include callout-warning-color-assistive-technologies.md %} + +### Link color + +Use the `.alert-link` utility class to quickly provide matching colored links within any alert. + +{% capture example %} +{% for color in site.data.theme-colors %} +<div class="alert alert-{{ color.name }}" role="alert"> + A simple {{ color.name }} alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like. +</div>{% endfor %} +{% endcapture %} +{% include example.html content=example %} + +### Additional content + +Alerts can also contain additional HTML elements like headings, paragraphs and dividers. + +{% capture example %} +<div class="alert alert-success" role="alert"> + <h4 class="alert-heading">Well done!</h4> + <p>Aww yeah, you successfully read this important alert message. This example text is going to run a bit longer so that you can see how spacing within an alert works with this kind of content.</p> + <hr> + <p class="mb-0">Whenever you need to, be sure to use margin utilities to keep things nice and tidy.</p> +</div> +{% endcapture %} +{% include example.html content=example %} + + +### Dismissing + +Using the alert JavaScript plugin, it's possible to dismiss any alert inline. Here's how: + +- Be sure you've loaded the alert plugin, or the compiled Bootstrap JavaScript. +- If you're building our JavaScript from source, it [requires `util.js`]({{ site.baseurl }}/docs/{{ site.docs_version }}/getting-started/javascript/#util). The compiled version includes this. +- Add a dismiss button and the `.alert-dismissible` class, which adds extra padding to the right of the alert and positions the `.close` button. +- On the dismiss button, add the `data-dismiss="alert"` attribute, which triggers the JavaScript functionality. Be sure to use the `<button>` element with it for proper behavior across all devices. +- To animate alerts when dismissing them, be sure to add the `.fade` and `.show` classes. + +You can see this in action with a live demo: + +{% capture example %} +<div class="alert alert-warning alert-dismissible fade show" role="alert"> + <strong>Holy guacamole!</strong> You should check in on some of those fields below. + <button type="button" class="close" data-dismiss="alert" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> +</div> +{% endcapture %} +{% include example.html content=example %} + +## JavaScript behavior + +### Triggers + +Enable dismissal of an alert via JavaScript: + +{% highlight js %} +$('.alert').alert() +{% endhighlight %} + +Or with `data` attributes on a button **within the alert**, as demonstrated above: + +{% highlight html %} +<button type="button" class="close" data-dismiss="alert" aria-label="Close"> + <span aria-hidden="true">×</span> +</button> +{% endhighlight %} + +Note that closing an alert will remove it from the DOM. + +### Methods + +| Method | Description | +| --- | --- | +| `$().alert()` | Makes an alert listen for click events on descendant elements which have the `data-dismiss="alert"` attribute. (Not necessary when using the data-api's auto-initialization.) | +| `$().alert('close')` | Closes an alert by removing it from the DOM. If the `.fade` and `.show` classes are present on the element, the alert will fade out before it is removed. | +| `$().alert('dispose')` | Destroys an element's alert. | + +{% highlight js %}$('.alert').alert('close'){% endhighlight %} + +### Events + +Bootstrap's alert plugin exposes a few events for hooking into alert functionality. + +| Event | Description | +| --- | --- | +| `close.bs.alert` | This event fires immediately when the <code>close</code> instance method is called. | +| `closed.bs.alert` | This event is fired when the alert has been closed (will wait for CSS transitions to complete). | + +{% highlight js %} +$('#myAlert').on('closed.bs.alert', function () { + // do something... +}) +{% endhighlight %} diff --git a/vendor/twbs/bootstrap/site/docs/4.5/components/badge.md b/vendor/twbs/bootstrap/site/docs/4.5/components/badge.md new file mode 100644 index 000000000..8c1760045 --- /dev/null +++ b/vendor/twbs/bootstrap/site/docs/4.5/components/badge.md @@ -0,0 +1,74 @@ +--- +layout: docs +title: Badges +description: Documentation and examples for badges, our small count and labeling component. +group: components +toc: true +--- + +## Example + +Badges scale to match the size of the immediate parent element by using relative font sizing and `em` units. + +{% capture example %} +<h1>Example heading <span class="badge badge-secondary">New</span></h1> +<h2>Example heading <span class="badge badge-secondary">New</span></h2> +<h3>Example heading <span class="badge badge-secondary">New</span></h3> +<h4>Example heading <span class="badge badge-secondary">New</span></h4> +<h5>Example heading <span class="badge badge-secondary">New</span></h5> +<h6>Example heading <span class="badge badge-secondary">New</span></h6> +{% endcapture %} +{% include example.html content=example %} + +Badges can be used as part of links or buttons to provide a counter. + +{% capture example %} +<button type="button" class="btn btn-primary"> + Notifications <span class="badge badge-light">4</span> +</button> +{% endcapture %} +{% include example.html content=example %} + +Note that depending on how they are used, badges may be confusing for users of screen readers and similar assistive technologies. While the styling of badges provides a visual cue as to their purpose, these users will simply be presented with the content of the badge. Depending on the specific situation, these badges may seem like random additional words or numbers at the end of a sentence, link, or button. + +Unless the context is clear (as with the "Notifications" example, where it is understood that the "4" is the number of notifications), consider including additional context with a visually hidden piece of additional text. + +{% capture example %} +<button type="button" class="btn btn-primary"> + Profile <span class="badge badge-light">9</span> + <span class="sr-only">unread messages</span> +</button> +{% endcapture %} +{% include example.html content=example %} + +## Contextual variations + +Add any of the below mentioned modifier classes to change the appearance of a badge. + +{% capture example %} +{% for color in site.data.theme-colors %} +<span class="badge badge-{{ color.name }}">{{ color.name | capitalize }}</span>{% endfor %} +{% endcapture %} +{% include example.html content=example %} + +{% include callout-warning-color-assistive-technologies.md %} + +## Pill badges + +Use the `.badge-pill` modifier class to make badges more rounded (with a larger `border-radius` and additional horizontal `padding`). Useful if you miss the badges from v3. + +{% capture example %} +{% for color in site.data.theme-colors %} +<span class="badge badge-pill badge-{{ color.name }}">{{ color.name | capitalize }}</span>{% endfor %} +{% endcapture %} +{% include example.html content=example %} + +## Links + +Using the contextual `.badge-*` classes on an `<a>` element quickly provide _actionable_ badges with hover and focus states. + +{% capture example %} +{% for color in site.data.theme-colors %} +<a href="#" class="badge badge-{{ color.name }}">{{ color.name | capitalize }}</a>{% endfor %} +{% endcapture %} +{% include example.html content=example %} diff --git a/vendor/twbs/bootstrap/site/docs/4.5/components/breadcrumb.md b/vendor/twbs/bootstrap/site/docs/4.5/components/breadcrumb.md new file mode 100644 index 000000000..f6ce8f1be --- /dev/null +++ b/vendor/twbs/bootstrap/site/docs/4.5/components/breadcrumb.md @@ -0,0 +1,58 @@ +--- +layout: docs +title: Breadcrumb +description: Indicate the current page's location within a navigational hierarchy that automatically adds separators via CSS. +group: components +--- + +## Example + +{% capture example %} +<nav aria-label="breadcrumb"> + <ol class="breadcrumb"> + <li class="breadcrumb-item active" aria-current="page">Home</li> + </ol> +</nav> + +<nav aria-label="breadcrumb"> + <ol class="breadcrumb"> + <li class="breadcrumb-item"><a href="#">Home</a></li> + <li class="breadcrumb-item active" aria-current="page">Library</li> + </ol> +</nav> + +<nav aria-label="breadcrumb"> + <ol class="breadcrumb"> + <li class="breadcrumb-item"><a href="#">Home</a></li> + <li class="breadcrumb-item"><a href="#">Library</a></li> + <li class="breadcrumb-item active" aria-current="page">Data</li> + </ol> +</nav> +{% endcapture %} +{% include example.html content=example %} + +## Changing the separator + +Separators are automatically added in CSS through [`::before`](https://developer.mozilla.org/en-US/docs/Web/CSS/::before) and [`content`](https://developer.mozilla.org/en-US/docs/Web/CSS/content). They can be changed by changing `$breadcrumb-divider`. The [quote](https://sass-lang.com/documentation/modules/string#quote) function is needed to generate the quotes around a string, so if you want `>` as separator, you can use this: + +```scss +$breadcrumb-divider: quote(">"); +``` + +It's also possible to use a **base64 embedded SVG icon**: + +```scss +$breadcrumb-divider: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI4IiBoZWlnaHQ9IjgiPjxwYXRoIGQ9Ik0yLjUgMEwxIDEuNSAzLjUgNCAxIDYuNSAyLjUgOGw0LTQtNC00eiIgZmlsbD0iY3VycmVudENvbG9yIi8+PC9zdmc+); +``` + +The separator can be removed by setting `$breadcrumb-divider` to `none`: + +```scss +$breadcrumb-divider: none; +``` + +## Accessibility + +Since breadcrumbs provide a navigation, it's a good idea to add a meaningful label such as `aria-label="breadcrumb"` to describe the type of navigation provided in the `<nav>` element, as well as applying an `aria-current="page"` to the last item of the set to indicate that it represents the current page. + +For more information, see the [WAI-ARIA Authoring Practices for the breadcrumb pattern](https://www.w3.org/TR/wai-aria-practices/#breadcrumb). diff --git a/vendor/twbs/bootstrap/site/docs/4.5/components/button-group.md b/vendor/twbs/bootstrap/site/docs/4.5/components/button-group.md new file mode 100644 index 000000000..2261a5e72 --- /dev/null +++ b/vendor/twbs/bootstrap/site/docs/4.5/components/button-group.md @@ -0,0 +1,207 @@ +--- +layout: docs +title: Button group +description: Group a series of buttons together on a single line with the button group, and super-power them with JavaScript. +group: components +toc: true +--- + +## Basic example + +Wrap a series of buttons with `.btn` in `.btn-group`. Add on optional JavaScript radio and checkbox style behavior with [our buttons plugin]({{ site.baseurl }}/docs/{{ site.docs_version }}/components/buttons/#button-plugin). + +{% capture example %} +<div class="btn-group" role="group" aria-label="Basic example"> + <button type="button" class="btn btn-secondary">Left</button> + <button type="button" class="btn btn-secondary">Middle</button> + <button type="button" class="btn btn-secondary">Right</button> +</div> +{% endcapture %} +{% include example.html content=example %} + +{% capture callout %} +##### Ensure correct `role` and provide a label + +In order for assistive technologies (such as screen readers) to convey that a series of buttons is grouped, an appropriate `role` attribute needs to be provided. For button groups, this would be `role="group"`, while toolbars should have a `role="toolbar"`. + +In addition, groups and toolbars should be given an explicit label, as most assistive technologies will otherwise not announce them, despite the presence of the correct role attribute. In the examples provided here, we use `aria-label`, but alternatives such as `aria-labelledby` can also be used. +{% endcapture %} +{% include callout.html content=callout type="warning" %} + +## Button toolbar + +Combine sets of button groups into button toolbars for more complex components. Use utility classes as needed to space out groups, buttons, and more. + +{% capture example %} +<div class="btn-toolbar" role="toolbar" aria-label="Toolbar with button groups"> + <div class="btn-group mr-2" role="group" aria-label="First group"> + <button type="button" class="btn btn-secondary">1</button> + <button type="button" class="btn btn-secondary">2</button> + <button type="button" class="btn btn-secondary">3</button> + <button type="button" class="btn btn-secondary">4</button> + </div> + <div class="btn-group mr-2" role="group" aria-label="Second group"> + <button type="button" class="btn btn-secondary">5</button> + <button type="button" class="btn btn-secondary">6</button> + <button type="button" class="btn btn-secondary">7</button> + </div> + <div class="btn-group" role="group" aria-label="Third group"> + <button type="button" class="btn btn-secondary">8</button> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +Feel free to mix input groups with button groups in your toolbars. Similar to the example above, you'll likely need some utilities though to space things properly. + +{% capture example %} +<div class="btn-toolbar mb-3" role="toolbar" aria-label="Toolbar with button groups"> + <div class="btn-group mr-2" role="group" aria-label="First group"> + <button type="button" class="btn btn-secondary">1</button> + <button type="button" class="btn btn-secondary">2</button> + <button type="button" class="btn btn-secondary">3</button> + <button type="button" class="btn btn-secondary">4</button> + </div> + <div class="input-group"> + <div class="input-group-prepend"> + <div class="input-group-text" id="btnGroupAddon">@</div> + </div> + <input type="text" class="form-control" placeholder="Input group example" aria-label="Input group example" aria-describedby="btnGroupAddon"> + </div> +</div> + +<div class="btn-toolbar justify-content-between" role="toolbar" aria-label="Toolbar with button groups"> + <div class="btn-group" role="group" aria-label="First group"> + <button type="button" class="btn btn-secondary">1</button> + <button type="button" class="btn btn-secondary">2</button> + <button type="button" class="btn btn-secondary">3</button> + <button type="button" class="btn btn-secondary">4</button> + </div> + <div class="input-group"> + <div class="input-group-prepend"> + <div class="input-group-text" id="btnGroupAddon2">@</div> + </div> + <input type="text" class="form-control" placeholder="Input group example" aria-label="Input group example" aria-describedby="btnGroupAddon2"> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Sizing + +Instead of applying button sizing classes to every button in a group, just add `.btn-group-*` to each `.btn-group`, including each one when nesting multiple groups. + +<div class="bd-example"> + <div class="btn-group btn-group-lg" role="group" aria-label="Large button group"> + <button type="button" class="btn btn-secondary">Left</button> + <button type="button" class="btn btn-secondary">Middle</button> + <button type="button" class="btn btn-secondary">Right</button> + </div> + <br> + <div class="btn-group" role="group" aria-label="Default button group"> + <button type="button" class="btn btn-secondary">Left</button> + <button type="button" class="btn btn-secondary">Middle</button> + <button type="button" class="btn btn-secondary">Right</button> + </div> + <br> + <div class="btn-group btn-group-sm" role="group" aria-label="Small button group"> + <button type="button" class="btn btn-secondary">Left</button> + <button type="button" class="btn btn-secondary">Middle</button> + <button type="button" class="btn btn-secondary">Right</button> + </div> +</div> + +{% highlight html %} +<div class="btn-group btn-group-lg" role="group" aria-label="...">...</div> +<div class="btn-group" role="group" aria-label="...">...</div> +<div class="btn-group btn-group-sm" role="group" aria-label="...">...</div> +{% endhighlight %} + +## Nesting + +Place a `.btn-group` within another `.btn-group` when you want dropdown menus mixed with a series of buttons. + +{% capture example %} +<div class="btn-group" role="group" aria-label="Button group with nested dropdown"> + <button type="button" class="btn btn-secondary">1</button> + <button type="button" class="btn btn-secondary">2</button> + + <div class="btn-group" role="group"> + <button id="btnGroupDrop1" type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + Dropdown + </button> + <div class="dropdown-menu" aria-labelledby="btnGroupDrop1"> + <a class="dropdown-item" href="#">Dropdown link</a> + <a class="dropdown-item" href="#">Dropdown link</a> + </div> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Vertical variation + +Make a set of buttons appear vertically stacked rather than horizontally. **Split button dropdowns are not supported here.** + +<div class="bd-example"> + <div class="btn-group-vertical" role="group" aria-label="Vertical button group"> + <button type="button" class="btn btn-secondary">Button</button> + <button type="button" class="btn btn-secondary">Button</button> + <button type="button" class="btn btn-secondary">Button</button> + <button type="button" class="btn btn-secondary">Button</button> + <button type="button" class="btn btn-secondary">Button</button> + <button type="button" class="btn btn-secondary">Button</button> + </div> +</div> + + +<div class="bd-example"> + <div class="btn-group-vertical" role="group" aria-label="Vertical button group"> + <button type="button" class="btn btn-secondary">Button</button> + <button type="button" class="btn btn-secondary">Button</button> + <div class="btn-group" role="group"> + <button id="btnGroupVerticalDrop1" type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + Dropdown + </button> + <div class="dropdown-menu" aria-labelledby="btnGroupVerticalDrop1"> + <a class="dropdown-item" href="#">Dropdown link</a> + <a class="dropdown-item" href="#">Dropdown link</a> + </div> + </div> + <button type="button" class="btn btn-secondary">Button</button> + <button type="button" class="btn btn-secondary">Button</button> + <div class="btn-group" role="group"> + <button id="btnGroupVerticalDrop2" type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + Dropdown + </button> + <div class="dropdown-menu" aria-labelledby="btnGroupVerticalDrop2"> + <a class="dropdown-item" href="#">Dropdown link</a> + <a class="dropdown-item" href="#">Dropdown link</a> + </div> + </div> + <div class="btn-group" role="group"> + <button id="btnGroupVerticalDrop3" type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + Dropdown + </button> + <div class="dropdown-menu" aria-labelledby="btnGroupVerticalDrop3"> + <a class="dropdown-item" href="#">Dropdown link</a> + <a class="dropdown-item" href="#">Dropdown link</a> + </div> + </div> + <div class="btn-group" role="group"> + <button id="btnGroupVerticalDrop4" type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + Dropdown + </button> + <div class="dropdown-menu" aria-labelledby="btnGroupVerticalDrop4"> + <a class="dropdown-item" href="#">Dropdown link</a> + <a class="dropdown-item" href="#">Dropdown link</a> + </div> + </div> + </div> +</div> + +{% highlight html %} +<div class="btn-group-vertical"> + ... +</div> +{% endhighlight %} diff --git a/vendor/twbs/bootstrap/site/docs/4.5/components/buttons.md b/vendor/twbs/bootstrap/site/docs/4.5/components/buttons.md new file mode 100644 index 000000000..b0856f5fc --- /dev/null +++ b/vendor/twbs/bootstrap/site/docs/4.5/components/buttons.md @@ -0,0 +1,167 @@ +--- +layout: docs +title: Buttons +description: Use Bootstrap's custom button styles for actions in forms, dialogs, and more with support for multiple sizes, states, and more. +group: components +toc: true +--- + +## Examples + +Bootstrap includes several predefined button styles, each serving its own semantic purpose, with a few extras thrown in for more control. + +{% capture example %} +{% for color in site.data.theme-colors %} +<button type="button" class="btn btn-{{ color.name }}">{{ color.name | capitalize }}</button>{% endfor %} + +<button type="button" class="btn btn-link">Link</button> +{% endcapture %} +{% include example.html content=example %} + +{% include callout-warning-color-assistive-technologies.md %} + +## Disable text wrapping + +If you don't want the button text to wrap, you can add the `.text-nowrap` class to the button. In Sass, you can set `$btn-white-space: nowrap` to disable text wrapping for each button. + +## Button tags + +The `.btn` classes are designed to be used with the `<button>` element. However, you can also use these classes on `<a>` or `<input>` elements (though some browsers may apply a slightly different rendering). + +When using button classes on `<a>` elements that are used to trigger in-page functionality (like collapsing content), rather than linking to new pages or sections within the current page, these links should be given a `role="button"` to appropriately convey their purpose to assistive technologies such as screen readers. + +{% capture example %} +<a class="btn btn-primary" href="#" role="button">Link</a> +<button class="btn btn-primary" type="submit">Button</button> +<input class="btn btn-primary" type="button" value="Input"> +<input class="btn btn-primary" type="submit" value="Submit"> +<input class="btn btn-primary" type="reset" value="Reset"> +{% endcapture %} +{% include example.html content=example %} + +## Outline buttons + +In need of a button, but not the hefty background colors they bring? Replace the default modifier classes with the `.btn-outline-*` ones to remove all background images and colors on any button. + +{% capture example %} +{% for color in site.data.theme-colors %} +<button type="button" class="btn btn-outline-{{ color.name }}">{{ color.name | capitalize }}</button>{% endfor %} +{% endcapture %} +{% include example.html content=example %} + +## Sizes + +Fancy larger or smaller buttons? Add `.btn-lg` or `.btn-sm` for additional sizes. + +{% capture example %} +<button type="button" class="btn btn-primary btn-lg">Large button</button> +<button type="button" class="btn btn-secondary btn-lg">Large button</button> +{% endcapture %} +{% include example.html content=example %} + +{% capture example %} +<button type="button" class="btn btn-primary btn-sm">Small button</button> +<button type="button" class="btn btn-secondary btn-sm">Small button</button> +{% endcapture %} +{% include example.html content=example %} + +Create block level buttons—those that span the full width of a parent—by adding `.btn-block`. + +{% capture example %} +<button type="button" class="btn btn-primary btn-lg btn-block">Block level button</button> +<button type="button" class="btn btn-secondary btn-lg btn-block">Block level button</button> +{% endcapture %} +{% include example.html content=example %} + +## Active state + +Buttons will appear pressed (with a darker background, darker border, and inset shadow) when active. **There's no need to add a class to `<button>`s as they use a pseudo-class**. However, you can still force the same active appearance with `.active` (and include the <code>aria-pressed="true"</code> attribute) should you need to replicate the state programmatically. + +{% capture example %} +<a href="#" class="btn btn-primary btn-lg active" role="button" aria-pressed="true">Primary link</a> +<a href="#" class="btn btn-secondary btn-lg active" role="button" aria-pressed="true">Link</a> +{% endcapture %} +{% include example.html content=example %} + +## Disabled state + +Make buttons look inactive by adding the `disabled` boolean attribute to any `<button>` element. + +{% capture example %} +<button type="button" class="btn btn-lg btn-primary" disabled>Primary button</button> +<button type="button" class="btn btn-secondary btn-lg" disabled>Button</button> +{% endcapture %} +{% include example.html content=example %} + +Disabled buttons using the `<a>` element behave a bit different: + +- `<a>`s don't support the `disabled` attribute, so you must add the `.disabled` class to make it visually appear disabled. +- Some future-friendly styles are included to disable all `pointer-events` on anchor buttons. In browsers which support that property, you won't see the disabled cursor at all. +- Disabled buttons should include the `aria-disabled="true"` attribute to indicate the state of the element to assistive technologies. + +{% capture 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> +{% endcapture %} +{% include example.html content=example %} + +{% capture callout %} +##### Link functionality caveat + +The `.disabled` class uses `pointer-events: none` to try to disable the link functionality of `<a>`s, but that CSS property is not yet standardized. In addition, even in browsers that do support `pointer-events: none`, 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, add a `tabindex="-1"` attribute on these links (to prevent them from receiving keyboard focus) and use custom JavaScript to disable their functionality. +{% endcapture %} +{% include callout.html content=callout type="warning" %} + +## Button plugin + +Do more with buttons. Control button states or create groups of buttons for more components like toolbars. + +### Toggle states + +Add `data-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 the `<button>`. + +{% capture example %} +<button type="button" class="btn btn-primary" data-toggle="button" aria-pressed="false"> + Single toggle +</button> +{% endcapture %} +{% include example.html content=example %} + +### Checkbox and radio buttons + +Bootstrap's `.button` styles can be applied to other elements, such as `<label>`s, to provide checkbox or radio style button toggling. Add `data-toggle="buttons"` to a `.btn-group` containing those modified buttons to enable their toggling behavior via JavaScript and add `.btn-group-toggle` to style the `<input>`s within your buttons. **Note that you can create single input-powered buttons or groups of them.** + +The checked state for these buttons is **only updated via `click` event** on the button. If you use another method to update the input—e.g., with `<input type="reset">` or by manually applying the input's `checked` property—you'll need to toggle `.active` on the `<label>` manually. + +Note that pre-checked buttons require you to manually add the `.active` class to the input's `<label>`. + +{% capture example %} +<div class="btn-group-toggle" data-toggle="buttons"> + <label class="btn btn-secondary active"> + <input type="checkbox" checked> Checked + </label> +</div> +{% endcapture %} +{% include example.html content=example %} + +{% capture example %} +<div class="btn-group btn-group-toggle" data-toggle="buttons"> + <label class="btn btn-secondary active"> + <input type="radio" name="options" id="option1" checked> Active + </label> + <label class="btn btn-secondary"> + <input type="radio" name="options" id="option2"> Radio + </label> + <label class="btn btn-secondary"> + <input type="radio" name="options" id="option3"> Radio + </label> +</div> +{% endcapture %} +{% include example.html content=example %} + +### Methods + +| Method | Description | +| --- | --- | +| `$().button('toggle')` | Toggles push state. Gives the button the appearance that it has been activated. | +| `$().button('dispose')` | Destroys an element's button. | diff --git a/vendor/twbs/bootstrap/site/docs/4.5/components/card.md b/vendor/twbs/bootstrap/site/docs/4.5/components/card.md new file mode 100644 index 000000000..18e1c0fab --- /dev/null +++ b/vendor/twbs/bootstrap/site/docs/4.5/components/card.md @@ -0,0 +1,875 @@ +--- +layout: docs +title: Cards +description: Bootstrap's cards provide a flexible and extensible content container with multiple variants and options. +group: components +toc: true +--- + +## About + +A **card** is a flexible and extensible content container. It includes options for headers and footers, a wide variety of content, contextual background colors, and powerful display options. If you're familiar with Bootstrap 3, cards replace our old panels, wells, and thumbnails. Similar functionality to those components is available as modifier classes for cards. + +## Example + +Cards are built with as little markup and styles as possible, but still manage to deliver a ton of control and customization. Built with flexbox, they offer easy alignment and mix well with other Bootstrap components. They have no `margin` by default, so use [spacing utilities]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/spacing/) as needed. + +Below is an example of a basic card with mixed content and a fixed width. Cards have no fixed width to start, so they'll naturally fill the full width of its parent element. This is easily customized with our various [sizing options](#sizing). + +{% capture example %} +<div class="card" style="width: 18rem;"> + {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> + <a href="#" class="btn btn-primary">Go somewhere</a> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Content types + +Cards support a wide variety of content, including images, text, list groups, links, and more. Below are examples of what's supported. + +### Body + +The building block of a card is the `.card-body`. Use it whenever you need a padded section within a card. + +{% capture example %} +<div class="card"> + <div class="card-body"> + This is some text within a card body. + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +### Titles, text, and links + +Card titles are used by adding `.card-title` to a `<h*>` tag. In the same way, links are added and placed next to each other by adding `.card-link` to an `<a>` tag. + +Subtitles are used by adding a `.card-subtitle` to a `<h*>` tag. If the `.card-title` and the `.card-subtitle` items are placed in a `.card-body` item, the card title and subtitle are aligned nicely. + +{% capture example %} +<div class="card" style="width: 18rem;"> + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6> + <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> + <a href="#" class="card-link">Card link</a> + <a href="#" class="card-link">Another link</a> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +### Images + +`.card-img-top` places an image to the top of the card. With `.card-text`, text can be added to the card. Text within `.card-text` can also be styled with the standard HTML tags. + +{% capture example %} +<div class="card" style="width: 18rem;"> + {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +### List groups + +Create lists of content in a card with a flush list group. + +{% capture example %} +<div class="card" style="width: 18rem;"> + <ul class="list-group list-group-flush"> + <li class="list-group-item">Cras justo odio</li> + <li class="list-group-item">Dapibus ac facilisis in</li> + <li class="list-group-item">Vestibulum at eros</li> + </ul> +</div> +{% endcapture %} +{% include example.html content=example %} + +{% capture example %} +<div class="card" style="width: 18rem;"> + <div class="card-header"> + Featured + </div> + <ul class="list-group list-group-flush"> + <li class="list-group-item">Cras justo odio</li> + <li class="list-group-item">Dapibus ac facilisis in</li> + <li class="list-group-item">Vestibulum at eros</li> + </ul> +</div> +{% endcapture %} +{% include example.html content=example %} + +{% capture example %} +<div class="card" style="width: 18rem;"> + <ul class="list-group list-group-flush"> + <li class="list-group-item">Cras justo odio</li> + <li class="list-group-item">Dapibus ac facilisis in</li> + <li class="list-group-item">Vestibulum at eros</li> + </ul> + <div class="card-footer"> + Card footer + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +### Kitchen sink + +Mix and match multiple content types to create the card you need, or throw everything in there. Shown below are image styles, blocks, text styles, and a list group—all wrapped in a fixed-width card. + +{% capture example %} +<div class="card" style="width: 18rem;"> + {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> + </div> + <ul class="list-group list-group-flush"> + <li class="list-group-item">Cras justo odio</li> + <li class="list-group-item">Dapibus ac facilisis in</li> + <li class="list-group-item">Vestibulum at eros</li> + </ul> + <div class="card-body"> + <a href="#" class="card-link">Card link</a> + <a href="#" class="card-link">Another link</a> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +### Header and footer + +Add an optional header and/or footer within a card. + +{% capture example %} +<div class="card"> + <div class="card-header"> + Featured + </div> + <div class="card-body"> + <h5 class="card-title">Special title treatment</h5> + <p class="card-text">With supporting text below as a natural lead-in to additional content.</p> + <a href="#" class="btn btn-primary">Go somewhere</a> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +Card headers can be styled by adding `.card-header` to `<h*>` elements. + +{% capture example %} +<div class="card"> + <h5 class="card-header">Featured</h5> + <div class="card-body"> + <h5 class="card-title">Special title treatment</h5> + <p class="card-text">With supporting text below as a natural lead-in to additional content.</p> + <a href="#" class="btn btn-primary">Go somewhere</a> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +{% capture example %} +<div class="card"> + <div class="card-header"> + Quote + </div> + <div class="card-body"> + <blockquote class="blockquote mb-0"> + <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p> + <footer class="blockquote-footer">Someone famous in <cite title="Source Title">Source Title</cite></footer> + </blockquote> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +{% capture example %} +<div class="card text-center"> + <div class="card-header"> + Featured + </div> + <div class="card-body"> + <h5 class="card-title">Special title treatment</h5> + <p class="card-text">With supporting text below as a natural lead-in to additional content.</p> + <a href="#" class="btn btn-primary">Go somewhere</a> + </div> + <div class="card-footer text-muted"> + 2 days ago + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Sizing + +Cards assume no specific `width` to start, so they'll be 100% wide unless otherwise stated. You can change this as needed with custom CSS, grid classes, grid Sass mixins, or utilities. + +### Using grid markup + +Using the grid, wrap cards in columns and rows as needed. + +{% capture example %} +<div class="row"> + <div class="col-sm-6"> + <div class="card"> + <div class="card-body"> + <h5 class="card-title">Special title treatment</h5> + <p class="card-text">With supporting text below as a natural lead-in to additional content.</p> + <a href="#" class="btn btn-primary">Go somewhere</a> + </div> + </div> + </div> + <div class="col-sm-6"> + <div class="card"> + <div class="card-body"> + <h5 class="card-title">Special title treatment</h5> + <p class="card-text">With supporting text below as a natural lead-in to additional content.</p> + <a href="#" class="btn btn-primary">Go somewhere</a> + </div> + </div> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +### Using utilities + +Use our handful of [available sizing utilities]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/sizing/) to quickly set a card's width. + +{% capture example %} +<div class="card w-75"> + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">With supporting text below as a natural lead-in to additional content.</p> + <a href="#" class="btn btn-primary">Button</a> + </div> +</div> + +<div class="card w-50"> + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">With supporting text below as a natural lead-in to additional content.</p> + <a href="#" class="btn btn-primary">Button</a> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +### Using custom CSS + +Use custom CSS in your stylesheets or as inline styles to set a width. + +{% capture example %} +<div class="card" style="width: 18rem;"> + <div class="card-body"> + <h5 class="card-title">Special title treatment</h5> + <p class="card-text">With supporting text below as a natural lead-in to additional content.</p> + <a href="#" class="btn btn-primary">Go somewhere</a> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Text alignment + +You can quickly change the text alignment of any card—in its entirety or specific parts—with our [text align classes]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/text/#text-alignment). + +{% capture example %} +<div class="card" style="width: 18rem;"> + <div class="card-body"> + <h5 class="card-title">Special title treatment</h5> + <p class="card-text">With supporting text below as a natural lead-in to additional content.</p> + <a href="#" class="btn btn-primary">Go somewhere</a> + </div> +</div> + +<div class="card text-center" style="width: 18rem;"> + <div class="card-body"> + <h5 class="card-title">Special title treatment</h5> + <p class="card-text">With supporting text below as a natural lead-in to additional content.</p> + <a href="#" class="btn btn-primary">Go somewhere</a> + </div> +</div> + +<div class="card text-right" style="width: 18rem;"> + <div class="card-body"> + <h5 class="card-title">Special title treatment</h5> + <p class="card-text">With supporting text below as a natural lead-in to additional content.</p> + <a href="#" class="btn btn-primary">Go somewhere</a> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Navigation + +Add some navigation to a card's header (or block) with Bootstrap's [nav components]({{ site.baseurl }}/docs/{{ site.docs_version }}/components/navs/). + +{% capture example %} +<div class="card text-center"> + <div class="card-header"> + <ul class="nav nav-tabs card-header-tabs"> + <li class="nav-item"> + <a class="nav-link active" href="#">Active</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Link</a> + </li> + <li class="nav-item"> + <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> + </li> + </ul> + </div> + <div class="card-body"> + <h5 class="card-title">Special title treatment</h5> + <p class="card-text">With supporting text below as a natural lead-in to additional content.</p> + <a href="#" class="btn btn-primary">Go somewhere</a> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +{% capture example %} +<div class="card text-center"> + <div class="card-header"> + <ul class="nav nav-pills card-header-pills"> + <li class="nav-item"> + <a class="nav-link active" href="#">Active</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Link</a> + </li> + <li class="nav-item"> + <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> + </li> + </ul> + </div> + <div class="card-body"> + <h5 class="card-title">Special title treatment</h5> + <p class="card-text">With supporting text below as a natural lead-in to additional content.</p> + <a href="#" class="btn btn-primary">Go somewhere</a> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Images + +Cards include a few options for working with images. Choose from appending "image caps" at either end of a card, overlaying images with card content, or simply embedding the image in a card. + +### Image caps + +Similar to headers and footers, cards can include top and bottom "image caps"—images at the top or bottom of a card. + +<div class="bd-example"> + <div class="card mb-3"> + {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> + <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p> + </div> + </div> + <div class="card"> + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> + <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p> + </div> + {% include icons/placeholder.svg width="100%" height="180" class="card-img-bottom" text="Image cap" %} + </div> +</div> + +{% highlight html %} +<div class="card mb-3"> + <img src="..." class="card-img-top" alt="..."> + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> + <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p> + </div> +</div> +<div class="card"> + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> + <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p> + </div> + <img src="..." class="card-img-bottom" alt="..."> +</div> +{% endhighlight %} + +### Image overlays + +Turn an image into a card background and overlay your card's text. Depending on the image, you may or may not need additional styles or utilities. + +{% capture example %} +<div class="card bg-dark text-white"> + {% include icons/placeholder.svg width="100%" height="270" class="bd-placeholder-img-lg card-img" text="Card image" %} + <div class="card-img-overlay"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> + <p class="card-text">Last updated 3 mins ago</p> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +{% capture callout %} +Note that content should not be larger than the height of the image. If content is larger than the image the content will be displayed outside the image. +{% endcapture %} +{% include callout.html content=callout type="info" %} + +## Horizontal + +Using a combination of grid and utility classes, cards can be made horizontal in a mobile-friendly and responsive way. In the example below, we remove the grid gutters with `.no-gutters` and use `.col-md-*` classes to make the card horizontal at the `md` breakpoint. Further adjustments may be needed depending on your card content. + +{% capture example %} +<div class="card mb-3" style="max-width: 540px;"> + <div class="row no-gutters"> + <div class="col-md-4"> + {% include icons/placeholder.svg width="100%" height="250" class="" text="Image" %} + </div> + <div class="col-md-8"> + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> + <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p> + </div> + </div> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Card styles + +Cards include various options for customizing their backgrounds, borders, and color. + +### Background and color + +Use [text and background utilities]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/colors/) to change the appearance of a card. + +{% capture example %} +{% for color in site.data.theme-colors %} +<div class="card{% unless color.name == "light" %} text-white{% endunless %} bg-{{ color.name }} mb-3" style="max-width: 18rem;"> + <div class="card-header">Header</div> + <div class="card-body"> + <h5 class="card-title">{{ color.name | capitalize }} card title</h5> + <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> + </div> +</div>{% endfor %} +{% endcapture %} +{% include example.html content=example %} + +{% include callout-warning-color-assistive-technologies.md %} + +### Border + +Use [border utilities]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/borders/) to change just the `border-color` of a card. Note that you can put `.text-{color}` classes on the parent `.card` or a subset of the card's contents as shown below. + +{% capture example %} +{% for color in site.data.theme-colors %} +<div class="card border-{{ color.name }} mb-3" style="max-width: 18rem;"> + <div class="card-header">Header</div> + <div class="card-body{% unless color.name == "light" %} text-{{ color.name }}{% endunless %}"> + <h5 class="card-title">{{ color.name | capitalize }} card title</h5> + <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> + </div> +</div>{% endfor %} +{% endcapture %} +{% include example.html content=example %} + +### Mixins utilities + +You can also change the borders on the card header and footer as needed, and even remove their `background-color` with `.bg-transparent`. + +{% capture example %} +<div class="card border-success mb-3" style="max-width: 18rem;"> + <div class="card-header bg-transparent border-success">Header</div> + <div class="card-body text-success"> + <h5 class="card-title">Success card title</h5> + <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> + </div> + <div class="card-footer bg-transparent border-success">Footer</div> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Card layout + +In addition to styling the content within cards, Bootstrap includes a few options for laying out series of cards. For the time being, **these layout options are not yet responsive**. + +### Card groups + +Use card groups to render cards as a single, attached element with equal width and height columns. Card groups start off stacked and use `display: flex;` to become attached with uniform dimensions starting at the `sm` breakpoint. + +{% capture example %} +<div class="card-group"> + <div class="card"> + {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> + <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p> + </div> + </div> + <div class="card"> + {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p> + <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p> + </div> + </div> + <div class="card"> + {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p> + <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p> + </div> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +When using card groups with footers, their content will automatically line up. + +{% capture example %} +<div class="card-group"> + <div class="card"> + {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> + </div> + <div class="card-footer"> + <small class="text-muted">Last updated 3 mins ago</small> + </div> + </div> + <div class="card"> + {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p> + </div> + <div class="card-footer"> + <small class="text-muted">Last updated 3 mins ago</small> + </div> + </div> + <div class="card"> + {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p> + </div> + <div class="card-footer"> + <small class="text-muted">Last updated 3 mins ago</small> + </div> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +### Card decks + +Need a set of equal width and height cards that aren't attached to one another? Use card decks. + +{% capture example %} +<div class="card-deck"> + <div class="card"> + {% include icons/placeholder.svg width="100%" height="200" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> + <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p> + </div> + </div> + <div class="card"> + {% include icons/placeholder.svg width="100%" height="200" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p> + <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p> + </div> + </div> + <div class="card"> + {% include icons/placeholder.svg width="100%" height="200" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p> + <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p> + </div> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +Just like with card groups, card footers in decks will automatically line up. + +{% capture example %} +<div class="card-deck"> + <div class="card"> + {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> + </div> + <div class="card-footer"> + <small class="text-muted">Last updated 3 mins ago</small> + </div> + </div> + <div class="card"> + {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p> + </div> + <div class="card-footer"> + <small class="text-muted">Last updated 3 mins ago</small> + </div> + </div> + <div class="card"> + {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p> + </div> + <div class="card-footer"> + <small class="text-muted">Last updated 3 mins ago</small> + </div> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +### Grid cards + +Use the Bootstrap grid system and its [`.row-cols` classes]({{ site.baseurl }}/docs/{{ site.docs_version }}/layout/grid/#row-columns) to control how many grid columns (wrapped around your cards) you show per row. For example, here's `.row-cols-1` laying out the cards on one column, and `.row-cols-md-2` splitting four cards to equal width across multiple rows, from the medium breakpoint up. + +{% capture example %} +<div class="row row-cols-1 row-cols-md-2"> + <div class="col mb-4"> + <div class="card"> + {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> + </div> + </div> + </div> + <div class="col mb-4"> + <div class="card"> + {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> + </div> + </div> + </div> + <div class="col mb-4"> + <div class="card"> + {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content.</p> + </div> + </div> + </div> + <div class="col mb-4"> + <div class="card"> + {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> + </div> + </div> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +Change it to `.row-cols-3` and you'll see the fourth card wrap. + +{% capture example %} +<div class="row row-cols-1 row-cols-md-3"> + <div class="col mb-4"> + <div class="card"> + {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> + </div> + </div> + </div> + <div class="col mb-4"> + <div class="card"> + {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> + </div> + </div> + </div> + <div class="col mb-4"> + <div class="card"> + {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content.</p> + </div> + </div> + </div> + <div class="col mb-4"> + <div class="card"> + {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> + </div> + </div> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +When you need equal height, add `.h-100` to the cards. If you want equal heights by default, you can set `$card-height: 100%` in Sass. + +{% capture example %} +<div class="row row-cols-1 row-cols-md-3"> + <div class="col mb-4"> + <div class="card h-100"> + {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> + </div> + </div> + </div> + <div class="col mb-4"> + <div class="card h-100"> + {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a short card.</p> + </div> + </div> + </div> + <div class="col mb-4"> + <div class="card h-100"> + {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content.</p> + </div> + </div> + </div> + <div class="col mb-4"> + <div class="card h-100"> + {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> + </div> + </div> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +### Card columns + +Cards can be organized into [Masonry](https://masonry.desandro.com/)-like columns with just CSS by wrapping them in `.card-columns`. Cards are built with CSS `column` properties instead of flexbox for easier alignment. Cards are ordered from top to bottom and left to right. + +**Heads up!** Your mileage with card columns may vary. To prevent cards breaking across columns, we must set them to `display: inline-block` as `column-break-inside: avoid` isn't a bulletproof solution yet. + +{% capture example %} +<div class="card-columns"> + <div class="card"> + {% include icons/placeholder.svg width="100%" height="160" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title that wraps to a new line</h5> + <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> + </div> + </div> + <div class="card p-3"> + <blockquote class="blockquote mb-0 card-body"> + <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p> + <footer class="blockquote-footer"> + <small class="text-muted"> + Someone famous in <cite title="Source Title">Source Title</cite> + </small> + </footer> + </blockquote> + </div> + <div class="card"> + {% include icons/placeholder.svg width="100%" height="160" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p> + <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p> + </div> + </div> + <div class="card bg-primary text-white text-center p-3"> + <blockquote class="blockquote mb-0"> + <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat.</p> + <footer class="blockquote-footer text-white"> + <small> + Someone famous in <cite title="Source Title">Source Title</cite> + </small> + </footer> + </blockquote> + </div> + <div class="card text-center"> + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This card has a regular title and short paragraphy of text below it.</p> + <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p> + </div> + </div> + <div class="card"> + {% include icons/placeholder.svg width="100%" height="260" class="card-img" text="Card image" %} + </div> + <div class="card p-3 text-right"> + <blockquote class="blockquote mb-0"> + <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p> + <footer class="blockquote-footer"> + <small class="text-muted"> + Someone famous in <cite title="Source Title">Source Title</cite> + </small> + </footer> + </blockquote> + </div> + <div class="card"> + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is another card with title and supporting text below. This card has some additional content to make it slightly taller overall.</p> + <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p> + </div> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +Card columns can also be extended and customized with some additional code. Shown below is an extension of the `.card-columns` class using the same CSS we use—CSS columns— to generate a set of responsive tiers for changing the number of columns. + +{% highlight scss %} +.card-columns { + @include media-breakpoint-only(lg) { + column-count: 4; + } + @include media-breakpoint-only(xl) { + column-count: 5; + } +} +{% endhighlight %} diff --git a/vendor/twbs/bootstrap/site/docs/4.5/components/carousel.md b/vendor/twbs/bootstrap/site/docs/4.5/components/carousel.md new file mode 100644 index 000000000..cdb0c6488 --- /dev/null +++ b/vendor/twbs/bootstrap/site/docs/4.5/components/carousel.md @@ -0,0 +1,362 @@ +--- +layout: docs +title: Carousel +description: A slideshow component for cycling through elements—images or slides of text—like a carousel. +group: components +toc: true +--- + +## How it works + +The carousel is a slideshow for cycling through a series of content, built with CSS 3D transforms and a bit of JavaScript. It works with a series of images, text, or custom markup. It also includes support for previous/next controls and indicators. + +In browsers where the [Page Visibility API](https://www.w3.org/TR/page-visibility/) is supported, the carousel will avoid sliding when the webpage is not visible to the user (such as when the browser tab is inactive, the browser window is minimized, etc.). + +{% include callout-info-prefersreducedmotion.md %} + +Please be aware that nested carousels are not supported, and carousels are generally not compliant with accessibility standards. + +Lastly, if you're building our JavaScript from source, it [requires `util.js`]({{ site.baseurl }}/docs/{{ site.docs_version }}/getting-started/javascript/#util). + +## Example + +Carousels don't automatically normalize slide dimensions. As such, you may need to use additional utilities or custom styles to appropriately size content. While carousels support previous/next controls and indicators, they're not explicitly required. Add and customize as you see fit. + +**The `.active` class needs to be added to one of the slides** otherwise the carousel will not be visible. Also be sure to set a unique id on the `.carousel` for optional controls, especially if you're using multiple carousels on a single page. Control and indicator elements must have a `data-target` attribute (or `href` for links) that matches the id of the `.carousel` element. + +### Slides only + +Here's a carousel with slides only. Note the presence of the `.d-block` and `.w-100` on carousel images to prevent browser default image alignment. + +{% capture example %} +<div id="carouselExampleSlidesOnly" class="carousel slide" data-ride="carousel"> + <div class="carousel-inner"> + <div class="carousel-item active"> + {% include icons/placeholder.svg width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#555" background="#777" text="First slide" %} + </div> + <div class="carousel-item"> + {% include icons/placeholder.svg width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#444" background="#666" text="Second slide" %} + </div> + <div class="carousel-item"> + {% include icons/placeholder.svg width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#333" background="#555" text="Third slide" %} + </div> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +### With controls + +Adding in the previous and next controls: + +{% capture example %} +<div id="carouselExampleControls" class="carousel slide" data-ride="carousel"> + <div class="carousel-inner"> + <div class="carousel-item active"> + {% include icons/placeholder.svg width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#555" background="#777" text="First slide" %} + </div> + <div class="carousel-item"> + {% include icons/placeholder.svg width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#444" background="#666" text="Second slide" %} + </div> + <div class="carousel-item"> + {% include icons/placeholder.svg width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#333" background="#555" text="Third slide" %} + </div> + </div> + <a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev"> + <span class="carousel-control-prev-icon" aria-hidden="true"></span> + <span class="sr-only">Previous</span> + </a> + <a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next"> + <span class="carousel-control-next-icon" aria-hidden="true"></span> + <span class="sr-only">Next</span> + </a> +</div> +{% endcapture %} +{% include example.html content=example %} + +### With indicators + +You can also add the indicators to the carousel, alongside the controls, too. + +{% capture example %} +<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel"> + <ol class="carousel-indicators"> + <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li> + <li data-target="#carouselExampleIndicators" data-slide-to="1"></li> + <li data-target="#carouselExampleIndicators" data-slide-to="2"></li> + </ol> + <div class="carousel-inner"> + <div class="carousel-item active"> + {% include icons/placeholder.svg width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#555" background="#777" text="First slide" %} + </div> + <div class="carousel-item"> + {% include icons/placeholder.svg width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#444" background="#666" text="Second slide" %} + </div> + <div class="carousel-item"> + {% include icons/placeholder.svg width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#333" background="#555" text="Third slide" %} + </div> + </div> + <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev"> + <span class="carousel-control-prev-icon" aria-hidden="true"></span> + <span class="sr-only">Previous</span> + </a> + <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next"> + <span class="carousel-control-next-icon" aria-hidden="true"></span> + <span class="sr-only">Next</span> + </a> +</div> +{% endcapture %} +{% include example.html content=example %} + +### With captions + +Add captions to your slides easily with the `.carousel-caption` element within any `.carousel-item`. They can be easily hidden on smaller viewports, as shown below, with optional [display utilities]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/display/). We hide them initially with `.d-none` and bring them back on medium-sized devices with `.d-md-block`. + +{% capture example %} +<div id="carouselExampleCaptions" class="carousel slide" data-ride="carousel"> + <ol class="carousel-indicators"> + <li data-target="#carouselExampleCaptions" data-slide-to="0" class="active"></li> + <li data-target="#carouselExampleCaptions" data-slide-to="1"></li> + <li data-target="#carouselExampleCaptions" data-slide-to="2"></li> + </ol> + <div class="carousel-inner"> + <div class="carousel-item active"> + {% include icons/placeholder.svg width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#555" background="#777" text="First slide" %} + <div class="carousel-caption d-none d-md-block"> + <h5>First slide label</h5> + <p>Nulla vitae elit libero, a pharetra augue mollis interdum.</p> + </div> + </div> + <div class="carousel-item"> + {% include icons/placeholder.svg width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#444" background="#666" text="Second slide" %} + <div class="carousel-caption d-none d-md-block"> + <h5>Second slide label</h5> + <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p> + </div> + </div> + <div class="carousel-item"> + {% include icons/placeholder.svg width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#333" background="#555" text="Third slide" %} + <div class="carousel-caption d-none d-md-block"> + <h5>Third slide label</h5> + <p>Praesent commodo cursus magna, vel scelerisque nisl consectetur.</p> + </div> + </div> + </div> + <a class="carousel-control-prev" href="#carouselExampleCaptions" role="button" data-slide="prev"> + <span class="carousel-control-prev-icon" aria-hidden="true"></span> + <span class="sr-only">Previous</span> + </a> + <a class="carousel-control-next" href="#carouselExampleCaptions" role="button" data-slide="next"> + <span class="carousel-control-next-icon" aria-hidden="true"></span> + <span class="sr-only">Next</span> + </a> +</div> +{% endcapture %} +{% include example.html content=example %} + +### Crossfade + +Add `.carousel-fade` to your carousel to animate slides with a fade transition instead of a slide. + +{% capture example %} +<div id="carouselExampleFade" class="carousel slide carousel-fade" data-ride="carousel"> + <div class="carousel-inner"> + <div class="carousel-item active"> + {% include icons/placeholder.svg width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#555" background="#777" text="First slide" %} + </div> + <div class="carousel-item"> + {% include icons/placeholder.svg width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#444" background="#666" text="Second slide" %} + </div> + <div class="carousel-item"> + {% include icons/placeholder.svg width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#333" background="#555" text="Third slide" %} + </div> + </div> + <a class="carousel-control-prev" href="#carouselExampleFade" role="button" data-slide="prev"> + <span class="carousel-control-prev-icon" aria-hidden="true"></span> + <span class="sr-only">Previous</span> + </a> + <a class="carousel-control-next" href="#carouselExampleFade" role="button" data-slide="next"> + <span class="carousel-control-next-icon" aria-hidden="true"></span> + <span class="sr-only">Next</span> + </a> +</div> +{% endcapture %} +{% include example.html content=example %} + +### Individual `.carousel-item` interval + +Add `data-interval=""` to a `.carousel-item` to change the amount of time to delay between automatically cycling to the next item. + +{% capture example %} +<div id="carouselExampleInterval" class="carousel slide" data-ride="carousel"> + <div class="carousel-inner"> + <div class="carousel-item active" data-interval="10000"> + {% include icons/placeholder.svg width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#555" background="#777" text="First slide" %} + </div> + <div class="carousel-item" data-interval="2000"> + {% include icons/placeholder.svg width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#444" background="#666" text="Second slide" %} + </div> + <div class="carousel-item"> + {% include icons/placeholder.svg width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#333" background="#555" text="Third slide" %} + </div> + </div> + <a class="carousel-control-prev" href="#carouselExampleInterval" role="button" data-slide="prev"> + <span class="carousel-control-prev-icon" aria-hidden="true"></span> + <span class="sr-only">Previous</span> + </a> + <a class="carousel-control-next" href="#carouselExampleInterval" role="button" data-slide="next"> + <span class="carousel-control-next-icon" aria-hidden="true"></span> + <span class="sr-only">Next</span> + </a> +</div> +{% endcapture %} +{% include example.html content=example %} + + +## Usage + +### Via data attributes + +Use data attributes to easily control the position of the carousel. `data-slide` accepts the keywords `prev` or `next`, which alters the slide position relative to its current position. Alternatively, use `data-slide-to` to pass a raw slide index to the carousel `data-slide-to="2"`, which shifts the slide position to a particular index beginning with `0`. + +The `data-ride="carousel"` attribute is used to mark a carousel as animating starting at page load. If you don't use `data-ride="carousel"` to initialize your carousel, you have to initialize it yourself. **It cannot be used in combination with (redundant and unnecessary) explicit JavaScript initialization of the same carousel.** + +### Via JavaScript + +Call carousel manually with: + +{% highlight js %} +$('.carousel').carousel() +{% endhighlight %} + +### Options + +Options can be passed via data attributes or JavaScript. For data attributes, append the option name to `data-`, as in `data-interval=""`. + +<table class="table table-bordered table-striped"> + <thead> + <tr> + <th style="width: 100px;">Name</th> + <th style="width: 50px;">Type</th> + <th style="width: 50px;">Default</th> + <th>Description</th> + </tr> + </thead> + <tbody> + <tr> + <td>interval</td> + <td>number</td> + <td>5000</td> + <td>The amount of time to delay between automatically cycling an item. If false, carousel will not automatically cycle.</td> + </tr> + <tr> + <td>keyboard</td> + <td>boolean</td> + <td>true</td> + <td>Whether the carousel should react to keyboard events.</td> + </tr> + <tr> + <td>pause</td> + <td>string | boolean</td> + <td>"hover"</td> + <td><p>If set to <code>"hover"</code>, pauses the cycling of the carousel on <code>mouseenter</code> and resumes the cycling of the carousel on <code>mouseleave</code>. If set to <code>false</code>, hovering over the carousel won't pause it.</p> + <p>On touch-enabled devices, when set to <code>"hover"</code>, cycling will pause on <code>touchend</code> (once the user finished interacting with the carousel) for two intervals, before automatically resuming. Note that this is in addition to the above mouse behavior.</p></td> + </tr> + <tr> + <td>ride</td> + <td>string</td> + <td>false</td> + <td>Autoplays the carousel after the user manually cycles the first item. If "carousel", autoplays the carousel on load.</td> + </tr> + <tr> + <td>wrap</td> + <td>boolean</td> + <td>true</td> + <td>Whether the carousel should cycle continuously or have hard stops.</td> + </tr> + <tr> + <td>touch</td> + <td>boolean</td> + <td>true</td> + <td>Whether the carousel should support left/right swipe interactions on touchscreen devices.</td> + </tr> + </tbody> +</table> + +### Methods + +{% include callout-danger-async-methods.md %} + +#### `.carousel(options)` + +Initializes the carousel with an optional options `object` and starts cycling through items. + +{% highlight js %} +$('.carousel').carousel({ + interval: 2000 +}) +{% endhighlight %} + +#### `.carousel('cycle')` + +Cycles through the carousel items from left to right. + +#### `.carousel('pause')` + +Stops the carousel from cycling through items. + +#### `.carousel(number)` + +Cycles the carousel to a particular frame (0 based, similar to an array). **Returns to the caller before the target item has been shown** (i.e. before the `slid.bs.carousel` event occurs). + +#### `.carousel('prev')` + +Cycles to the previous item. **Returns to the caller before the previous item has been shown** (i.e. before the `slid.bs.carousel` event occurs). + +#### `.carousel('next')` + +Cycles to the next item. **Returns to the caller before the next item has been shown** (i.e. before the `slid.bs.carousel` event occurs). + +#### `.carousel('dispose')` + +Destroys an element's carousel. + +### Events + +Bootstrap's carousel class exposes two events for hooking into carousel functionality. Both events have the following additional properties: + +- `direction`: The direction in which the carousel is sliding (either `"left"` or `"right"`). +- `relatedTarget`: The DOM element that is being slid into place as the active item. +- `from`: The index of the current item +- `to`: The index of the next item + +All carousel events are fired at the carousel itself (i.e. at the `<div class="carousel">`). + +<table class="table table-bordered table-striped"> + <thead> + <tr> + <th style="width: 150px;">Event Type</th> + <th>Description</th> + </tr> + </thead> + <tbody> + <tr> + <td>slide.bs.carousel</td> + <td>This event fires immediately when the <code>slide</code> instance method is invoked.</td> + </tr> + <tr> + <td>slid.bs.carousel</td> + <td>This event is fired when the carousel has completed its slide transition.</td> + </tr> + </tbody> +</table> + +{% highlight js %} +$('#myCarousel').on('slide.bs.carousel', function () { + // do something... +}) +{% endhighlight %} + +### Change transition duration + +The transition duration of `.carousel-item` can be changed with the `$carousel-transition` Sass variable before compiling or custom styles if you're using the compiled CSS. If multiple transitions are applied, make sure the transform transition is defined first (eg. `transition: transform 2s ease, opacity .5s ease-out`). diff --git a/vendor/twbs/bootstrap/site/docs/4.5/components/collapse.md b/vendor/twbs/bootstrap/site/docs/4.5/components/collapse.md new file mode 100644 index 000000000..bcc321ef8 --- /dev/null +++ b/vendor/twbs/bootstrap/site/docs/4.5/components/collapse.md @@ -0,0 +1,251 @@ +--- +layout: docs +title: Collapse +description: Toggle the visibility of content across your project with a few classes and our JavaScript plugins. +group: components +toc: true +--- + +## How it works + +The collapse JavaScript plugin is used to show and hide content. Buttons or anchors are used as triggers that are mapped to specific elements you toggle. Collapsing an element will animate the `height` from its current value to `0`. Given how CSS handles animations, you cannot use `padding` on a `.collapse` element. Instead, use the class as an independent wrapping element. + +{% include callout-info-prefersreducedmotion.md %} + +## Example + +Click the buttons below to show and hide another element via class changes: + +- `.collapse` hides content +- `.collapsing` is applied during transitions +- `.collapse.show` shows content + +You can use a link with the `href` attribute, or a button with the `data-target` attribute. In both cases, the `data-toggle="collapse"` is required. + +{% capture example %} +<p> + <a class="btn btn-primary" data-toggle="collapse" href="#collapseExample" role="button" aria-expanded="false" aria-controls="collapseExample"> + Link with href + </a> + <button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample"> + Button with data-target + </button> +</p> +<div class="collapse" id="collapseExample"> + <div class="card card-body"> + Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Multiple targets + +A `<button>` or `<a>` can show and hide multiple elements by referencing them with a JQuery selector in its `href` or `data-target` attribute. +Multiple `<button>` or `<a>` can show and hide an element if they each reference it with their `href` or `data-target` attribute + +{% capture example %} +<p> + <a class="btn btn-primary" data-toggle="collapse" href="#multiCollapseExample1" role="button" aria-expanded="false" aria-controls="multiCollapseExample1">Toggle first element</a> + <button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#multiCollapseExample2" aria-expanded="false" aria-controls="multiCollapseExample2">Toggle second element</button> + <button class="btn btn-primary" type="button" data-toggle="collapse" data-target=".multi-collapse" aria-expanded="false" aria-controls="multiCollapseExample1 multiCollapseExample2">Toggle both elements</button> +</p> +<div class="row"> + <div class="col"> + <div class="collapse multi-collapse" id="multiCollapseExample1"> + <div class="card card-body"> + Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. + </div> + </div> + </div> + <div class="col"> + <div class="collapse multi-collapse" id="multiCollapseExample2"> + <div class="card card-body"> + Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. + </div> + </div> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Accordion example + +Using the [card]({{ site.baseurl }}/docs/{{ site.docs_version }}/components/card/) component, you can extend the default collapse behavior to create an accordion. To properly achieve the accordion style, be sure to use `.accordion` as a wrapper. + +{% capture example %} +<div class="accordion" id="accordionExample"> + <div class="card"> + <div class="card-header" id="headingOne"> + <h2 class="mb-0"> + <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne"> + Collapsible Group Item #1 + </button> + </h2> + </div> + + <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordionExample"> + <div class="card-body"> + Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. + </div> + </div> + </div> + <div class="card"> + <div class="card-header" id="headingTwo"> + <h2 class="mb-0"> + <button class="btn btn-link btn-block text-left collapsed" type="button" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo"> + Collapsible Group Item #2 + </button> + </h2> + </div> + <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordionExample"> + <div class="card-body"> + Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. + </div> + </div> + </div> + <div class="card"> + <div class="card-header" id="headingThree"> + <h2 class="mb-0"> + <button class="btn btn-link btn-block text-left collapsed" type="button" data-toggle="collapse" data-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree"> + Collapsible Group Item #3 + </button> + </h2> + </div> + <div id="collapseThree" class="collapse" aria-labelledby="headingThree" data-parent="#accordionExample"> + <div class="card-body"> + Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. + </div> + </div> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Accessibility + +Be sure to add `aria-expanded` to the control element. This attribute explicitly conveys the current state of the collapsible element tied to the control to screen readers and similar assistive technologies. If the collapsible element is closed by default, the attribute on the control element should have a value of `aria-expanded="false"`. If you've set the collapsible element to be open by default using the `show` class, set `aria-expanded="true"` on the control instead. The plugin will automatically toggle this attribute on the control based on whether or not the collapsible element has been opened or closed (via JavaScript, or because the user triggered another control element also tied to the same collapsible element). If the control element's HTML element is not a button (e.g., an `<a>` or `<div>`), the attribute `role="button"` should be added to the element. + +If your control element is targeting a single collapsible element – i.e. the `data-target` attribute is pointing to an `id` selector – you should add the `aria-controls` attribute to the control element, containing the `id` of the collapsible element. Modern screen readers and similar assistive technologies make use of this attribute to provide users with additional shortcuts to navigate directly to the collapsible element itself. + +Note that Bootstrap's current implementation does not cover the various keyboard interactions described in the [WAI-ARIA Authoring Practices 1.1 accordion pattern](https://www.w3.org/TR/wai-aria-practices-1.1/#accordion) - you will need to include these yourself with custom JavaScript. + +## Usage + +The collapse plugin utilizes a few classes to handle the heavy lifting: + +- `.collapse` hides the content +- `.collapse.show` shows the content +- `.collapsing` is added when the transition starts, and removed when it finishes + +These classes can be found in `_transitions.scss`. + +### Via data attributes + +Just add `data-toggle="collapse"` and a `data-target` to the element to automatically assign control of one or more collapsible elements. The `data-target` attribute accepts a CSS selector to apply the collapse to. Be sure to add the class `collapse` to the collapsible element. If you'd like it to default open, add the additional class `show`. + +To add accordion-like group management to a collapsible area, add the data attribute `data-parent="#selector"`. Refer to the demo to see this in action. + +### Via JavaScript + +Enable manually with: + +{% highlight js %} +$('.collapse').collapse() +{% endhighlight %} + +### Options + +Options can be passed via data attributes or JavaScript. For data attributes, append the option name to `data-`, as in `data-parent=""`. + +<table class="table table-bordered table-striped"> + <thead> + <tr> + <th style="width: 100px;">Name</th> + <th style="width: 50px;">Type</th> + <th style="width: 50px;">Default</th> + <th>Description</th> + </tr> + </thead> + <tbody> + <tr> + <td>parent</td> + <td>selector | jQuery object | DOM element </td> + <td>false</td> + <td>If parent is provided, then all collapsible elements under the specified parent will be closed when this collapsible item is shown. (similar to traditional accordion behavior - this is dependent on the <code>card</code> class). The attribute has to be set on the target collapsible area.</td> + </tr> + <tr> + <td>toggle</td> + <td>boolean</td> + <td>true</td> + <td>Toggles the collapsible element on invocation</td> + </tr> + </tbody> +</table> + +### Methods + +{% include callout-danger-async-methods.md %} + +#### `.collapse(options)` + +Activates your content as a collapsible element. Accepts an optional options `object`. + +{% highlight js %} +$('#myCollapsible').collapse({ + toggle: false +}) +{% endhighlight %} + +#### `.collapse('toggle')` + +Toggles a collapsible element to shown or hidden. **Returns to the caller before the collapsible element has actually been shown or hidden** (i.e. before the `shown.bs.collapse` or `hidden.bs.collapse` event occurs). + +#### `.collapse('show')` + +Shows a collapsible element. **Returns to the caller before the collapsible element has actually been shown** (i.e. before the `shown.bs.collapse` event occurs). + +#### `.collapse('hide')` + +Hides a collapsible element. **Returns to the caller before the collapsible element has actually been hidden** (i.e. before the `hidden.bs.collapse` event occurs). + +#### `.collapse('dispose')` + +Destroys an element's collapse. + +### Events + +Bootstrap's collapse class exposes a few events for hooking into collapse functionality. + +<table class="table table-bordered table-striped"> + <thead> + <tr> + <th style="width: 150px;">Event Type</th> + <th>Description</th> + </tr> + </thead> + <tbody> + <tr> + <td>show.bs.collapse</td> + <td>This event fires immediately when the <code>show</code> instance method is called.</td> + </tr> + <tr> + <td>shown.bs.collapse</td> + <td>This event is fired when a collapse element has been made visible to the user (will wait for CSS transitions to complete).</td> + </tr> + <tr> + <td>hide.bs.collapse</td> + <td>This event is fired immediately when the <code>hide</code> method has been called.</td> + </tr> + <tr> + <td>hidden.bs.collapse</td> + <td>This event is fired when a collapse element has been hidden from the user (will wait for CSS transitions to complete).</td> + </tr> + </tbody> +</table> + +{% highlight js %} +$('#myCollapsible').on('hidden.bs.collapse', function () { + // do something... +}) +{% endhighlight %} diff --git a/vendor/twbs/bootstrap/site/docs/4.5/components/dropdowns.md b/vendor/twbs/bootstrap/site/docs/4.5/components/dropdowns.md new file mode 100644 index 000000000..6b8ca2eac --- /dev/null +++ b/vendor/twbs/bootstrap/site/docs/4.5/components/dropdowns.md @@ -0,0 +1,915 @@ +--- +layout: docs +title: Dropdowns +description: Toggle contextual overlays for displaying lists of links and more with the Bootstrap dropdown plugin. +group: components +toc: true +--- + +## Overview + +Dropdowns are toggleable, contextual overlays for displaying lists of links and more. They're made interactive with the included Bootstrap dropdown JavaScript plugin. They're toggled by clicking, not by hovering; this is [an intentional design decision](https://markdotto.com/2012/02/27/bootstrap-explained-dropdowns/). + +Dropdowns are built on a third party library, [Popper.js](https://popper.js.org/), which provides dynamic positioning and viewport detection. Be sure to include [popper.min.js]({{ site.cdn.popper }}) before Bootstrap's JavaScript or use `bootstrap.bundle.min.js` / `bootstrap.bundle.js` which contains Popper.js. Popper.js isn't used to position dropdowns in navbars though as dynamic positioning isn't required. + +If you're building our JavaScript from source, it [requires `util.js`]({{ site.baseurl }}/docs/{{ site.docs_version }}/getting-started/javascript/#util). + +## Accessibility + +The [<abbr title="Web Accessibility Initiative">WAI</abbr> <abbr title="Accessible Rich Internet Applications">ARIA</abbr>](https://www.w3.org/TR/wai-aria/) standard defines an actual [`role="menu"` widget](https://www.w3.org/WAI/PF/aria/roles#menu), but this is specific to application-like menus which trigger actions or functions. <abbr title="Accessible Rich Internet Applications">ARIA</abbr> menus can only contain menu items, checkbox menu items, radio button menu items, radio button groups, and sub-menus. + +Bootstrap's dropdowns, on the other hand, are designed to be generic and applicable to a variety of situations and markup structures. For instance, it is possible to create dropdowns that contain additional inputs and form controls, such as search fields or login forms. For this reason, Bootstrap does not expect (nor automatically add) any of the `role` and `aria-` attributes required for true <abbr title="Accessible Rich Internet Applications">ARIA</abbr> menus. Authors will have to include these more specific attributes themselves. + +However, Bootstrap does add built-in support for most standard keyboard menu interactions, such as the ability to move through individual `.dropdown-item` elements using the cursor keys and close the menu with the <kbd>ESC</kbd> key. + +## Examples + +Wrap the dropdown's toggle (your button or link) and the dropdown menu within `.dropdown`, or another element that declares `position: relative;`. Dropdowns can be triggered from `<a>` or `<button>` elements to better fit your potential needs. + +### Single button + +Any single `.btn` can be turned into a dropdown toggle with some markup changes. Here's how you can put them to work with either `<button>` elements: + +{% capture example %} +<div class="dropdown"> + <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + Dropdown button + </button> + <div class="dropdown-menu" aria-labelledby="dropdownMenuButton"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +And with `<a>` elements: + +{% capture example %} +<div class="dropdown"> + <a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + Dropdown link + </a> + + <div class="dropdown-menu" aria-labelledby="dropdownMenuLink"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +The best part is you can do this with any button variant, too: + +<div class="bd-example"> + <div class="btn-group"> + <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Primary</button> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> + </div><!-- /btn-group --> + <div class="btn-group"> + <button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Secondary</button> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> + </div><!-- /btn-group --> + <div class="btn-group"> + <button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Success</button> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> + </div><!-- /btn-group --> + <div class="btn-group"> + <button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Info</button> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> + </div><!-- /btn-group --> + <div class="btn-group"> + <button type="button" class="btn btn-warning dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Warning</button> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> + </div><!-- /btn-group --> + <div class="btn-group"> + <button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Danger</button> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> + </div><!-- /btn-group --> +</div> + +{% highlight html %} +<!-- Example single danger button --> +<div class="btn-group"> + <button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + Action + </button> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> +</div> +{% endhighlight %} + +### Split button + +Similarly, create split button dropdowns with virtually the same markup as single button dropdowns, but with the addition of `.dropdown-toggle-split` for proper spacing around the dropdown caret. + +We use this extra class to reduce the horizontal `padding` on either side of the caret by 25% and remove the `margin-left` that's added for regular button dropdowns. Those extra changes keep the caret centered in the split button and provide a more appropriately sized hit area next to the main button. + +<div class="bd-example"> + <div class="btn-group"> + <button type="button" class="btn btn-primary">Primary</button> + <button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + <span class="sr-only">Toggle Dropdown</span> + </button> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> + </div><!-- /btn-group --> + <div class="btn-group"> + <button type="button" class="btn btn-secondary">Secondary</button> + <button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + <span class="sr-only">Toggle Dropdown</span> + </button> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> + </div><!-- /btn-group --> + <div class="btn-group"> + <button type="button" class="btn btn-success">Success</button> + <button type="button" class="btn btn-success dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + <span class="sr-only">Toggle Dropdown</span> + </button> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> + </div><!-- /btn-group --> + <div class="btn-group"> + <button type="button" class="btn btn-info">Info</button> + <button type="button" class="btn btn-info dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + <span class="sr-only">Toggle Dropdown</span> + </button> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> + </div><!-- /btn-group --> + <div class="btn-group"> + <button type="button" class="btn btn-warning">Warning</button> + <button type="button" class="btn btn-warning dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + <span class="sr-only">Toggle Dropdown</span> + </button> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> + </div><!-- /btn-group --> + <div class="btn-group"> + <button type="button" class="btn btn-danger">Danger</button> + <button type="button" class="btn btn-danger dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + <span class="sr-only">Toggle Dropdown</span> + </button> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> + </div><!-- /btn-group --> +</div> + +{% highlight html %} +<!-- Example split danger button --> +<div class="btn-group"> + <button type="button" class="btn btn-danger">Action</button> + <button type="button" class="btn btn-danger dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + <span class="sr-only">Toggle Dropdown</span> + </button> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> +</div> +{% endhighlight %} + +## Sizing + +Button dropdowns work with buttons of all sizes, including default and split dropdown buttons. + +<div class="bd-example"> + <div class="btn-toolbar" role="toolbar"> + <div class="btn-group"> + <button class="btn btn-secondary btn-lg dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + Large button + </button> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> + </div><!-- /btn-group --> + <div class="btn-group ml-2"> + <button type="button" class="btn btn-lg btn-secondary">Large split button</button> + <button type="button" class="btn btn-lg btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + <span class="sr-only">Toggle Dropdown</span> + </button> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> + </div><!-- /btn-group --> + </div><!-- /btn-toolbar --> + <div class="btn-toolbar" role="toolbar"> + <div class="btn-group"> + <button class="btn btn-secondary btn-sm dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + Small button + </button> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> + </div><!-- /btn-group --> + <div class="btn-group ml-2"> + <button type="button" class="btn btn-sm btn-secondary">Small split button</button> + <button type="button" class="btn btn-sm btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + <span class="sr-only">Toggle Dropdown</span> + </button> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> + </div><!-- /btn-group --> + </div><!-- /btn-toolbar --> +</div><!-- /example --> + +{% highlight html %} +<!-- Large button groups (default and split) --> +<div class="btn-group"> + <button class="btn btn-secondary btn-lg dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + Large button + </button> + <div class="dropdown-menu"> + ... + </div> +</div> +<div class="btn-group"> + <button class="btn btn-secondary btn-lg" type="button"> + Large split button + </button> + <button type="button" class="btn btn-lg btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + <span class="sr-only">Toggle Dropdown</span> + </button> + <div class="dropdown-menu"> + ... + </div> +</div> + +<!-- Small button groups (default and split) --> +<div class="btn-group"> + <button class="btn btn-secondary btn-sm dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + Small button + </button> + <div class="dropdown-menu"> + ... + </div> +</div> +<div class="btn-group"> + <button class="btn btn-secondary btn-sm" type="button"> + Small split button + </button> + <button type="button" class="btn btn-sm btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + <span class="sr-only">Toggle Dropdown</span> + </button> + <div class="dropdown-menu"> + ... + </div> +</div> +{% endhighlight %} + +## Directions + +### Dropup + +Trigger dropdown menus above elements by adding `.dropup` to the parent element. + +<div class="bd-example"> + <div class="btn-group dropup"> + <button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + Dropup + </button> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> + </div> + + <div class="btn-group dropup"> + <button type="button" class="btn btn-secondary"> + Split dropup + </button> + <button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + <span class="sr-only">Toggle Dropdown</span> + </button> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> + </div> +</div> + +{% highlight html %} +<!-- Default dropup button --> +<div class="btn-group dropup"> + <button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + Dropup + </button> + <div class="dropdown-menu"> + <!-- Dropdown menu links --> + </div> +</div> + +<!-- Split dropup button --> +<div class="btn-group dropup"> + <button type="button" class="btn btn-secondary"> + Split dropup + </button> + <button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + <span class="sr-only">Toggle Dropdown</span> + </button> + <div class="dropdown-menu"> + <!-- Dropdown menu links --> + </div> +</div> +{% endhighlight %} + +### Dropright + +Trigger dropdown menus at the right of the elements by adding `.dropright` to the parent element. + +<div class="bd-example"> + <div class="btn-group dropright"> + <button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + Dropright + </button> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> + </div> + + <div class="btn-group dropright"> + <button type="button" class="btn btn-secondary"> + Split dropright + </button> + <button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + <span class="sr-only">Toggle Dropright</span> + </button> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> + </div> +</div> + +{% highlight html %} +<!-- Default dropright button --> +<div class="btn-group dropright"> + <button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + Dropright + </button> + <div class="dropdown-menu"> + <!-- Dropdown menu links --> + </div> +</div> + +<!-- Split dropright button --> +<div class="btn-group dropright"> + <button type="button" class="btn btn-secondary"> + Split dropright + </button> + <button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + <span class="sr-only">Toggle Dropright</span> + </button> + <div class="dropdown-menu"> + <!-- Dropdown menu links --> + </div> +</div> +{% endhighlight %} + +### Dropleft + +Trigger dropdown menus at the left of the elements by adding `.dropleft` to the parent element. + +<div class="bd-example"> + <div class="btn-group dropleft"> + <button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + Dropleft + </button> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> + </div> + + <div class="btn-group"> + <div class="btn-group dropleft" role="group"> + <button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + <span class="sr-only">Toggle Dropleft</span> + </button> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> + </div> + <button type="button" class="btn btn-secondary"> + Split dropleft + </button> + </div> +</div> + +{% highlight html %} +<!-- Default dropleft button --> +<div class="btn-group dropleft"> + <button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + Dropleft + </button> + <div class="dropdown-menu"> + <!-- Dropdown menu links --> + </div> +</div> + +<!-- Split dropleft button --> +<div class="btn-group"> + <div class="btn-group dropleft" role="group"> + <button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + <span class="sr-only">Toggle Dropleft</span> + </button> + <div class="dropdown-menu"> + <!-- Dropdown menu links --> + </div> + </div> + <button type="button" class="btn btn-secondary"> + Split dropleft + </button> +</div> +{% endhighlight %} + +## Menu items + +Historically dropdown menu contents *had* to be links, but that's no longer the case with v4. Now you can optionally use `<button>` elements in your dropdowns instead of just `<a>`s. + +{% capture example %} +<div class="dropdown"> + <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + Dropdown + </button> + <div class="dropdown-menu" aria-labelledby="dropdownMenu2"> + <button class="dropdown-item" type="button">Action</button> + <button class="dropdown-item" type="button">Another action</button> + <button class="dropdown-item" type="button">Something else here</button> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +You can also create non-interactive dropdown items with `.dropdown-item-text`. Feel free to style further with custom CSS or text utilities. + +{% capture example %} +<div class="dropdown-menu"> + <span class="dropdown-item-text">Dropdown item text</span> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> +</div> +{% endcapture %} +{% include example.html content=example %} + +### Active + +Add `.active` to items in the dropdown to **style them as active**. + +{% capture example %} +<div class="dropdown-menu"> + <a class="dropdown-item" href="#">Regular link</a> + <a class="dropdown-item active" href="#">Active link</a> + <a class="dropdown-item" href="#">Another link</a> +</div> +{% endcapture %} +{% include example.html content=example %} + +### Disabled + +Add `.disabled` to items in the dropdown to **style them as disabled**. + +{% capture example %} +<div class="dropdown-menu"> + <a class="dropdown-item" href="#">Regular link</a> + <a class="dropdown-item disabled" href="#" tabindex="-1" aria-disabled="true">Disabled link</a> + <a class="dropdown-item" href="#">Another link</a> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Menu alignment + +By default, a dropdown menu is automatically positioned 100% from the top and along the left side of its parent. Add `.dropdown-menu-right` to a `.dropdown-menu` to right align the dropdown menu. + +{% capture callout %} +**Heads up!** Dropdowns are positioned thanks to Popper.js (except when they are contained in a navbar). +{% endcapture %} +{% include callout.html content=callout type="info" %} + +{% capture example %} +<div class="btn-group"> + <button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + Right-aligned menu + </button> + <div class="dropdown-menu dropdown-menu-right"> + <button class="dropdown-item" type="button">Action</button> + <button class="dropdown-item" type="button">Another action</button> + <button class="dropdown-item" type="button">Something else here</button> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +### Responsive alignment + +If you want to use responsive alignment, disable dynamic positioning by adding the `data-display="static"` attribute and use the responsive variation classes. + +To align **right** the dropdown menu with the given breakpoint or larger, add `.dropdown-menu{-sm|-md|-lg|-xl}-right`. + +{% capture example %} +<div class="btn-group"> + <button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" data-display="static" aria-haspopup="true" aria-expanded="false"> + Left-aligned but right aligned when large screen + </button> + <div class="dropdown-menu dropdown-menu-lg-right"> + <button class="dropdown-item" type="button">Action</button> + <button class="dropdown-item" type="button">Another action</button> + <button class="dropdown-item" type="button">Something else here</button> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +To align **left** the dropdown menu with the given breakpoint or larger, add `.dropdown-menu-right` and `.dropdown-menu{-sm|-md|-lg|-xl}-left`. + +{% capture example %} +<div class="btn-group"> + <button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" data-display="static" aria-haspopup="true" aria-expanded="false"> + Right-aligned but left aligned when large screen + </button> + <div class="dropdown-menu dropdown-menu-right dropdown-menu-lg-left"> + <button class="dropdown-item" type="button">Action</button> + <button class="dropdown-item" type="button">Another action</button> + <button class="dropdown-item" type="button">Something else here</button> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +Note that you don't need to add a `data-display="static"` attribute to dropdown buttons in navbars, since Popper.js isn't used in navbars. + +## Menu content + +### Headers + +Add a header to label sections of actions in any dropdown menu. + +{% capture example %} +<div class="dropdown-menu"> + <h6 class="dropdown-header">Dropdown header</h6> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> +</div> +{% endcapture %} +{% include example.html content=example %} + +### Dividers + +Separate groups of related menu items with a divider. + +{% capture example %} +<div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> +</div> +{% endcapture %} +{% include example.html content=example %} + +### Text + +Place any freeform text within a dropdown menu with text and use [spacing utilities]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/spacing/). Note that you'll likely need additional sizing styles to constrain the menu width. + +{% capture example %} +<div class="dropdown-menu p-4 text-muted" style="max-width: 200px;"> + <p> + Some example text that's free-flowing within the dropdown menu. + </p> + <p class="mb-0"> + And this is more example text. + </p> +</div> +{% endcapture %} +{% include example.html content=example %} + +### Forms + +Put a form within a dropdown menu, or make it into a dropdown menu, and use [margin or padding utilities]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/spacing/) to give it the negative space you require. + +{% capture example %} +<div class="dropdown-menu"> + <form class="px-4 py-3"> + <div class="form-group"> + <label for="exampleDropdownFormEmail1">Email address</label> + <input type="email" class="form-control" id="exampleDropdownFormEmail1" placeholder="email@example.com"> + </div> + <div class="form-group"> + <label for="exampleDropdownFormPassword1">Password</label> + <input type="password" class="form-control" id="exampleDropdownFormPassword1" placeholder="Password"> + </div> + <div class="form-group"> + <div class="form-check"> + <input type="checkbox" class="form-check-input" id="dropdownCheck"> + <label class="form-check-label" for="dropdownCheck"> + Remember me + </label> + </div> + </div> + <button type="submit" class="btn btn-primary">Sign in</button> + </form> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">New around here? Sign up</a> + <a class="dropdown-item" href="#">Forgot password?</a> +</div> +{% endcapture %} +{% include example.html content=example %} + +{% capture example %} +<form class="dropdown-menu p-4"> + <div class="form-group"> + <label for="exampleDropdownFormEmail2">Email address</label> + <input type="email" class="form-control" id="exampleDropdownFormEmail2" placeholder="email@example.com"> + </div> + <div class="form-group"> + <label for="exampleDropdownFormPassword2">Password</label> + <input type="password" class="form-control" id="exampleDropdownFormPassword2" placeholder="Password"> + </div> + <div class="form-group"> + <div class="form-check"> + <input type="checkbox" class="form-check-input" id="dropdownCheck2"> + <label class="form-check-label" for="dropdownCheck2"> + Remember me + </label> + </div> + </div> + <button type="submit" class="btn btn-primary">Sign in</button> +</form> +{% endcapture %} +{% include example.html content=example %} + +## Dropdown options + +Use `data-offset` or `data-reference` to change the location of the dropdown. + +{% capture example %} +<div class="d-flex"> + <div class="dropdown mr-1"> + <button type="button" class="btn btn-secondary dropdown-toggle" id="dropdownMenuOffset" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-offset="10,20"> + Offset + </button> + <div class="dropdown-menu" aria-labelledby="dropdownMenuOffset"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + </div> + </div> + <div class="btn-group"> + <button type="button" class="btn btn-secondary">Reference</button> + <button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" id="dropdownMenuReference" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-reference="parent"> + <span class="sr-only">Toggle Dropdown</span> + </button> + <div class="dropdown-menu" aria-labelledby="dropdownMenuReference"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Usage + +Via data attributes or JavaScript, the dropdown plugin toggles hidden content (dropdown menus) by toggling the `.show` class on the parent list item. The `data-toggle="dropdown"` attribute is relied on for closing dropdown menus at an application level, so it's a good idea to always use it. + +{% capture callout %} +On touch-enabled devices, opening a dropdown adds empty (`$.noop`) `mouseover` handlers to the immediate children of the `<body>` element. This admittedly ugly hack is necessary to work around a [quirk in iOS' event delegation](https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html), which would otherwise prevent a tap anywhere outside of the dropdown from triggering the code that closes the dropdown. Once the dropdown is closed, these additional empty `mouseover` handlers are removed. +{% endcapture %} +{% include callout.html content=callout type="info" %} + +### Via data attributes + +Add `data-toggle="dropdown"` to a link or button to toggle a dropdown. + +{% highlight html %} +<div class="dropdown"> + <button id="dLabel" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + Dropdown trigger + </button> + <div class="dropdown-menu" aria-labelledby="dLabel"> + ... + </div> +</div> +{% endhighlight %} + +### Via JavaScript + +Call the dropdowns via JavaScript: + +{% highlight js %} +$('.dropdown-toggle').dropdown() +{% endhighlight %} + +{% capture callout %} +##### `data-toggle="dropdown"` still required + +Regardless of whether you call your dropdown via JavaScript or instead use the data-api, `data-toggle="dropdown"` is always required to be present on the dropdown's trigger element. +{% endcapture %} +{% include callout.html content=callout type="info" %} + +### Options + +Options can be passed via data attributes or JavaScript. For data attributes, append the option name to `data-`, as in `data-offset=""`. + +<table class="table table-bordered table-striped"> + <thead> + <tr> + <th style="width: 100px;">Name</th> + <th style="width: 100px;">Type</th> + <th style="width: 50px;">Default</th> + <th>Description</th> + </tr> + </thead> + <tbody> + <tr> + <td>offset</td> + <td>number | string | function</td> + <td>0</td> + <td> + <p>Offset of the dropdown relative to its target.</p> + <p>When a function is used to determine the offset, it is called with an object containing the offset data as its first argument. The function must return an object with the same structure. The triggering element DOM node is passed as the second argument.</p> + <p>For more information refer to Popper.js's <a href="https://popper.js.org/docs/v1/#modifiers..offset.offset">offset docs</a>.</p> + </td> + </tr> + <tr> + <td>flip</td> + <td>boolean</td> + <td>true</td> + <td>Allow Dropdown to flip in case of an overlapping on the reference element. For more information refer to Popper.js's <a href="https://popper.js.org/docs/v1/#modifiers..flip.enabled">flip docs</a>.</td> + </tr> + <tr> + <td>boundary</td> + <td>string | element</td> + <td>'scrollParent'</td> + <td>Overflow constraint boundary of the dropdown menu. Accepts the values of <code>'viewport'</code>, <code>'window'</code>, <code>'scrollParent'</code>, or an HTMLElement reference (JavaScript only). For more information refer to Popper.js's <a href="https://popper.js.org/docs/v1/#modifiers..preventOverflow.boundariesElement">preventOverflow docs</a>.</td> + </tr> + <tr> + <td>reference</td> + <td>string | element</td> + <td>'toggle'</td> + <td>Reference element of the dropdown menu. Accepts the values of <code>'toggle'</code>, <code>'parent'</code>, or an HTMLElement reference. For more information refer to Popper.js's <a href="https://popper.js.org/docs/v1/#referenceObject">referenceObject docs</a>.</td> + </tr> + <tr> + <td>display</td> + <td>string</td> + <td>'dynamic'</td> + <td>By default, we use Popper.js for dynamic positioning. Disable this with <code>static</code>.</td> + </tr> + <tr> + <td>popperConfig</td> + <td>null | object</td> + <td>null</td> + <td>To change Bootstrap's default Popper.js config, see <a href="https://popper.js.org/docs/v1/#Popper.Defaults">Popper.js's configuration</a></td> + </tr> + </tbody> +</table> + +Note when `boundary` is set to any value other than `'scrollParent'`, the style `position: static` is applied to the `.dropdown` container. + +### Methods + +| Method | Description | +| --- | --- | +| `$().dropdown('toggle')` | Toggles the dropdown menu of a given navbar or tabbed navigation. | +| `$().dropdown('show')` | Shows the dropdown menu of a given navbar or tabbed navigation. | +| `$().dropdown('hide')` | Hides the dropdown menu of a given navbar or tabbed navigation. | +| `$().dropdown('update')` | Updates the position of an element's dropdown. | +| `$().dropdown('dispose')` | Destroys an element's dropdown. | + +### Events + +All dropdown events are fired at the `.dropdown-menu`'s parent element and have a `relatedTarget` property, whose value is the toggling anchor element. +`hide.bs.dropdown` and `hidden.bs.dropdown` events have a `clickEvent` property (only when the original event type is `click`) that contains an Event Object for the click event. + +| Event | Description | +| --- | --- | +| `show.bs.dropdown` | This event fires immediately when the show instance method is called. | +| `shown.bs.dropdown` | This event is fired when the dropdown has been made visible to the user (will wait for CSS transitions, to complete). | +| `hide.bs.dropdown` | This event is fired immediately when the hide instance method has been called. | +| `hidden.bs.dropdown`| This event is fired when the dropdown has finished being hidden from the user (will wait for CSS transitions, to complete). | + +{% highlight js %} +$('#myDropdown').on('show.bs.dropdown', function () { + // do something... +}) +{% endhighlight %} diff --git a/vendor/twbs/bootstrap/site/docs/4.5/components/forms.md b/vendor/twbs/bootstrap/site/docs/4.5/components/forms.md new file mode 100644 index 000000000..4a8f62947 --- /dev/null +++ b/vendor/twbs/bootstrap/site/docs/4.5/components/forms.md @@ -0,0 +1,1457 @@ +--- +layout: docs +title: Forms +description: Examples and usage guidelines for form control styles, layout options, and custom components for creating a wide variety of forms. +group: components +toc: true +--- + +## Overview + +Bootstrap's form controls expand on [our Rebooted form styles]({{ site.baseurl }}/docs/{{ site.docs_version }}/content/reboot/#forms) with classes. Use these classes to opt into their customized displays for a more consistent rendering across browsers and devices. + +Be sure to use an appropriate `type` attribute on all inputs (e.g., `email` for email address or `number` for numerical information) to take advantage of newer input controls like email verification, number selection, and more. + +Here's a quick example to demonstrate Bootstrap's form styles. Keep reading for documentation on required classes, form layout, and more. + +{% capture example %} +<form> + <div class="form-group"> + <label for="exampleInputEmail1">Email address</label> + <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp"> + <small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small> + </div> + <div class="form-group"> + <label for="exampleInputPassword1">Password</label> + <input type="password" class="form-control" id="exampleInputPassword1"> + </div> + <div class="form-group form-check"> + <input type="checkbox" class="form-check-input" id="exampleCheck1"> + <label class="form-check-label" for="exampleCheck1">Check me out</label> + </div> + <button type="submit" class="btn btn-primary">Submit</button> +</form> +{% endcapture %} +{% include example.html content=example %} + +## Form controls + +Textual form controls—like `<input>`s, `<select>`s, and `<textarea>`s—are styled with the `.form-control` class. Included are styles for general appearance, focus state, sizing, and more. + +Be sure to explore our [custom forms](#custom-forms) to further style `<select>`s. + +{% capture example %} +<form> + <div class="form-group"> + <label for="exampleFormControlInput1">Email address</label> + <input type="email" class="form-control" id="exampleFormControlInput1" placeholder="name@example.com"> + </div> + <div class="form-group"> + <label for="exampleFormControlSelect1">Example select</label> + <select class="form-control" id="exampleFormControlSelect1"> + <option>1</option> + <option>2</option> + <option>3</option> + <option>4</option> + <option>5</option> + </select> + </div> + <div class="form-group"> + <label for="exampleFormControlSelect2">Example multiple select</label> + <select multiple class="form-control" id="exampleFormControlSelect2"> + <option>1</option> + <option>2</option> + <option>3</option> + <option>4</option> + <option>5</option> + </select> + </div> + <div class="form-group"> + <label for="exampleFormControlTextarea1">Example textarea</label> + <textarea class="form-control" id="exampleFormControlTextarea1" rows="3"></textarea> + </div> +</form> +{% endcapture %} +{% include example.html content=example %} + +For file inputs, swap the `.form-control` for `.form-control-file`. + +{% capture example %} +<form> + <div class="form-group"> + <label for="exampleFormControlFile1">Example file input</label> + <input type="file" class="form-control-file" id="exampleFormControlFile1"> + </div> +</form> +{% endcapture %} +{% include example.html content=example %} + +### Sizing + +Set heights using classes like `.form-control-lg` and `.form-control-sm`. + +{% capture example %} +<input class="form-control form-control-lg" type="text" placeholder=".form-control-lg"> +<input class="form-control" type="text" placeholder="Default input"> +<input class="form-control form-control-sm" type="text" placeholder=".form-control-sm"> +{% endcapture %} +{% include example.html content=example %} + +{% capture example %} +<select class="form-control form-control-lg"> + <option>Large select</option> +</select> +<select class="form-control"> + <option>Default select</option> +</select> +<select class="form-control form-control-sm"> + <option>Small select</option> +</select> +{% endcapture %} +{% include example.html content=example %} + +### Readonly + +Add the `readonly` boolean attribute on an input to prevent modification of the input's value. Read-only inputs appear lighter (just like disabled inputs), but retain the standard cursor. + +{% capture example %} +<input class="form-control" type="text" placeholder="Readonly input here..." readonly> +{% endcapture %} +{% include example.html content=example %} + +### Readonly plain text + +If you want to have `<input readonly>` elements in your form styled as plain text, use the `.form-control-plaintext` class to remove the default form field styling and preserve the correct margin and padding. + +{% capture example %} +<form> + <div class="form-group row"> + <label for="staticEmail" class="col-sm-2 col-form-label">Email</label> + <div class="col-sm-10"> + <input type="text" readonly class="form-control-plaintext" id="staticEmail" value="email@example.com"> + </div> + </div> + <div class="form-group row"> + <label for="inputPassword" class="col-sm-2 col-form-label">Password</label> + <div class="col-sm-10"> + <input type="password" class="form-control" id="inputPassword"> + </div> + </div> +</form> +{% endcapture %} +{% include example.html content=example %} + +{% capture example %} +<form class="form-inline"> + <div class="form-group mb-2"> + <label for="staticEmail2" class="sr-only">Email</label> + <input type="text" readonly class="form-control-plaintext" id="staticEmail2" value="email@example.com"> + </div> + <div class="form-group mx-sm-3 mb-2"> + <label for="inputPassword2" class="sr-only">Password</label> + <input type="password" class="form-control" id="inputPassword2" placeholder="Password"> + </div> + <button type="submit" class="btn btn-primary mb-2">Confirm identity</button> +</form> +{% endcapture %} +{% include example.html content=example %} + +## Range Inputs + +Set horizontally scrollable range inputs using `.form-control-range`. + +{% capture example %} +<form> + <div class="form-group"> + <label for="formControlRange">Example Range input</label> + <input type="range" class="form-control-range" id="formControlRange"> + </div> +</form> +{% endcapture %} +{% include example.html content=example %} + +## Checkboxes and radios + +Default checkboxes and radios are improved upon with the help of `.form-check`, **a single class for both input types that improves the layout and behavior of their HTML elements**. Checkboxes are for selecting one or several options in a list, while radios are for selecting one option from many. + +Disabled checkboxes and radios are supported. The `disabled` attribute will apply a lighter color to help indicate the input's state. + +Checkboxes and radio buttons support HTML-based form validation and provide concise, accessible labels. As such, our `<input>`s and `<label>`s are sibling elements as opposed to an `<input>` within a `<label>`. This is slightly more verbose as you must specify `id` and `for` attributes to relate the `<input>` and `<label>`. + +### Default (stacked) + +By default, any number of checkboxes and radios that are immediate sibling will be vertically stacked and appropriately spaced with `.form-check`. + +{% capture example %} +<div class="form-check"> + <input class="form-check-input" type="checkbox" value="" id="defaultCheck1"> + <label class="form-check-label" for="defaultCheck1"> + Default checkbox + </label> +</div> +<div class="form-check"> + <input class="form-check-input" type="checkbox" value="" id="defaultCheck2" disabled> + <label class="form-check-label" for="defaultCheck2"> + Disabled checkbox + </label> +</div> +{% endcapture %} +{% include example.html content=example %} + +{% capture example %} +<div class="form-check"> + <input class="form-check-input" type="radio" name="exampleRadios" id="exampleRadios1" value="option1" checked> + <label class="form-check-label" for="exampleRadios1"> + Default radio + </label> +</div> +<div class="form-check"> + <input class="form-check-input" type="radio" name="exampleRadios" id="exampleRadios2" value="option2"> + <label class="form-check-label" for="exampleRadios2"> + Second default radio + </label> +</div> +<div class="form-check"> + <input class="form-check-input" type="radio" name="exampleRadios" id="exampleRadios3" value="option3" disabled> + <label class="form-check-label" for="exampleRadios3"> + Disabled radio + </label> +</div> +{% endcapture %} +{% include example.html content=example %} + +### Inline + +Group checkboxes or radios on the same horizontal row by adding `.form-check-inline` to any `.form-check`. + +{% capture example %} +<div class="form-check form-check-inline"> + <input class="form-check-input" type="checkbox" id="inlineCheckbox1" value="option1"> + <label class="form-check-label" for="inlineCheckbox1">1</label> +</div> +<div class="form-check form-check-inline"> + <input class="form-check-input" type="checkbox" id="inlineCheckbox2" value="option2"> + <label class="form-check-label" for="inlineCheckbox2">2</label> +</div> +<div class="form-check form-check-inline"> + <input class="form-check-input" type="checkbox" id="inlineCheckbox3" value="option3" disabled> + <label class="form-check-label" for="inlineCheckbox3">3 (disabled)</label> +</div> +{% endcapture %} +{% include example.html content=example %} + +{% capture example %} +<div class="form-check form-check-inline"> + <input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio1" value="option1"> + <label class="form-check-label" for="inlineRadio1">1</label> +</div> +<div class="form-check form-check-inline"> + <input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio2" value="option2"> + <label class="form-check-label" for="inlineRadio2">2</label> +</div> +<div class="form-check form-check-inline"> + <input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio3" value="option3" disabled> + <label class="form-check-label" for="inlineRadio3">3 (disabled)</label> +</div> +{% endcapture %} +{% include example.html content=example %} + +### Without labels + +Add `.position-static` to inputs within `.form-check` that don't have any label text. Remember to still provide some form of accessible name for assistive technologies (for instance, using `aria-label`). + +{% capture example %} +<div class="form-check"> + <input class="form-check-input position-static" type="checkbox" id="blankCheckbox" value="option1" aria-label="..."> +</div> +<div class="form-check"> + <input class="form-check-input position-static" type="radio" name="blankRadio" id="blankRadio1" value="option1" aria-label="..."> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Layout + +Since Bootstrap applies `display: block` and `width: 100%` to almost all our form controls, forms will by default stack vertically. Additional classes can be used to vary this layout on a per-form basis. + +### Form groups + +The `.form-group` class is the easiest way to add some structure to forms. It provides a flexible class that encourages proper grouping of labels, controls, optional help text, and form validation messaging. By default it only applies `margin-bottom`, but it picks up additional styles in `.form-inline` as needed. Use it with `<fieldset>`s, `<div>`s, or nearly any other element. + +{% capture example %} +<form> + <div class="form-group"> + <label for="formGroupExampleInput">Example label</label> + <input type="text" class="form-control" id="formGroupExampleInput" placeholder="Example input placeholder"> + </div> + <div class="form-group"> + <label for="formGroupExampleInput2">Another label</label> + <input type="text" class="form-control" id="formGroupExampleInput2" placeholder="Another input placeholder"> + </div> +</form> +{% endcapture %} +{% include example.html content=example %} + +### Form grid + +More complex forms can be built using our grid classes. Use these for form layouts that require multiple columns, varied widths, and additional alignment options. + +{% capture example %} +<form> + <div class="row"> + <div class="col"> + <input type="text" class="form-control" placeholder="First name"> + </div> + <div class="col"> + <input type="text" class="form-control" placeholder="Last name"> + </div> + </div> +</form> +{% endcapture %} +{% include example.html content=example %} + +#### Form row + +You may also swap `.row` for `.form-row`, a variation of our standard grid row that overrides the default column gutters for tighter and more compact layouts. + +{% capture example %} +<form> + <div class="form-row"> + <div class="col"> + <input type="text" class="form-control" placeholder="First name"> + </div> + <div class="col"> + <input type="text" class="form-control" placeholder="Last name"> + </div> + </div> +</form> +{% endcapture %} +{% include example.html content=example %} + +More complex layouts can also be created with the grid system. + +{% capture example %} +<form> + <div class="form-row"> + <div class="form-group col-md-6"> + <label for="inputEmail4">Email</label> + <input type="email" class="form-control" id="inputEmail4"> + </div> + <div class="form-group col-md-6"> + <label for="inputPassword4">Password</label> + <input type="password" class="form-control" id="inputPassword4"> + </div> + </div> + <div class="form-group"> + <label for="inputAddress">Address</label> + <input type="text" class="form-control" id="inputAddress" placeholder="1234 Main St"> + </div> + <div class="form-group"> + <label for="inputAddress2">Address 2</label> + <input type="text" class="form-control" id="inputAddress2" placeholder="Apartment, studio, or floor"> + </div> + <div class="form-row"> + <div class="form-group col-md-6"> + <label for="inputCity">City</label> + <input type="text" class="form-control" id="inputCity"> + </div> + <div class="form-group col-md-4"> + <label for="inputState">State</label> + <select id="inputState" class="form-control"> + <option selected>Choose...</option> + <option>...</option> + </select> + </div> + <div class="form-group col-md-2"> + <label for="inputZip">Zip</label> + <input type="text" class="form-control" id="inputZip"> + </div> + </div> + <div class="form-group"> + <div class="form-check"> + <input class="form-check-input" type="checkbox" id="gridCheck"> + <label class="form-check-label" for="gridCheck"> + Check me out + </label> + </div> + </div> + <button type="submit" class="btn btn-primary">Sign in</button> +</form> +{% endcapture %} +{% include example.html content=example %} + +#### Horizontal form + +Create horizontal forms with the grid by adding the `.row` class to form groups and using the `.col-*-*` classes to specify the width of your labels and controls. Be sure to add `.col-form-label` to your `<label>`s as well so they're vertically centered with their associated form controls. + +At times, you maybe need to use margin or padding utilities to create that perfect alignment you need. For example, we've removed the `padding-top` on our stacked radio inputs label to better align the text baseline. + +{% capture example %} +<form> + <div class="form-group row"> + <label for="inputEmail3" class="col-sm-2 col-form-label">Email</label> + <div class="col-sm-10"> + <input type="email" class="form-control" id="inputEmail3"> + </div> + </div> + <div class="form-group row"> + <label for="inputPassword3" class="col-sm-2 col-form-label">Password</label> + <div class="col-sm-10"> + <input type="password" class="form-control" id="inputPassword3"> + </div> + </div> + <fieldset class="form-group"> + <div class="row"> + <legend class="col-form-label col-sm-2 pt-0">Radios</legend> + <div class="col-sm-10"> + <div class="form-check"> + <input class="form-check-input" type="radio" name="gridRadios" id="gridRadios1" value="option1" checked> + <label class="form-check-label" for="gridRadios1"> + First radio + </label> + </div> + <div class="form-check"> + <input class="form-check-input" type="radio" name="gridRadios" id="gridRadios2" value="option2"> + <label class="form-check-label" for="gridRadios2"> + Second radio + </label> + </div> + <div class="form-check disabled"> + <input class="form-check-input" type="radio" name="gridRadios" id="gridRadios3" value="option3" disabled> + <label class="form-check-label" for="gridRadios3"> + Third disabled radio + </label> + </div> + </div> + </div> + </fieldset> + <div class="form-group row"> + <div class="col-sm-2">Checkbox</div> + <div class="col-sm-10"> + <div class="form-check"> + <input class="form-check-input" type="checkbox" id="gridCheck1"> + <label class="form-check-label" for="gridCheck1"> + Example checkbox + </label> + </div> + </div> + </div> + <div class="form-group row"> + <div class="col-sm-10"> + <button type="submit" class="btn btn-primary">Sign in</button> + </div> + </div> +</form> +{% endcapture %} +{% include example.html content=example %} + +##### Horizontal form label sizing + +Be sure to use `.col-form-label-sm` or `.col-form-label-lg` to your `<label>`s or `<legend>`s to correctly follow the size of `.form-control-lg` and `.form-control-sm`. + +{% capture example %} +<form> + <div class="form-group row"> + <label for="colFormLabelSm" class="col-sm-2 col-form-label col-form-label-sm">Email</label> + <div class="col-sm-10"> + <input type="email" class="form-control form-control-sm" id="colFormLabelSm" placeholder="col-form-label-sm"> + </div> + </div> + <div class="form-group row"> + <label for="colFormLabel" class="col-sm-2 col-form-label">Email</label> + <div class="col-sm-10"> + <input type="email" class="form-control" id="colFormLabel" placeholder="col-form-label"> + </div> + </div> + <div class="form-group row"> + <label for="colFormLabelLg" class="col-sm-2 col-form-label col-form-label-lg">Email</label> + <div class="col-sm-10"> + <input type="email" class="form-control form-control-lg" id="colFormLabelLg" placeholder="col-form-label-lg"> + </div> + </div> +</form> +{% endcapture %} +{% include example.html content=example %} + +#### Column sizing + +As shown in the previous examples, our grid system allows you to place any number of `.col`s within a `.row` or `.form-row`. They'll split the available width equally between them. You may also pick a subset of your columns to take up more or less space, while the remaining `.col`s equally split the rest, with specific column classes like `.col-7`. + +{% capture example %} +<form> + <div class="form-row"> + <div class="col-7"> + <input type="text" class="form-control" placeholder="City"> + </div> + <div class="col"> + <input type="text" class="form-control" placeholder="State"> + </div> + <div class="col"> + <input type="text" class="form-control" placeholder="Zip"> + </div> + </div> +</form> +{% endcapture %} +{% include example.html content=example %} + +#### Auto-sizing + +The example below uses a flexbox utility to vertically center the contents and changes `.col` to `.col-auto` so that your columns only take up as much space as needed. Put another way, the column sizes itself based on the contents. + +{% capture example %} +<form> + <div class="form-row align-items-center"> + <div class="col-auto"> + <label class="sr-only" for="inlineFormInput">Name</label> + <input type="text" class="form-control mb-2" id="inlineFormInput" placeholder="Jane Doe"> + </div> + <div class="col-auto"> + <label class="sr-only" for="inlineFormInputGroup">Username</label> + <div class="input-group mb-2"> + <div class="input-group-prepend"> + <div class="input-group-text">@</div> + </div> + <input type="text" class="form-control" id="inlineFormInputGroup" placeholder="Username"> + </div> + </div> + <div class="col-auto"> + <div class="form-check mb-2"> + <input class="form-check-input" type="checkbox" id="autoSizingCheck"> + <label class="form-check-label" for="autoSizingCheck"> + Remember me + </label> + </div> + </div> + <div class="col-auto"> + <button type="submit" class="btn btn-primary mb-2">Submit</button> + </div> + </div> +</form> +{% endcapture %} +{% include example.html content=example %} + +You can then remix that once again with size-specific column classes. + +{% capture example %} +<form> + <div class="form-row align-items-center"> + <div class="col-sm-3 my-1"> + <label class="sr-only" for="inlineFormInputName">Name</label> + <input type="text" class="form-control" id="inlineFormInputName" placeholder="Jane Doe"> + </div> + <div class="col-sm-3 my-1"> + <label class="sr-only" for="inlineFormInputGroupUsername">Username</label> + <div class="input-group"> + <div class="input-group-prepend"> + <div class="input-group-text">@</div> + </div> + <input type="text" class="form-control" id="inlineFormInputGroupUsername" placeholder="Username"> + </div> + </div> + <div class="col-auto my-1"> + <div class="form-check"> + <input class="form-check-input" type="checkbox" id="autoSizingCheck2"> + <label class="form-check-label" for="autoSizingCheck2"> + Remember me + </label> + </div> + </div> + <div class="col-auto my-1"> + <button type="submit" class="btn btn-primary">Submit</button> + </div> + </div> +</form> +{% endcapture %} +{% include example.html content=example %} + +And of course [custom form controls](#custom-forms) are supported. + +{% capture example %} +<form> + <div class="form-row align-items-center"> + <div class="col-auto my-1"> + <label class="mr-sm-2 sr-only" for="inlineFormCustomSelect">Preference</label> + <select class="custom-select mr-sm-2" id="inlineFormCustomSelect"> + <option selected>Choose...</option> + <option value="1">One</option> + <option value="2">Two</option> + <option value="3">Three</option> + </select> + </div> + <div class="col-auto my-1"> + <div class="custom-control custom-checkbox mr-sm-2"> + <input type="checkbox" class="custom-control-input" id="customControlAutosizing"> + <label class="custom-control-label" for="customControlAutosizing">Remember my preference</label> + </div> + </div> + <div class="col-auto my-1"> + <button type="submit" class="btn btn-primary">Submit</button> + </div> + </div> +</form> +{% endcapture %} +{% include example.html content=example %} + +### Inline forms + +Use the `.form-inline` class to display a series of labels, form controls, and buttons on a single horizontal row. Form controls within inline forms vary slightly from their default states. + +- Controls are `display: flex`, collapsing any HTML white space and allowing you to provide alignment control with [spacing]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/spacing/) and [flexbox]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/flex/) utilities. +- Controls and input groups receive `width: auto` to override the Bootstrap default `width: 100%`. +- Controls **only appear inline in viewports that are at least 576px wide** to account for narrow viewports on mobile devices. + +You may need to manually address the width and alignment of individual form controls with [spacing utilities]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/spacing/) (as shown below). Lastly, be sure to always include a `<label>` with each form control, even if you need to hide it from non-screenreader visitors with `.sr-only`. + +{% capture example %} +<form class="form-inline"> + <label class="sr-only" for="inlineFormInputName2">Name</label> + <input type="text" class="form-control mb-2 mr-sm-2" id="inlineFormInputName2" placeholder="Jane Doe"> + + <label class="sr-only" for="inlineFormInputGroupUsername2">Username</label> + <div class="input-group mb-2 mr-sm-2"> + <div class="input-group-prepend"> + <div class="input-group-text">@</div> + </div> + <input type="text" class="form-control" id="inlineFormInputGroupUsername2" placeholder="Username"> + </div> + + <div class="form-check mb-2 mr-sm-2"> + <input class="form-check-input" type="checkbox" id="inlineFormCheck"> + <label class="form-check-label" for="inlineFormCheck"> + Remember me + </label> + </div> + + <button type="submit" class="btn btn-primary mb-2">Submit</button> +</form> +{% endcapture %} +{% include example.html content=example %} + +Custom form controls and selects are also supported. + +{% capture example %} +<form class="form-inline"> + <label class="my-1 mr-2" for="inlineFormCustomSelectPref">Preference</label> + <select class="custom-select my-1 mr-sm-2" id="inlineFormCustomSelectPref"> + <option selected>Choose...</option> + <option value="1">One</option> + <option value="2">Two</option> + <option value="3">Three</option> + </select> + + <div class="custom-control custom-checkbox my-1 mr-sm-2"> + <input type="checkbox" class="custom-control-input" id="customControlInline"> + <label class="custom-control-label" for="customControlInline">Remember my preference</label> + </div> + + <button type="submit" class="btn btn-primary my-1">Submit</button> +</form> +{% endcapture %} +{% include example.html content=example %} + +{% capture callout %} +##### Alternatives to hidden labels +Assistive technologies such as screen readers will have trouble with your forms if you don't include a label for every input. For these inline forms, you can hide the labels using the `.sr-only` class. There are further alternative methods of providing a label for assistive technologies, such as the `aria-label`, `aria-labelledby` or `title` attribute. If none of these are present, assistive technologies may resort to using the `placeholder` attribute, if present, but note that use of `placeholder` as a replacement for other labelling methods is not advised. +{% endcapture %} +{% include callout.html content=callout type="warning" %} + +## Help text + +Block-level help text in forms can be created using `.form-text` (previously known as `.help-block` in v3). Inline help text can be flexibly implemented using any inline HTML element and utility classes like `.text-muted`. + +{% capture callout %} +##### Associating help text with form controls + +Help text should be explicitly associated with the form control it relates to using the `aria-describedby` attribute. This will ensure that assistive technologies—such as screen readers—will announce this help text when the user focuses or enters the control. +{% endcapture %} +{% include callout.html content=callout type="warning" %} + +Help text below inputs can be styled with `.form-text`. This class includes `display: block` and adds some top margin for easy spacing from the inputs above. + +{% capture example %} +<label for="inputPassword5">Password</label> +<input type="password" id="inputPassword5" class="form-control" aria-describedby="passwordHelpBlock"> +<small id="passwordHelpBlock" class="form-text text-muted"> + Your password must be 8-20 characters long, contain letters and numbers, and must not contain spaces, special characters, or emoji. +</small> +{% endcapture %} +{% include example.html content=example %} + +Inline text can use any typical inline HTML element (be it a `<small>`, `<span>`, or something else) with nothing more than a utility class. + +{% capture example %} +<form class="form-inline"> + <div class="form-group"> + <label for="inputPassword6">Password</label> + <input type="password" id="inputPassword6" class="form-control mx-sm-3" aria-describedby="passwordHelpInline"> + <small id="passwordHelpInline" class="text-muted"> + Must be 8-20 characters long. + </small> + </div> +</form> +{% endcapture %} +{% include example.html content=example %} + +## Disabled forms + +Add the `disabled` boolean attribute on an input to prevent user interactions and make it appear lighter. + +{% highlight html %} +<input class="form-control" id="disabledInput" type="text" placeholder="Disabled input here..." disabled> +{% endhighlight %} + +Add the `disabled` attribute to a `<fieldset>` to disable all the controls within. + +{% capture example %} +<form> + <fieldset disabled> + <div class="form-group"> + <label for="disabledTextInput">Disabled input</label> + <input type="text" id="disabledTextInput" class="form-control" placeholder="Disabled input"> + </div> + <div class="form-group"> + <label for="disabledSelect">Disabled select menu</label> + <select id="disabledSelect" class="form-control"> + <option>Disabled select</option> + </select> + </div> + <div class="form-group"> + <div class="form-check"> + <input class="form-check-input" type="checkbox" id="disabledFieldsetCheck" disabled> + <label class="form-check-label" for="disabledFieldsetCheck"> + Can't check this + </label> + </div> + </div> + <button type="submit" class="btn btn-primary">Submit</button> + </fieldset> +</form> +{% endcapture %} +{% include example.html content=example %} + +{% capture callout %} +##### Caveat with anchors + +Browsers treat all native form controls (`<input>`, `<select>`, and `<button>` elements) inside a `<fieldset disabled>` as disabled, preventing both keyboard and mouse interactions on them. + +However, if your form also includes custom button-like elements such as `<a ... class="btn btn-*">`, these will only be given a style of `pointer-events: none`. As noted in the section about [disabled state for buttons]({{ site.baseurl }}/docs/{{ site.docs_version }}/components/buttons/#disabled-state) (and specifically in the sub-section for anchor elements), this CSS property is not yet standardized and isn't fully supported in Internet Explorer 10. The anchor-based controls will also still be focusable and operable using the keyboard. You must manually modify these controls by adding `tabindex="-1"` to prevent them from receiving focus and `aria-disabled="disabled"` to signal their state to assistive technologies. +{% endcapture %} +{% include callout.html content=callout type="warning" %} + +{% capture callout %} +#### Cross-browser compatibility + +While Bootstrap will apply these styles in all browsers, Internet Explorer 11 and below don't fully support the `disabled` attribute on a `<fieldset>`. Use custom JavaScript to disable the fieldset in these browsers. +{% endcapture %} +{% include callout.html content=callout type="danger" %} + +## Validation + +Provide valuable, actionable feedback to your users with HTML5 form validation–[available in all our supported browsers](https://caniuse.com/#feat=form-validation). Choose from the browser default validation feedback, or implement custom messages with our built-in classes and starter JavaScript. + +{% capture callout %} +We are aware that currently the client-side custom validation styles and tooltips are not accessible, since they are not exposed to assistive technologies. While we work on a solution, we'd recommend either using the server-side option or the default browser validation method. +{% endcapture %} +{% include callout.html content=callout type="warning" %} + +{% capture callout %} +##### Input group validation +Input groups have difficulty with validation styles, unfortunately. Our recommendation is to place feedback messages as sibling elements of the `.input-group` that has `.is-{valid|invalid}`. Placing feedback messages within input groups breaks the `border-radius`. [See this workaround](#input-group-validation-workaround). +{% endcapture %} +{% include callout.html content=callout type="warning" %} + +### How it works + +Here's how form validation works with Bootstrap: + +- HTML form validation is applied via CSS's two pseudo-classes, `:invalid` and `:valid`. It applies to `<input>`, `<select>`, and `<textarea>` elements. +- Bootstrap scopes the `:invalid` and `:valid` styles to parent `.was-validated` class, usually applied to the `<form>`. Otherwise, any required field without a value shows up as invalid on page load. This way, you may choose when to activate them (typically after form submission is attempted). +- To reset the appearance of the form (for instance, in the case of dynamic form submissions using AJAX), remove the `.was-validated` class from the `<form>` again after submission. +- As a fallback, `.is-invalid` and `.is-valid` classes may be used instead of the pseudo-classes for [server side validation](#server-side). They do not require a `.was-validated` parent class. +- Due to constraints in how CSS works, we cannot (at present) apply styles to a `<label>` that comes before a form control in the DOM without the help of custom JavaScript. +- All modern browsers support the [constraint validation API](https://www.w3.org/TR/html5/sec-forms.html#the-constraint-validation-api), a series of JavaScript methods for validating form controls. +- Feedback messages may utilize the [browser defaults](#browser-defaults) (different for each browser, and unstylable via CSS) or our custom feedback styles with additional HTML and CSS. +- You may provide custom validity messages with `setCustomValidity` in JavaScript. + +With that in mind, consider the following demos for our custom form validation styles, optional server side classes, and browser defaults. + +### Custom styles + +For custom Bootstrap form validation messages, you'll need to add the `novalidate` boolean attribute to your `<form>`. This disables the browser default feedback tooltips, but still provides access to the form validation APIs in JavaScript. Try to submit the form below; our JavaScript will intercept the submit button and relay feedback to you. When attempting to submit, you'll see the `:invalid` and `:valid` styles applied to your form controls. + +Custom feedback styles apply custom colors, borders, focus styles, and background icons to better communicate feedback. Background icons for `<select>`s are only available with `.custom-select`, and not `.form-control`. + +{% capture example %} +<form class="needs-validation" novalidate> + <div class="form-row"> + <div class="col-md-6 mb-3"> + <label for="validationCustom01">First name</label> + <input type="text" class="form-control" id="validationCustom01" value="Mark" required> + <div class="valid-feedback"> + Looks good! + </div> + </div> + <div class="col-md-6 mb-3"> + <label for="validationCustom02">Last name</label> + <input type="text" class="form-control" id="validationCustom02" value="Otto" required> + <div class="valid-feedback"> + Looks good! + </div> + </div> + </div> + <div class="form-row"> + <div class="col-md-6 mb-3"> + <label for="validationCustom03">City</label> + <input type="text" class="form-control" id="validationCustom03" required> + <div class="invalid-feedback"> + Please provide a valid city. + </div> + </div> + <div class="col-md-3 mb-3"> + <label for="validationCustom04">State</label> + <select class="custom-select" id="validationCustom04" required> + <option selected disabled value="">Choose...</option> + <option>...</option> + </select> + <div class="invalid-feedback"> + Please select a valid state. + </div> + </div> + <div class="col-md-3 mb-3"> + <label for="validationCustom05">Zip</label> + <input type="text" class="form-control" id="validationCustom05" required> + <div class="invalid-feedback"> + Please provide a valid zip. + </div> + </div> + </div> + <div class="form-group"> + <div class="form-check"> + <input class="form-check-input" type="checkbox" value="" id="invalidCheck" required> + <label class="form-check-label" for="invalidCheck"> + Agree to terms and conditions + </label> + <div class="invalid-feedback"> + You must agree before submitting. + </div> + </div> + </div> + <button class="btn btn-primary" type="submit">Submit form</button> +</form> + +<script> +// Example starter JavaScript for disabling form submissions if there are invalid fields +(function() { + 'use strict'; + window.addEventListener('load', function() { + // Fetch all the forms we want to apply custom Bootstrap validation styles to + var forms = document.getElementsByClassName('needs-validation'); + // Loop over them and prevent submission + var validation = Array.prototype.filter.call(forms, function(form) { + form.addEventListener('submit', function(event) { + if (form.checkValidity() === false) { + event.preventDefault(); + event.stopPropagation(); + } + form.classList.add('was-validated'); + }, false); + }); + }, false); +})(); +</script> +{% endcapture %} +{% include example.html content=example %} + +### Browser defaults + +Not interested in custom validation feedback messages or writing JavaScript to change form behaviors? All good, you can use the browser defaults. Try submitting the form below. Depending on your browser and OS, you'll see a slightly different style of feedback. + +While these feedback styles cannot be styled with CSS, you can still customize the feedback text through JavaScript. + +{% capture example %} +<form> + <div class="form-row"> + <div class="col-md-6 mb-3"> + <label for="validationDefault01">First name</label> + <input type="text" class="form-control" id="validationDefault01" value="Mark" required> + </div> + <div class="col-md-6 mb-3"> + <label for="validationDefault02">Last name</label> + <input type="text" class="form-control" id="validationDefault02" value="Otto" required> + </div> + </div> + <div class="form-row"> + <div class="col-md-6 mb-3"> + <label for="validationDefault03">City</label> + <input type="text" class="form-control" id="validationDefault03" required> + </div> + <div class="col-md-3 mb-3"> + <label for="validationDefault04">State</label> + <select class="custom-select" id="validationDefault04" required> + <option selected disabled value="">Choose...</option> + <option>...</option> + </select> + </div> + <div class="col-md-3 mb-3"> + <label for="validationDefault05">Zip</label> + <input type="text" class="form-control" id="validationDefault05" required> + </div> + </div> + <div class="form-group"> + <div class="form-check"> + <input class="form-check-input" type="checkbox" value="" id="invalidCheck2" required> + <label class="form-check-label" for="invalidCheck2"> + Agree to terms and conditions + </label> + </div> + </div> + <button class="btn btn-primary" type="submit">Submit form</button> +</form> +{% endcapture %} +{% include example.html content=example %} + +### Server side + +We recommend using client-side validation, but in case you require server-side validation, you can indicate invalid and valid form fields with `.is-invalid` and `.is-valid`. Note that `.invalid-feedback` is also supported with these classes. + +For invalid fields, ensure that the invalid feedback/error message is associated with the relevant form field using `aria-describedby`. This attribute allows more than one `id` to be referenced, in case the field already points to additional form text. + +{% capture example %} +<form> + <div class="form-row"> + <div class="col-md-6 mb-3"> + <label for="validationServer01">First name</label> + <input type="text" class="form-control is-valid" id="validationServer01" value="Mark" required> + <div class="valid-feedback"> + Looks good! + </div> + </div> + <div class="col-md-6 mb-3"> + <label for="validationServer02">Last name</label> + <input type="text" class="form-control is-valid" id="validationServer02" value="Otto" required> + <div class="valid-feedback"> + Looks good! + </div> + </div> + </div> + <div class="form-row"> + <div class="col-md-6 mb-3"> + <label for="validationServer03">City</label> + <input type="text" class="form-control is-invalid" id="validationServer03" aria-describedby="validationServer03Feedback" required> + <div id="validationServer03Feedback" class="invalid-feedback"> + Please provide a valid city. + </div> + </div> + <div class="col-md-3 mb-3"> + <label for="validationServer04">State</label> + <select class="custom-select is-invalid" id="validationServer04" aria-describedby="validationServer04Feedback" required> + <option selected disabled value="">Choose...</option> + <option>...</option> + </select> + <div id="validationServer04Feedback" class="invalid-feedback"> + Please select a valid state. + </div> + </div> + <div class="col-md-3 mb-3"> + <label for="validationServer05">Zip</label> + <input type="text" class="form-control is-invalid" id="validationServer05" aria-describedby="validationServer05Feedback" required> + <div id="validationServer05Feedback" class="invalid-feedback"> + Please provide a valid zip. + </div> + </div> + </div> + <div class="form-group"> + <div class="form-check"> + <input class="form-check-input is-invalid" type="checkbox" value="" id="invalidCheck3" aria-describedby="invalidCheck3Feedback" required> + <label class="form-check-label" for="invalidCheck3"> + Agree to terms and conditions + </label> + <div id="invalidCheck3Feedback" class="invalid-feedback"> + You must agree before submitting. + </div> + </div> + </div> + <button class="btn btn-primary" type="submit">Submit form</button> +</form> +{% endcapture %} +{% include example.html content=example %} + +### Supported elements + +Validation styles are available for the following form controls and components: + +- `<input>`s and `<textarea>`s with `.form-control` +- `<select>`s with `.form-control` or `.custom-select` +- `.form-check`s +- `.custom-checkbox`s and `.custom-radio`s +- `.custom-file` + +{% capture example %} +<form class="was-validated"> + <div class="mb-3"> + <label for="validationTextarea">Textarea</label> + <textarea class="form-control is-invalid" id="validationTextarea" placeholder="Required example textarea" required></textarea> + <div class="invalid-feedback"> + Please enter a message in the textarea. + </div> + </div> + + <div class="custom-control custom-checkbox mb-3"> + <input type="checkbox" class="custom-control-input" id="customControlValidation1" required> + <label class="custom-control-label" for="customControlValidation1">Check this custom checkbox</label> + <div class="invalid-feedback">Example invalid feedback text</div> + </div> + + <div class="custom-control custom-radio"> + <input type="radio" class="custom-control-input" id="customControlValidation2" name="radio-stacked" required> + <label class="custom-control-label" for="customControlValidation2">Toggle this custom radio</label> + </div> + <div class="custom-control custom-radio mb-3"> + <input type="radio" class="custom-control-input" id="customControlValidation3" name="radio-stacked" required> + <label class="custom-control-label" for="customControlValidation3">Or toggle this other custom radio</label> + <div class="invalid-feedback">More example invalid feedback text</div> + </div> + + <div class="mb-3"> + <select class="custom-select" required> + <option value="">Choose...</option> + <option value="1">One</option> + <option value="2">Two</option> + <option value="3">Three</option> + </select> + <div class="invalid-feedback">Example invalid custom select feedback</div> + </div> + + <div class="custom-file mb-3"> + <input type="file" class="custom-file-input" id="validatedCustomFile" required> + <label class="custom-file-label" for="validatedCustomFile">Choose file...</label> + <div class="invalid-feedback">Example invalid custom file feedback</div> + </div> + + <div class="mb-3"> + <div class="input-group is-invalid"> + <div class="input-group-prepend"> + <span class="input-group-text" id="validatedInputGroupPrepend">@</span> + </div> + <input type="text" class="form-control is-invalid" aria-describedby="validatedInputGroupPrepend" required> + </div> + <div class="invalid-feedback"> + Example invalid input group feedback + </div> + </div> + + <div class="mb-3"> + <div class="input-group is-invalid"> + <div class="input-group-prepend"> + <label class="input-group-text" for="validatedInputGroupSelect">Options</label> + </div> + <select class="custom-select" id="validatedInputGroupSelect" required> + <option value="">Choose...</option> + <option value="1">One</option> + <option value="2">Two</option> + <option value="3">Three</option> + </select> + </div> + <div class="invalid-feedback"> + Example invalid input group feedback + </div> + </div> + + <div class="input-group is-invalid"> + <div class="custom-file"> + <input type="file" class="custom-file-input" id="validatedInputGroupCustomFile" required> + <label class="custom-file-label" for="validatedInputGroupCustomFile">Choose file...</label> + </div> + <div class="input-group-append"> + <button class="btn btn-outline-secondary" type="button">Button</button> + </div> + </div> + <div class="invalid-feedback"> + Example invalid input group feedback + </div> +</form> +{% endcapture %} +{% include example.html content=example %} + +### Tooltips + +If your form layout allows it, you can swap the `.{valid|invalid}-feedback` classes for `.{valid|invalid}-tooltip` classes to display validation feedback in a styled tooltip. Be sure to have a parent with `position: relative` on it for tooltip positioning. In the example below, our column classes have this already, but your project may require an alternative setup. + +{% capture example %} +<form class="needs-validation" novalidate> + <div class="form-row"> + <div class="col-md-6 mb-3"> + <label for="validationTooltip01">First name</label> + <input type="text" class="form-control" id="validationTooltip01" value="Mark" required> + <div class="valid-tooltip"> + Looks good! + </div> + </div> + <div class="col-md-6 mb-3"> + <label for="validationTooltip02">Last name</label> + <input type="text" class="form-control" id="validationTooltip02" value="Otto" required> + <div class="valid-tooltip"> + Looks good! + </div> + </div> + </div> + <div class="form-row"> + <div class="col-md-6 mb-3"> + <label for="validationTooltip03">City</label> + <input type="text" class="form-control" id="validationTooltip03" required> + <div class="invalid-tooltip"> + Please provide a valid city. + </div> + </div> + <div class="col-md-3 mb-3"> + <label for="validationTooltip04">State</label> + <select class="custom-select" id="validationTooltip04" required> + <option selected disabled value="">Choose...</option> + <option>...</option> + </select> + <div class="invalid-tooltip"> + Please select a valid state. + </div> + </div> + <div class="col-md-3 mb-3"> + <label for="validationTooltip05">Zip</label> + <input type="text" class="form-control" id="validationTooltip05" required> + <div class="invalid-tooltip"> + Please provide a valid zip. + </div> + </div> + </div> + <button class="btn btn-primary" type="submit">Submit form</button> +</form> +{% endcapture %} +{% include example.html content=example %} + +### Customizing + +Validation states can be customized via Sass with the `$form-validation-states` map. Located in our `_variables.scss` file, this Sass map is looped over to generate the default `valid`/`invalid` validation states. Included is a nested map for customizing each state's color and icon. While no other states are supported by browsers, those using custom styles can easily add more complex form feedback. + +Please note that we do not recommend customizing these values without also modifying the `form-validation-state` mixin. + +{% highlight scss %} +// Sass map from `_variables.scss` +// Override this and recompile your Sass to generate different states +$form-validation-states: map-merge( + ( + "valid": ( + "color": $form-feedback-valid-color, + "icon": $form-feedback-icon-valid + ), + "invalid": ( + "color": $form-feedback-invalid-color, + "icon": $form-feedback-icon-invalid + ) + ), + $form-validation-states +); + +// Loop from `_forms.scss` +// Any modifications to the above Sass map will be reflected in your compiled +// CSS via this loop. +@each $state, $data in $form-validation-states { + @include form-validation-state($state, map-get($data, color), map-get($data, icon)); +} +{% endhighlight %} + +### Input group validation workaround + +We're unable to resolve the broken `border-radius` of input groups with validation due to selector limitations, so manual overrides are required. When you're using a standard input group and don't customize the default border radius values, add `.rounded-right` to the elements with the broken `border-radius`. + +{% highlight html %} +<div class="input-group"> + <div class="input-group-prepend"> + <span class="input-group-text">@</span> + </div> + <input type="text" class="form-control rounded-right" required> + <div class="invalid-feedback"> + Please choose a username. + </div> +</div> +{% endhighlight %} + +<div class="bd-example bd-example-forms-input-group-workaround"> + <div class="input-group"> + <div class="input-group-prepend"> + <span class="input-group-text">@</span> + </div> + <input type="text" class="form-control is-invalid rounded-right" required> + <div class="invalid-feedback"> + Please choose a username. + </div> + </div> +</div> + +When you are using a small or large input group or customizing the default `border-radius` values, add custom CSS to the element with the busted `border-radius`. + +{% highlight css %} +/* Change values to match the radius of your form control */ +.fix-rounded-right { + border-top-right-radius: .2rem !important; + border-bottom-right-radius: .2rem !important; +} +{% endhighlight %} + +{% highlight html %} +<div class="input-group input-group-sm"> + <div class="input-group-prepend"> + <span class="input-group-text">@</span> + </div> + <input type="text" class="form-control fix-rounded-right" required> + <div class="invalid-feedback"> + Please choose a username. + </div> +</div> +{% endhighlight %} + +<div class="bd-example bd-example-forms-input-group-workaround"> + <div class="input-group input-group-sm"> + <div class="input-group-prepend"> + <span class="input-group-text">@</span> + </div> + <input type="text" class="form-control is-invalid fix-rounded-right" required> + <div class="invalid-feedback"> + Please choose a username. + </div> + </div> +</div> + +## Custom forms + +For even more customization and cross browser consistency, use our completely custom form elements to replace the browser defaults. They're built on top of semantic and accessible markup, so they're solid replacements for any default form control. + +### Checkboxes and radios + +Each checkbox and radio `<input>` and `<label>` pairing is wrapped in a `<div>` to create our custom control. Structurally, this is the same approach as our default `.form-check`. + +We use the sibling selector (`~`) for all our `<input>` states—like `:checked`—to properly style our custom form indicator. When combined with the `.custom-control-label` class, we can also style the text for each item based on the `<input>`'s state. + +We hide the default `<input>` with `opacity` and use the `.custom-control-label` to build a new custom form indicator in its place with `::before` and `::after`. Unfortunately we can't build a custom one from just the `<input>` because CSS's `content` doesn't work on that element. + +In the checked states, we use **base64 embedded SVG icons** from [Open Iconic](https://github.com/iconic/open-iconic). This provides us the best control for styling and positioning across browsers and devices. + +#### Checkboxes + +{% capture example %} +<div class="custom-control custom-checkbox"> + <input type="checkbox" class="custom-control-input" id="customCheck1"> + <label class="custom-control-label" for="customCheck1">Check this custom checkbox</label> +</div> +{% endcapture %} +{% include example.html content=example %} + +Custom checkboxes can also utilize the `:indeterminate` pseudo class when manually set via JavaScript (there is no available HTML attribute for specifying it). + +<div class="bd-example bd-example-indeterminate"> + <div class="custom-control custom-checkbox"> + <input type="checkbox" class="custom-control-input" id="customCheck2"> + <label class="custom-control-label" for="customCheck2">Check this custom checkbox</label> + </div> +</div> + +If you're using jQuery, something like this should suffice: + +{% highlight js %} +$('.your-checkbox').prop('indeterminate', true) +{% endhighlight %} + +#### Radios + +{% capture example %} +<div class="custom-control custom-radio"> + <input type="radio" id="customRadio1" name="customRadio" class="custom-control-input"> + <label class="custom-control-label" for="customRadio1">Toggle this custom radio</label> +</div> +<div class="custom-control custom-radio"> + <input type="radio" id="customRadio2" name="customRadio" class="custom-control-input"> + <label class="custom-control-label" for="customRadio2">Or toggle this other custom radio</label> +</div> +{% endcapture %} +{% include example.html content=example %} + +#### Inline + +{% capture example %} +<div class="custom-control custom-radio custom-control-inline"> + <input type="radio" id="customRadioInline1" name="customRadioInline1" class="custom-control-input"> + <label class="custom-control-label" for="customRadioInline1">Toggle this custom radio</label> +</div> +<div class="custom-control custom-radio custom-control-inline"> + <input type="radio" id="customRadioInline2" name="customRadioInline1" class="custom-control-input"> + <label class="custom-control-label" for="customRadioInline2">Or toggle this other custom radio</label> +</div> +{% endcapture %} +{% include example.html content=example %} + +#### Disabled + +Custom checkboxes and radios can also be disabled. Add the `disabled` boolean attribute to the `<input>` and the custom indicator and label description will be automatically styled. + +{% capture example %} +<div class="custom-control custom-checkbox"> + <input type="checkbox" class="custom-control-input" id="customCheckDisabled1" disabled> + <label class="custom-control-label" for="customCheckDisabled1">Check this custom checkbox</label> +</div> + +<div class="custom-control custom-radio"> + <input type="radio" name="radioDisabled" id="customRadioDisabled2" class="custom-control-input" disabled> + <label class="custom-control-label" for="customRadioDisabled2">Toggle this custom radio</label> +</div> +{% endcapture %} +{% include example.html content=example %} + +### Switches + +A switch has the markup of a custom checkbox but uses the `.custom-switch` class to render a toggle switch. Switches also support the `disabled` attribute. + +{% capture example %} +<div class="custom-control custom-switch"> + <input type="checkbox" class="custom-control-input" id="customSwitch1"> + <label class="custom-control-label" for="customSwitch1">Toggle this switch element</label> +</div> +<div class="custom-control custom-switch"> + <input type="checkbox" class="custom-control-input" disabled id="customSwitch2"> + <label class="custom-control-label" for="customSwitch2">Disabled switch element</label> +</div> +{% endcapture %} +{% include example.html content=example %} + +### Select menu + +Custom `<select>` menus need only a custom class, `.custom-select` to trigger the custom styles. Custom styles are limited to the `<select>`'s initial appearance and cannot modify the `<option>`s due to browser limitations. + +{% capture example %} +<select class="custom-select"> + <option selected>Open this select menu</option> + <option value="1">One</option> + <option value="2">Two</option> + <option value="3">Three</option> +</select> +{% endcapture %} +{% include example.html content=example %} + +You may also choose from small and large custom selects to match our similarly sized text inputs. + +{% capture example %} +<select class="custom-select custom-select-lg mb-3"> + <option selected>Open this select menu</option> + <option value="1">One</option> + <option value="2">Two</option> + <option value="3">Three</option> +</select> + +<select class="custom-select custom-select-sm"> + <option selected>Open this select menu</option> + <option value="1">One</option> + <option value="2">Two</option> + <option value="3">Three</option> +</select> +{% endcapture %} +{% include example.html content=example %} + +The `multiple` attribute is also supported: + +{% capture example %} +<select class="custom-select" multiple> + <option selected>Open this select menu</option> + <option value="1">One</option> + <option value="2">Two</option> + <option value="3">Three</option> +</select> +{% endcapture %} +{% include example.html content=example %} + +As is the `size` attribute: + +{% capture example %} +<select class="custom-select" size="3"> + <option selected>Open this select menu</option> + <option value="1">One</option> + <option value="2">Two</option> + <option value="3">Three</option> +</select> +{% endcapture %} +{% include example.html content=example %} + +### Range + +Create custom `<input type="range">` controls with `.custom-range`. The track (the background) and thumb (the value) are both styled to appear the same across browsers. As only IE and Firefox support "filling" their track from the left or right of the thumb as a means to visually indicate progress, we do not currently support it. + +{% capture example %} +<label for="customRange1">Example range</label> +<input type="range" class="custom-range" id="customRange1"> +{% endcapture %} +{% include example.html content=example %} + +Range inputs have implicit values for `min` and `max`—`0` and `100`, respectively. You may specify new values for those using the `min` and `max` attributes. + +{% capture example %} +<label for="customRange2">Example range</label> +<input type="range" class="custom-range" min="0" max="5" id="customRange2"> +{% endcapture %} +{% include example.html content=example %} + +By default, range inputs "snap" to integer values. To change this, you can specify a `step` value. In the example below, we double the number of steps by using `step="0.5"`. + +{% capture example %} +<label for="customRange3">Example range</label> +<input type="range" class="custom-range" min="0" max="5" step="0.5" id="customRange3"> +{% endcapture %} +{% include example.html content=example %} + +### File browser + +{% capture callout %} +The recommended plugin to animate custom file input: [bs-custom-file-input](https://www.npmjs.com/package/bs-custom-file-input), that's what we are using currently here in our docs. +{% endcapture %} +{% include callout.html content=callout type="info" %} + +The file input is the most gnarly of the bunch and requires additional JavaScript if you'd like to hook them up with functional *Choose file...* and selected file name text. + +{% capture example %} +<div class="custom-file"> + <input type="file" class="custom-file-input" id="customFile"> + <label class="custom-file-label" for="customFile">Choose file</label> +</div> +{% endcapture %} +{% include example.html content=example %} + +We hide the default file `<input>` via `opacity` and instead style the `<label>`. The button is generated and positioned with `::after`. Lastly, we declare a `width` and `height` on the `<input>` for proper spacing for surrounding content. + +#### Translating or customizing the strings with SCSS + +The [`:lang()` pseudo-class](https://developer.mozilla.org/en-US/docs/Web/CSS/:lang) is used to allow for translation of the "Browse" text into other languages. Override or add entries to the `$custom-file-text` Sass variable with the relevant [language tag](https://en.wikipedia.org/wiki/IETF_language_tag) and localized strings. The English strings can be customized the same way. For example, here's how one might add a Spanish translation (Spanish's language code is `es`): + +{% highlight scss %} +$custom-file-text: ( + en: "Browse", + es: "Elegir" +); +{% endhighlight %} + +Here's `lang(es)` in action on the custom file input for a Spanish translation: + +{% capture example %} +<div class="custom-file"> + <input type="file" class="custom-file-input" id="customFileLang" lang="es"> + <label class="custom-file-label" for="customFileLang">Seleccionar Archivo</label> +</div> +{% endcapture %} +{% include example.html content=example %} + +You'll need to set the language of your document (or subtree thereof) correctly in order for the correct text to be shown. This can be done using [the `lang` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang) on the `<html>` element or the [`Content-Language` HTTP header](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.12), among other methods. + +#### Translating or customizing the strings with HTML + +Bootstrap also provides a way to translate the "Browse" text in HTML with the `data-browse` attribute which can be added to the custom input label (example in Dutch): + +{% capture example %} +<div class="custom-file"> + <input type="file" class="custom-file-input" id="customFileLangHTML"> + <label class="custom-file-label" for="customFileLangHTML" data-browse="Bestand kiezen">Voeg je document toe</label> +</div> +{% endcapture %} +{% include example.html content=example %} diff --git a/vendor/twbs/bootstrap/site/docs/4.5/components/input-group.md b/vendor/twbs/bootstrap/site/docs/4.5/components/input-group.md new file mode 100644 index 000000000..606bf4b75 --- /dev/null +++ b/vendor/twbs/bootstrap/site/docs/4.5/components/input-group.md @@ -0,0 +1,384 @@ +--- +layout: docs +title: Input group +description: Easily extend form controls by adding text, buttons, or button groups on either side of textual inputs, custom selects, and custom file inputs. +group: components +toc: true +--- + +## Basic example + +Place one add-on or button on either side of an input. You may also place one on both sides of an input. Remember to place `<label>`s outside the input group. + +{% capture example %} +<div class="input-group mb-3"> + <div class="input-group-prepend"> + <span class="input-group-text" id="basic-addon1">@</span> + </div> + <input type="text" class="form-control" placeholder="Username" aria-label="Username" aria-describedby="basic-addon1"> +</div> + +<div class="input-group mb-3"> + <input type="text" class="form-control" placeholder="Recipient's username" aria-label="Recipient's username" aria-describedby="basic-addon2"> + <div class="input-group-append"> + <span class="input-group-text" id="basic-addon2">@example.com</span> + </div> +</div> + +<label for="basic-url">Your vanity URL</label> +<div class="input-group mb-3"> + <div class="input-group-prepend"> + <span class="input-group-text" id="basic-addon3">https://example.com/users/</span> + </div> + <input type="text" class="form-control" id="basic-url" aria-describedby="basic-addon3"> +</div> + +<div class="input-group mb-3"> + <div class="input-group-prepend"> + <span class="input-group-text">$</span> + </div> + <input type="text" class="form-control" aria-label="Amount (to the nearest dollar)"> + <div class="input-group-append"> + <span class="input-group-text">.00</span> + </div> +</div> + +<div class="input-group"> + <div class="input-group-prepend"> + <span class="input-group-text">With textarea</span> + </div> + <textarea class="form-control" aria-label="With textarea"></textarea> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Wrapping + +Input groups wrap by default via `flex-wrap: wrap` in order to accommodate custom form field validation within an input group. You may disable this with `.flex-nowrap`. + +{% capture example %} +<div class="input-group flex-nowrap"> + <div class="input-group-prepend"> + <span class="input-group-text" id="addon-wrapping">@</span> + </div> + <input type="text" class="form-control" placeholder="Username" aria-label="Username" aria-describedby="addon-wrapping"> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Sizing + +Add the relative form sizing classes to the `.input-group` itself and contents within will automatically resize—no need for repeating the form control size classes on each element. + +**Sizing on the individual input group elements isn't supported.** + +{% capture example %} +<div class="input-group input-group-sm mb-3"> + <div class="input-group-prepend"> + <span class="input-group-text" id="inputGroup-sizing-sm">Small</span> + </div> + <input type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-sm"> +</div> + +<div class="input-group mb-3"> + <div class="input-group-prepend"> + <span class="input-group-text" id="inputGroup-sizing-default">Default</span> + </div> + <input type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-default"> +</div> + +<div class="input-group input-group-lg"> + <div class="input-group-prepend"> + <span class="input-group-text" id="inputGroup-sizing-lg">Large</span> + </div> + <input type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-lg"> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Checkboxes and radios + +Place any checkbox or radio option within an input group's addon instead of text. + +{% capture example %} +<div class="input-group mb-3"> + <div class="input-group-prepend"> + <div class="input-group-text"> + <input type="checkbox" aria-label="Checkbox for following text input"> + </div> + </div> + <input type="text" class="form-control" aria-label="Text input with checkbox"> +</div> + +<div class="input-group"> + <div class="input-group-prepend"> + <div class="input-group-text"> + <input type="radio" aria-label="Radio button for following text input"> + </div> + </div> + <input type="text" class="form-control" aria-label="Text input with radio button"> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Multiple inputs + +While multiple `<input>`s are supported visually, validation styles are only available for input groups with a single `<input>`. + +{% capture example %} +<div class="input-group"> + <div class="input-group-prepend"> + <span class="input-group-text">First and last name</span> + </div> + <input type="text" aria-label="First name" class="form-control"> + <input type="text" aria-label="Last name" class="form-control"> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Multiple addons + +Multiple add-ons are supported and can be mixed with checkbox and radio input versions. + +{% capture example %} +<div class="input-group mb-3"> + <div class="input-group-prepend"> + <span class="input-group-text">$</span> + <span class="input-group-text">0.00</span> + </div> + <input type="text" class="form-control" aria-label="Dollar amount (with dot and two decimal places)"> +</div> + +<div class="input-group"> + <input type="text" class="form-control" aria-label="Dollar amount (with dot and two decimal places)"> + <div class="input-group-append"> + <span class="input-group-text">$</span> + <span class="input-group-text">0.00</span> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Button addons + +{% capture example %} +<div class="input-group mb-3"> + <div class="input-group-prepend"> + <button class="btn btn-outline-secondary" type="button" id="button-addon1">Button</button> + </div> + <input type="text" class="form-control" placeholder="" aria-label="Example text with button addon" aria-describedby="button-addon1"> +</div> + +<div class="input-group mb-3"> + <input type="text" class="form-control" placeholder="Recipient's username" aria-label="Recipient's username" aria-describedby="button-addon2"> + <div class="input-group-append"> + <button class="btn btn-outline-secondary" type="button" id="button-addon2">Button</button> + </div> +</div> + +<div class="input-group mb-3"> + <div class="input-group-prepend" id="button-addon3"> + <button class="btn btn-outline-secondary" type="button">Button</button> + <button class="btn btn-outline-secondary" type="button">Button</button> + </div> + <input type="text" class="form-control" placeholder="" aria-label="Example text with two button addons" aria-describedby="button-addon3"> +</div> + +<div class="input-group"> + <input type="text" class="form-control" placeholder="Recipient's username" aria-label="Recipient's username with two button addons" aria-describedby="button-addon4"> + <div class="input-group-append" id="button-addon4"> + <button class="btn btn-outline-secondary" type="button">Button</button> + <button class="btn btn-outline-secondary" type="button">Button</button> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Buttons with dropdowns + +{% capture example %} +<div class="input-group mb-3"> + <div class="input-group-prepend"> + <button class="btn btn-outline-secondary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dropdown</button> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div role="separator" class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> + </div> + <input type="text" class="form-control" aria-label="Text input with dropdown button"> +</div> + +<div class="input-group"> + <input type="text" class="form-control" aria-label="Text input with dropdown button"> + <div class="input-group-append"> + <button class="btn btn-outline-secondary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dropdown</button> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div role="separator" class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Segmented buttons + +{% capture example %} +<div class="input-group mb-3"> + <div class="input-group-prepend"> + <button type="button" class="btn btn-outline-secondary">Action</button> + <button type="button" class="btn btn-outline-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + <span class="sr-only">Toggle Dropdown</span> + </button> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div role="separator" class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> + </div> + <input type="text" class="form-control" aria-label="Text input with segmented dropdown button"> +</div> + +<div class="input-group"> + <input type="text" class="form-control" aria-label="Text input with segmented dropdown button"> + <div class="input-group-append"> + <button type="button" class="btn btn-outline-secondary">Action</button> + <button type="button" class="btn btn-outline-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + <span class="sr-only">Toggle Dropdown</span> + </button> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div role="separator" class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Custom forms + +Input groups include support for custom selects and custom file inputs. Browser default versions of these are not supported. + +### Custom select + +{% capture example %} +<div class="input-group mb-3"> + <div class="input-group-prepend"> + <label class="input-group-text" for="inputGroupSelect01">Options</label> + </div> + <select class="custom-select" id="inputGroupSelect01"> + <option selected>Choose...</option> + <option value="1">One</option> + <option value="2">Two</option> + <option value="3">Three</option> + </select> +</div> + +<div class="input-group mb-3"> + <select class="custom-select" id="inputGroupSelect02"> + <option selected>Choose...</option> + <option value="1">One</option> + <option value="2">Two</option> + <option value="3">Three</option> + </select> + <div class="input-group-append"> + <label class="input-group-text" for="inputGroupSelect02">Options</label> + </div> +</div> + +<div class="input-group mb-3"> + <div class="input-group-prepend"> + <button class="btn btn-outline-secondary" type="button">Button</button> + </div> + <select class="custom-select" id="inputGroupSelect03" aria-label="Example select with button addon"> + <option selected>Choose...</option> + <option value="1">One</option> + <option value="2">Two</option> + <option value="3">Three</option> + </select> +</div> + +<div class="input-group"> + <select class="custom-select" id="inputGroupSelect04" aria-label="Example select with button addon"> + <option selected>Choose...</option> + <option value="1">One</option> + <option value="2">Two</option> + <option value="3">Three</option> + </select> + <div class="input-group-append"> + <button class="btn btn-outline-secondary" type="button">Button</button> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +### Custom file input + +{% capture example %} +<div class="input-group mb-3"> + <div class="input-group-prepend"> + <span class="input-group-text" id="inputGroupFileAddon01">Upload</span> + </div> + <div class="custom-file"> + <input type="file" class="custom-file-input" id="inputGroupFile01" aria-describedby="inputGroupFileAddon01"> + <label class="custom-file-label" for="inputGroupFile01">Choose file</label> + </div> +</div> + +<div class="input-group mb-3"> + <div class="custom-file"> + <input type="file" class="custom-file-input" id="inputGroupFile02"> + <label class="custom-file-label" for="inputGroupFile02" aria-describedby="inputGroupFileAddon02">Choose file</label> + </div> + <div class="input-group-append"> + <span class="input-group-text" id="inputGroupFileAddon02">Upload</span> + </div> +</div> + +<div class="input-group mb-3"> + <div class="input-group-prepend"> + <button class="btn btn-outline-secondary" type="button" id="inputGroupFileAddon03">Button</button> + </div> + <div class="custom-file"> + <input type="file" class="custom-file-input" id="inputGroupFile03" aria-describedby="inputGroupFileAddon03"> + <label class="custom-file-label" for="inputGroupFile03">Choose file</label> + </div> +</div> + +<div class="input-group"> + <div class="custom-file"> + <input type="file" class="custom-file-input" id="inputGroupFile04" aria-describedby="inputGroupFileAddon04"> + <label class="custom-file-label" for="inputGroupFile04">Choose file</label> + </div> + <div class="input-group-append"> + <button class="btn btn-outline-secondary" type="button" id="inputGroupFileAddon04">Button</button> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Accessibility + +Ensure that all form controls have an appropriate accessible name so that their purpose can be conveyed to users of assistive technologies. The simplest way to achieve this is to use a `<label>` element, or—in the case of buttons—to include sufficiently descriptive text as part of the `<button>...</button>` content. + +For situations where it's not possible to include a visible `<label>` or appropriate text content, there are alternative ways of still providing an accessible name, such as: + +- `<label>` elements hidden using the `.visually-hidden` class +- Pointing to an existing element that can act as a label using `aria-labelledby` +- Providing a `title` attribute +- Explicitly setting the accessible name on an element using `aria-label` + +If none of these are present, assistive technologies may resort to using the `placeholder` attribute as a fallback for the accessible name on `<input>` and `<textarea>` elements. The examples in this section provide a few suggested, case-specific approaches. + +While using visually hidden content (`.sr-only`, `aria-label`, and even `placeholder` content, which disappears once a form field has content) will benefit assistive technology users, a lack of visible label text may still be problematic for certain users. Some form of visible label is generally the best approach, both for accessibility and usability. diff --git a/vendor/twbs/bootstrap/site/docs/4.5/components/jumbotron.md b/vendor/twbs/bootstrap/site/docs/4.5/components/jumbotron.md new file mode 100644 index 000000000..c14621565 --- /dev/null +++ b/vendor/twbs/bootstrap/site/docs/4.5/components/jumbotron.md @@ -0,0 +1,31 @@ +--- +layout: docs +title: Jumbotron +description: Lightweight, flexible component for showcasing hero unit style content. +group: components +--- + +A lightweight, flexible component that can optionally extend the entire viewport to showcase key marketing messages on your site. + +{% capture example %} +<div class="jumbotron"> + <h1 class="display-4">Hello, world!</h1> + <p class="lead">This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.</p> + <hr class="my-4"> + <p>It uses utility classes for typography and spacing to space content out within the larger container.</p> + <a class="btn btn-primary btn-lg" href="#" role="button">Learn more</a> +</div> +{% endcapture %} +{% include example.html content=example %} + +To make the jumbotron full width, and without rounded corners, add the `.jumbotron-fluid` modifier class and add a `.container` or `.container-fluid` within. + +{% capture example %} +<div class="jumbotron jumbotron-fluid"> + <div class="container"> + <h1 class="display-4">Fluid jumbotron</h1> + <p class="lead">This is a modified jumbotron that occupies the entire horizontal space of its parent.</p> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} diff --git a/vendor/twbs/bootstrap/site/docs/4.5/components/list-group.md b/vendor/twbs/bootstrap/site/docs/4.5/components/list-group.md new file mode 100644 index 000000000..251dae672 --- /dev/null +++ b/vendor/twbs/bootstrap/site/docs/4.5/components/list-group.md @@ -0,0 +1,393 @@ +--- +layout: docs +title: List group +description: List groups are a flexible and powerful component for displaying a series of content. Modify and extend them to support just about any content within. +group: components +toc: true +--- + +## Basic example + +The most basic list group is an unordered list with list items and the proper classes. Build upon it with the options that follow, or with your own CSS as needed. + +{% capture example %} +<ul class="list-group"> + <li class="list-group-item">Cras justo odio</li> + <li class="list-group-item">Dapibus ac facilisis in</li> + <li class="list-group-item">Morbi leo risus</li> + <li class="list-group-item">Porta ac consectetur ac</li> + <li class="list-group-item">Vestibulum at eros</li> +</ul> +{% endcapture %} +{% include example.html content=example %} + +## Active items + +Add `.active` to a `.list-group-item` to indicate the current active selection. + +{% capture example %} +<ul class="list-group"> + <li class="list-group-item active">Cras justo odio</li> + <li class="list-group-item">Dapibus ac facilisis in</li> + <li class="list-group-item">Morbi leo risus</li> + <li class="list-group-item">Porta ac consectetur ac</li> + <li class="list-group-item">Vestibulum at eros</li> +</ul> +{% endcapture %} +{% include example.html content=example %} + +## Disabled items + +Add `.disabled` to a `.list-group-item` to make it _appear_ disabled. Note that some elements with `.disabled` will also require custom JavaScript to fully disable their click events (e.g., links). + +{% capture example %} +<ul class="list-group"> + <li class="list-group-item disabled" aria-disabled="true">Cras justo odio</li> + <li class="list-group-item">Dapibus ac facilisis in</li> + <li class="list-group-item">Morbi leo risus</li> + <li class="list-group-item">Porta ac consectetur ac</li> + <li class="list-group-item">Vestibulum at eros</li> +</ul> +{% endcapture %} +{% include example.html content=example %} + +## Links and buttons + +Use `<a>`s or `<button>`s to create _actionable_ list group items with hover, disabled, and active states by adding `.list-group-item-action`. We separate these pseudo-classes to ensure list groups made of non-interactive elements (like `<li>`s or `<div>`s) don't provide a click or tap affordance. + +Be sure to **not use the standard `.btn` classes here**. + +{% capture example %} +<div class="list-group"> + <a href="#" class="list-group-item list-group-item-action active"> + Cras justo odio + </a> + <a href="#" class="list-group-item list-group-item-action">Dapibus ac facilisis in</a> + <a href="#" class="list-group-item list-group-item-action">Morbi leo risus</a> + <a href="#" class="list-group-item list-group-item-action">Porta ac consectetur ac</a> + <a href="#" class="list-group-item list-group-item-action disabled" tabindex="-1" aria-disabled="true">Vestibulum at eros</a> +</div> +{% endcapture %} +{% include example.html content=example %} + +With `<button>`s, you can also make use of the `disabled` attribute instead of the `.disabled` class. Sadly, `<a>`s don't support the disabled attribute. + +{% capture example %} +<div class="list-group"> + <button type="button" class="list-group-item list-group-item-action active"> + Cras justo odio + </button> + <button type="button" class="list-group-item list-group-item-action">Dapibus ac facilisis in</button> + <button type="button" class="list-group-item list-group-item-action">Morbi leo risus</button> + <button type="button" class="list-group-item list-group-item-action">Porta ac consectetur ac</button> + <button type="button" class="list-group-item list-group-item-action" disabled>Vestibulum at eros</button> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Flush + +Add `.list-group-flush` to remove some borders and rounded corners to render list group items edge-to-edge in a parent container (e.g., cards). + +{% capture example %} +<ul class="list-group list-group-flush"> + <li class="list-group-item">Cras justo odio</li> + <li class="list-group-item">Dapibus ac facilisis in</li> + <li class="list-group-item">Morbi leo risus</li> + <li class="list-group-item">Porta ac consectetur ac</li> + <li class="list-group-item">Vestibulum at eros</li> +</ul> +{% endcapture %} +{% include example.html content=example %} + +## Horizontal + +Add `.list-group-horizontal` to change the layout of list group items from vertical to horizontal across all breakpoints. Alternatively, choose a responsive variant `.list-group-horizontal-{sm|md|lg|xl}` to make a list group horizontal starting at that breakpoint's `min-width`. Currently **horizontal list groups cannot be combined with flush list groups.** + +**ProTip:** Want equal-width list group items when horizontal? Add `.flex-fill` to each list group item. + +{% for bp in site.data.breakpoints %} +{% capture example %} +<ul class="list-group list-group-horizontal{{ bp.abbr }}"> + <li class="list-group-item">Cras justo odio</li> + <li class="list-group-item">Dapibus ac facilisis in</li> + <li class="list-group-item">Morbi leo risus</li> +</ul> +{% endcapture %} +{% include example.html content=example %}{% endfor %} + +## Contextual classes + +Use contextual classes to style list items with a stateful background and color. + +{% capture example %} +<ul class="list-group"> + <li class="list-group-item">Dapibus ac facilisis in</li> + + {% for color in site.data.theme-colors %} + <li class="list-group-item list-group-item-{{ color.name }}">A simple {{ color.name }} list group item</li>{% endfor %} +</ul> +{% endcapture %} +{% include example.html content=example %} + +Contextual classes also work with `.list-group-item-action`. Note the addition of the hover styles here not present in the previous example. Also supported is the `.active` state; apply it to indicate an active selection on a contextual list group item. + +{% capture example %} +<div class="list-group"> + <a href="#" class="list-group-item list-group-item-action">Dapibus ac facilisis in</a> + + {% for color in site.data.theme-colors %} + <a href="#" class="list-group-item list-group-item-action list-group-item-{{ color.name }}">A simple {{ color.name }} list group item</a>{% endfor %} +</div> +{% endcapture %} +{% include example.html content=example %} + +{% include callout-warning-color-assistive-technologies.md %} + +## With badges + +Add badges to any list group item to show unread counts, activity, and more with the help of some [utilities]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/flex/). + +{% capture example %} +<ul class="list-group"> + <li class="list-group-item d-flex justify-content-between align-items-center"> + Cras justo odio + <span class="badge badge-primary badge-pill">14</span> + </li> + <li class="list-group-item d-flex justify-content-between align-items-center"> + Dapibus ac facilisis in + <span class="badge badge-primary badge-pill">2</span> + </li> + <li class="list-group-item d-flex justify-content-between align-items-center"> + Morbi leo risus + <span class="badge badge-primary badge-pill">1</span> + </li> +</ul> +{% endcapture %} +{% include example.html content=example %} + +## Custom content + +Add nearly any HTML within, even for linked list groups like the one below, with the help of [flexbox utilities]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/flex/). + +{% capture example %} +<div class="list-group"> + <a href="#" class="list-group-item list-group-item-action active"> + <div class="d-flex w-100 justify-content-between"> + <h5 class="mb-1">List group item heading</h5> + <small>3 days ago</small> + </div> + <p class="mb-1">Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p> + <small>Donec id elit non mi porta.</small> + </a> + <a href="#" class="list-group-item list-group-item-action"> + <div class="d-flex w-100 justify-content-between"> + <h5 class="mb-1">List group item heading</h5> + <small class="text-muted">3 days ago</small> + </div> + <p class="mb-1">Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p> + <small class="text-muted">Donec id elit non mi porta.</small> + </a> + <a href="#" class="list-group-item list-group-item-action"> + <div class="d-flex w-100 justify-content-between"> + <h5 class="mb-1">List group item heading</h5> + <small class="text-muted">3 days ago</small> + </div> + <p class="mb-1">Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p> + <small class="text-muted">Donec id elit non mi porta.</small> + </a> +</div> +{% endcapture %} +{% include example.html content=example %} + +## JavaScript behavior + +Use the tab JavaScript plugin—include it individually or through the compiled `bootstrap.js` file—to extend our list group to create tabbable panes of local content. + +<div class="bd-example" role="tabpanel"> + <div class="row"> + <div class="col-4"> + <div class="list-group" id="list-tab" role="tablist"> + <a class="list-group-item list-group-item-action active" id="list-home-list" data-toggle="tab" href="#list-home" role="tab" aria-controls="list-home">Home</a> + <a class="list-group-item list-group-item-action" id="list-profile-list" data-toggle="tab" href="#list-profile" role="tab" aria-controls="list-profile">Profile</a> + <a class="list-group-item list-group-item-action" id="list-messages-list" data-toggle="tab" href="#list-messages" role="tab" aria-controls="list-messages">Messages</a> + <a class="list-group-item list-group-item-action" id="list-settings-list" data-toggle="tab" href="#list-settings" role="tab" aria-controls="list-settings">Settings</a> + </div> + </div> + <div class="col-8"> + <div class="tab-content" id="nav-tabContent"> + <div class="tab-pane fade show active" id="list-home" role="tabpanel" aria-labelledby="list-home-list"> + <p>Velit aute mollit ipsum ad dolor consectetur nulla officia culpa adipisicing exercitation fugiat tempor. Voluptate deserunt sit sunt nisi aliqua fugiat proident ea ut. Mollit voluptate reprehenderit occaecat nisi ad non minim tempor sunt voluptate consectetur exercitation id ut nulla. Ea et fugiat aliquip nostrud sunt incididunt consectetur culpa aliquip eiusmod dolor. Anim ad Lorem aliqua in cupidatat nisi enim eu nostrud do aliquip veniam minim.</p> + </div> + <div class="tab-pane fade" id="list-profile" role="tabpanel" aria-labelledby="list-profile-list"> + <p>Cupidatat quis ad sint excepteur laborum in esse qui. Et excepteur consectetur ex nisi eu do cillum ad laborum. Mollit et eu officia dolore sunt Lorem culpa qui commodo velit ex amet id ex. Officia anim incididunt laboris deserunt anim aute dolor incididunt veniam aute dolore do exercitation. Dolor nisi culpa ex ad irure in elit eu dolore. Ad laboris ipsum reprehenderit irure non commodo enim culpa commodo veniam incididunt veniam ad.</p> + </div> + <div class="tab-pane fade" id="list-messages" role="tabpanel" aria-labelledby="list-messages-list"> + <p>Ut ut do pariatur aliquip aliqua aliquip exercitation do nostrud commodo reprehenderit aute ipsum voluptate. Irure Lorem et laboris nostrud amet cupidatat cupidatat anim do ut velit mollit consequat enim tempor. Consectetur est minim nostrud nostrud consectetur irure labore voluptate irure. Ipsum id Lorem sit sint voluptate est pariatur eu ad cupidatat et deserunt culpa sit eiusmod deserunt. Consectetur et fugiat anim do eiusmod aliquip nulla laborum elit adipisicing pariatur cillum.</p> + </div> + <div class="tab-pane fade" id="list-settings" role="tabpanel" aria-labelledby="list-settings-list"> + <p>Irure enim occaecat labore sit qui aliquip reprehenderit amet velit. Deserunt ullamco ex elit nostrud ut dolore nisi officia magna sit occaecat laboris sunt dolor. Nisi eu minim cillum occaecat aute est cupidatat aliqua labore aute occaecat ea aliquip sunt amet. Aute mollit dolor ut exercitation irure commodo non amet consectetur quis amet culpa. Quis ullamco nisi amet qui aute irure eu. Magna labore dolor quis ex labore id nostrud deserunt dolor eiusmod eu pariatur culpa mollit in irure.</p> + </div> + </div> + </div> + </div> +</div> + +{% highlight html %} +<div class="row"> + <div class="col-4"> + <div class="list-group" id="list-tab" role="tablist"> + <a class="list-group-item list-group-item-action active" id="list-home-list" data-toggle="list" href="#list-home" role="tab" aria-controls="home">Home</a> + <a class="list-group-item list-group-item-action" id="list-profile-list" data-toggle="list" href="#list-profile" role="tab" aria-controls="profile">Profile</a> + <a class="list-group-item list-group-item-action" id="list-messages-list" data-toggle="list" href="#list-messages" role="tab" aria-controls="messages">Messages</a> + <a class="list-group-item list-group-item-action" id="list-settings-list" data-toggle="list" href="#list-settings" role="tab" aria-controls="settings">Settings</a> + </div> + </div> + <div class="col-8"> + <div class="tab-content" id="nav-tabContent"> + <div class="tab-pane fade show active" id="list-home" role="tabpanel" aria-labelledby="list-home-list">...</div> + <div class="tab-pane fade" id="list-profile" role="tabpanel" aria-labelledby="list-profile-list">...</div> + <div class="tab-pane fade" id="list-messages" role="tabpanel" aria-labelledby="list-messages-list">...</div> + <div class="tab-pane fade" id="list-settings" role="tabpanel" aria-labelledby="list-settings-list">...</div> + </div> + </div> +</div> +{% endhighlight %} + +### Using data attributes + +You can activate a list group navigation without writing any JavaScript by simply specifying `data-toggle="list"` or on an element. Use these data attributes on `.list-group-item`. + +<div role="tabpanel"> +{% highlight html %} +<!-- List group --> +<div class="list-group" id="myList" role="tablist"> + <a class="list-group-item list-group-item-action active" data-toggle="list" href="#home" role="tab">Home</a> + <a class="list-group-item list-group-item-action" data-toggle="list" href="#profile" role="tab">Profile</a> + <a class="list-group-item list-group-item-action" data-toggle="list" href="#messages" role="tab">Messages</a> + <a class="list-group-item list-group-item-action" data-toggle="list" href="#settings" role="tab">Settings</a> +</div> + +<!-- Tab panes --> +<div class="tab-content"> + <div class="tab-pane active" id="home" role="tabpanel">...</div> + <div class="tab-pane" id="profile" role="tabpanel">...</div> + <div class="tab-pane" id="messages" role="tabpanel">...</div> + <div class="tab-pane" id="settings" role="tabpanel">...</div> +</div> +{% endhighlight %} +</div> + +### Via JavaScript + +Enable tabbable list item via JavaScript (each list item needs to be activated individually): + +{% highlight js %} +$('#myList a').on('click', function (e) { + e.preventDefault() + $(this).tab('show') +}) +{% endhighlight %} + +You can activate individual list item in several ways: + +{% highlight js %} +$('#myList a[href="#profile"]').tab('show') // Select tab by name +$('#myList a:first-child').tab('show') // Select first tab +$('#myList a:last-child').tab('show') // Select last tab +$('#myList a:nth-child(3)').tab('show') // Select third tab +{% endhighlight %} + +### Fade effect + +To make tabs panel fade in, add `.fade` to each `.tab-pane`. The first tab pane must also have `.show` to make the initial content visible. + +{% highlight html %} +<div class="tab-content"> + <div class="tab-pane fade show active" id="home" role="tabpanel">...</div> + <div class="tab-pane fade" id="profile" role="tabpanel">...</div> + <div class="tab-pane fade" id="messages" role="tabpanel">...</div> + <div class="tab-pane fade" id="settings" role="tabpanel">...</div> +</div> +{% endhighlight %} + +### Methods + +#### $().tab + +Activates a list item element and content container. Tab should have either a `data-target` or an `href` targeting a container node in the DOM. + +{% highlight html %} +<div class="list-group" id="myList" role="tablist"> + <a class="list-group-item list-group-item-action active" data-toggle="list" href="#home" role="tab">Home</a> + <a class="list-group-item list-group-item-action" data-toggle="list" href="#profile" role="tab">Profile</a> + <a class="list-group-item list-group-item-action" data-toggle="list" href="#messages" role="tab">Messages</a> + <a class="list-group-item list-group-item-action" data-toggle="list" href="#settings" role="tab">Settings</a> +</div> + +<div class="tab-content"> + <div class="tab-pane active" id="home" role="tabpanel">...</div> + <div class="tab-pane" id="profile" role="tabpanel">...</div> + <div class="tab-pane" id="messages" role="tabpanel">...</div> + <div class="tab-pane" id="settings" role="tabpanel">...</div> +</div> + +<script> + $(function () { + $('#myList a:last-child').tab('show') + }) +</script> +{% endhighlight %} + +#### .tab('show') + +Selects the given list item and shows its associated pane. Any other list item that was previously selected becomes unselected and its associated pane is hidden. **Returns to the caller before the tab pane has actually been shown** (for example, before the `shown.bs.tab` event occurs). + +{% highlight js %} +$('#someListItem').tab('show') +{% endhighlight %} + +### Events + +When showing a new tab, the events fire in the following order: + +1. `hide.bs.tab` (on the current active tab) +2. `show.bs.tab` (on the to-be-shown tab) +3. `hidden.bs.tab` (on the previous active tab, the same one as for the `hide.bs.tab` event) +4. `shown.bs.tab` (on the newly-active just-shown tab, the same one as for the `show.bs.tab` event) + +If no tab was already active, the `hide.bs.tab` and `hidden.bs.tab` events will not be fired. + +<table class="table table-bordered table-striped"> + <thead> + <tr> + <th style="width: 150px;">Event type</th> + <th>Description</th> + </tr> + </thead> + <tbody> + <tr> + <td>show.bs.tab</td> + <td>This event fires on tab show, but before the new tab has been shown. Use <code>event.target</code> and <code>event.relatedTarget</code> to target the active tab and the previous active tab (if available) respectively.</td> + </tr> + <tr> + <td>shown.bs.tab</td> + <td>This event fires on tab show after a tab has been shown. Use <code>event.target</code> and <code>event.relatedTarget</code> to target the active tab and the previous active tab (if available) respectively.</td> + </tr> + <tr> + <td>hide.bs.tab</td> + <td>This event fires when a new tab is to be shown (and thus the previous active tab is to be hidden). Use <code>event.target</code> and <code>event.relatedTarget</code> to target the current active tab and the new soon-to-be-active tab, respectively.</td> + </tr> + <tr> + <td>hidden.bs.tab</td> + <td>This event fires after a new tab is shown (and thus the previous active tab is hidden). Use <code>event.target</code> and <code>event.relatedTarget</code> to target the previous active tab and the new active tab, respectively.</td> + </tr> + </tbody> +</table> + +{% highlight js %} +$('a[data-toggle="list"]').on('shown.bs.tab', function (e) { + e.target // newly activated tab + e.relatedTarget // previous active tab +}) +{% endhighlight %} diff --git a/vendor/twbs/bootstrap/site/docs/4.5/components/media-object.md b/vendor/twbs/bootstrap/site/docs/4.5/components/media-object.md new file mode 100644 index 000000000..32628e723 --- /dev/null +++ b/vendor/twbs/bootstrap/site/docs/4.5/components/media-object.md @@ -0,0 +1,144 @@ +--- +layout: docs +title: Media object +description: Documentation and examples for Bootstrap's media object to construct highly repetitive components like blog comments, tweets, and the like. +group: components +toc: true +--- + +## Example + +The [media object](http://www.stubbornella.org/content/2010/06/25/the-media-object-saves-hundreds-of-lines-of-code/) helps build complex and repetitive components where some media is positioned alongside content that doesn't wrap around said media. Plus, it does this with only two required classes thanks to flexbox. + +Below is an example of a single media object. Only two classes are required—the wrapping `.media` and the `.media-body` around your content. Optional padding and margin can be controlled through [spacing utilities]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/spacing/). + +{% capture example %} +<div class="media"> + {% include icons/placeholder.svg width="64" height="64" class="mr-3" %} + <div class="media-body"> + <h5 class="mt-0">Media heading</h5> + Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus. + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +{% capture callout %} +##### Flexbug #12: Inline elements aren't treated as flex items + +Internet Explorer 10-11 do not render inline elements like links or images (or `::before` and `::after` pseudo-elements) as flex items. The only workaround is to set a non-inline `display` value (e.g., `block`, `inline-block`, or `flex`). We suggest using `.d-flex`, one of our [display utilities]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/display/), as an easy fix. + +**Source:** [Flexbugs on GitHub](https://github.com/philipwalton/flexbugs#flexbug-12) +{% endcapture %} +{% include callout.html content=callout type="warning" %} + +## Nesting + +Media objects can be infinitely nested, though we suggest you stop at some point. Place nested `.media` within the `.media-body` of a parent media object. + +{% capture example %} +<div class="media"> + {% include icons/placeholder.svg width="64" height="64" class="mr-3" %} + <div class="media-body"> + <h5 class="mt-0">Media heading</h5> + Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus. + + <div class="media mt-3"> + <a class="mr-3" href="#"> + {% include icons/placeholder.svg width="64" height="64" %} + </a> + <div class="media-body"> + <h5 class="mt-0">Media heading</h5> + Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus. + </div> + </div> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Alignment + +Media in a media object can be aligned with flexbox utilities to the top (default), middle, or end of your `.media-body` content. + +{% capture example %} +<div class="media"> + {% include icons/placeholder.svg width="64" height="64" class="align-self-start mr-3" %} + <div class="media-body"> + <h5 class="mt-0">Top-aligned media</h5> + <p>Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.</p> + <p>Donec sed odio dui. Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +{% capture example %} +<div class="media"> + {% include icons/placeholder.svg width="64" height="64" class="align-self-center mr-3" %} + <div class="media-body"> + <h5 class="mt-0">Center-aligned media</h5> + <p>Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.</p> + <p class="mb-0">Donec sed odio dui. Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +{% capture example %} +<div class="media"> + {% include icons/placeholder.svg width="64" height="64" class="align-self-end mr-3" %} + <div class="media-body"> + <h5 class="mt-0">Bottom-aligned media</h5> + <p>Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.</p> + <p class="mb-0">Donec sed odio dui. Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Order + +Change the order of content in media objects by modifying the HTML itself, or by adding some custom flexbox CSS to set the `order` property (to an integer of your choosing). + +{% capture example %} +<div class="media"> + <div class="media-body"> + <h5 class="mt-0 mb-1">Media object</h5> + Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus. + </div> + {% include icons/placeholder.svg width="64" height="64" class="ml-3" %} +</div> +{% endcapture %} +{% include example.html content=example %} + +## Media list + +Because the media object has so few structural requirements, you can also use these classes on list HTML elements. On your `<ul>` or `<ol>`, add the `.list-unstyled` to remove any browser default list styles, and then apply `.media` to your `<li>`s. As always, use spacing utilities wherever needed to fine tune. + +{% capture example %} +<ul class="list-unstyled"> + <li class="media"> + {% include icons/placeholder.svg width="64" height="64" class="mr-3" %} + <div class="media-body"> + <h5 class="mt-0 mb-1">List-based media object</h5> + Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus. + </div> + </li> + <li class="media my-4"> + {% include icons/placeholder.svg width="64" height="64" class="mr-3" %} + <div class="media-body"> + <h5 class="mt-0 mb-1">List-based media object</h5> + Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus. + </div> + </li> + <li class="media"> + {% include icons/placeholder.svg width="64" height="64" class="mr-3" %} + <div class="media-body"> + <h5 class="mt-0 mb-1">List-based media object</h5> + Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus. + </div> + </li> +</ul> +{% endcapture %} +{% include example.html content=example %} diff --git a/vendor/twbs/bootstrap/site/docs/4.5/components/modal.md b/vendor/twbs/bootstrap/site/docs/4.5/components/modal.md new file mode 100644 index 000000000..9e1ac736f --- /dev/null +++ b/vendor/twbs/bootstrap/site/docs/4.5/components/modal.md @@ -0,0 +1,815 @@ +--- +layout: docs +title: Modal +description: Use Bootstrap's JavaScript modal plugin to add dialogs to your site for lightboxes, user notifications, or completely custom content. +group: components +toc: true +--- + +## How it works + +Before getting started with Bootstrap's modal component, be sure to read the following as our menu options have recently changed. + +- Modals are built with HTML, CSS, and JavaScript. They're positioned over everything else in the document and remove scroll from the `<body>` so that modal content scrolls instead. +- Clicking on the modal "backdrop" will automatically close the modal. +- Bootstrap only supports one modal window at a time. Nested modals aren't supported as we believe them to be poor user experiences. +- Modals use `position: fixed`, which can sometimes be a bit particular about its rendering. Whenever possible, place your modal HTML in a top-level position to avoid potential interference from other elements. You'll likely run into issues when nesting a `.modal` within another fixed element. +- Once again, due to `position: fixed`, there are some caveats with using modals on mobile devices. [See our browser support docs]({{ site.baseurl }}/docs/{{ site.docs_version }}/getting-started/browsers-devices/#modals-and-dropdowns-on-mobile) for details. +- Due to how HTML5 defines its semantics, [the `autofocus` HTML attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-autofocus) has no effect in Bootstrap modals. To achieve the same effect, use some custom JavaScript: + +{% highlight js %} +$('#myModal').on('shown.bs.modal', function () { + $('#myInput').trigger('focus') +}) +{% endhighlight %} + +{% include callout-info-prefersreducedmotion.md %} + +Keep reading for demos and usage guidelines. + +## Examples + +### Modal components + +Below is a _static_ modal example (meaning its `position` and `display` have been overridden). Included are the modal header, modal body (required for `padding`), and modal footer (optional). We ask that you include modal headers with dismiss actions whenever possible, or provide another explicit dismiss action. + +<div class="bd-example bd-example-modal"> + <div class="modal" tabindex="-1"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <h5 class="modal-title">Modal title</h5> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> + <div class="modal-body"> + <p>Modal body text goes here.</p> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> + <button type="button" class="btn btn-primary">Save changes</button> + </div> + </div> + </div> + </div> +</div> + +{% highlight html %} +<div class="modal" tabindex="-1"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <h5 class="modal-title">Modal title</h5> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> + <div class="modal-body"> + <p>Modal body text goes here.</p> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> + <button type="button" class="btn btn-primary">Save changes</button> + </div> + </div> + </div> +</div> +{% endhighlight %} + +### Live demo + +Toggle a working modal demo by clicking the button below. It will slide down and fade in from the top of the page. + +<div class="modal fade" id="exampleModalLive" tabindex="-1" aria-labelledby="exampleModalLiveLabel" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <h5 class="modal-title" id="exampleModalLiveLabel">Modal title</h5> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> + <div class="modal-body"> + <p>Woohoo, you're reading this text in a modal!</p> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> + <button type="button" class="btn btn-primary">Save changes</button> + </div> + </div> + </div> +</div> + +<div class="bd-example"> + <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalLive"> + Launch demo modal + </button> +</div> + +{% highlight html %} +<!-- Button trigger modal --> +<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal"> + Launch demo modal +</button> + +<!-- Modal --> +<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <h5 class="modal-title" id="exampleModalLabel">Modal title</h5> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> + <div class="modal-body"> + ... + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> + <button type="button" class="btn btn-primary">Save changes</button> + </div> + </div> + </div> +</div> +{% endhighlight %} + +### Static backdrop + +When backdrop is set to static, the modal will not close when clicking outside it. Click the button below to try it. + +<div class="modal fade" id="staticBackdropLive" data-backdrop="static" data-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLiveLabel" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <h5 class="modal-title" id="staticBackdropLiveLabel">Modal title</h5> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> + <div class="modal-body"> + <p>I will not close if you click outside me. Don't even try to press escape key.</p> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> + <button type="button" class="btn btn-primary">Understood</button> + </div> + </div> + </div> +</div> + +<div class="bd-example"> + <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#staticBackdropLive"> + Launch static backdrop modal + </button> +</div> + +{% highlight html %} +<!-- Button trigger modal --> +<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#staticBackdrop"> + Launch static backdrop modal +</button> + +<!-- Modal --> +<div class="modal fade" id="staticBackdrop" data-backdrop="static" data-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <h5 class="modal-title" id="staticBackdropLabel">Modal title</h5> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> + <div class="modal-body"> + ... + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> + <button type="button" class="btn btn-primary">Understood</button> + </div> + </div> + </div> +</div> +{% endhighlight %} + + +### Scrolling long content + +When modals become too long for the user's viewport or device, they scroll independent of the page itself. Try the demo below to see what we mean. + +<div class="modal fade" id="exampleModalLong" tabindex="-1" aria-labelledby="exampleModalLongTitle" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <h5 class="modal-title" id="exampleModalLongTitle">Modal title</h5> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> + <div class="modal-body"> + <p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p> + <p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p> + <p>Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.</p> + <p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p> + <p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p> + <p>Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.</p> + <p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p> + <p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p> + <p>Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.</p> + <p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p> + <p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p> + <p>Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.</p> + <p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p> + <p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p> + <p>Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.</p> + <p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p> + <p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p> + <p>Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.</p> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> + <button type="button" class="btn btn-primary">Save changes</button> + </div> + </div> + </div> +</div> + +<div class="bd-example"> + <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalLong"> + Launch demo modal + </button> +</div> + +You can also create a scrollable modal that allows scroll the modal body by adding `.modal-dialog-scrollable` to `.modal-dialog`. + +<div class="modal fade" id="exampleModalScrollable" tabindex="-1" aria-labelledby="exampleModalScrollableTitle" aria-hidden="true"> + <div class="modal-dialog modal-dialog-scrollable"> + <div class="modal-content"> + <div class="modal-header"> + <h5 class="modal-title" id="exampleModalScrollableTitle">Modal title</h5> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> + <div class="modal-body"> + <p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p> + <p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p> + <p>Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.</p> + <p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p> + <p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p> + <p>Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.</p> + <p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p> + <p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p> + <p>Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.</p> + <p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p> + <p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p> + <p>Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.</p> + <p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p> + <p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p> + <p>Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.</p> + <p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p> + <p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p> + <p>Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.</p> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> + <button type="button" class="btn btn-primary">Save changes</button> + </div> + </div> + </div> +</div> + +<div class="bd-example"> + <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalScrollable"> + Launch demo modal + </button> +</div> + +{% highlight html %} +<!-- Scrollable modal --> +<div class="modal-dialog modal-dialog-scrollable"> + ... +</div> +{% endhighlight %} + +### Vertically centered + +Add `.modal-dialog-centered` to `.modal-dialog` to vertically center the modal. + +<div class="modal fade" id="exampleModalCenter" tabindex="-1" aria-labelledby="exampleModalCenterTitle" aria-hidden="true"> + <div class="modal-dialog modal-dialog-centered"> + <div class="modal-content"> + <div class="modal-header"> + <h5 class="modal-title" id="exampleModalCenterTitle">Modal title</h5> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> + <div class="modal-body"> + <p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> + <button type="button" class="btn btn-primary">Save changes</button> + </div> + </div> + </div> +</div> + +<div class="modal fade" id="exampleModalCenteredScrollable" tabindex="-1" aria-labelledby="exampleModalCenteredScrollableTitle" aria-hidden="true"> + <div class="modal-dialog modal-dialog-centered modal-dialog-scrollable"> + <div class="modal-content"> + <div class="modal-header"> + <h5 class="modal-title" id="exampleModalCenteredScrollableTitle">Modal title</h5> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> + <div class="modal-body"> + <p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p> + <p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p> + <p>Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.</p> + <p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p> + <p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> + <button type="button" class="btn btn-primary">Save changes</button> + </div> + </div> + </div> +</div> + +<div class="bd-example"> + <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalCenter"> + Vertically centered modal + </button> + <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalCenteredScrollable"> + Vertically centered scrollable modal + </button> +</div> + +{% highlight html %} +<!-- Vertically centered modal --> +<div class="modal-dialog modal-dialog-centered"> + ... +</div> + +<!-- Vertically centered scrollable modal --> +<div class="modal-dialog modal-dialog-centered modal-dialog-scrollable"> + ... +</div> +{% endhighlight %} + +### Tooltips and popovers + +[Tooltips]({{ site.baseurl }}/docs/{{ site.docs_version }}/components/tooltips/) and [popovers]({{ site.baseurl }}/docs/{{ site.docs_version }}/components/popovers/) can be placed within modals as needed. When modals are closed, any tooltips and popovers within are also automatically dismissed. + +<div class="modal fade" id="exampleModalPopovers" tabindex="-1" aria-labelledby="exampleModalPopoversLabel" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <h5 class="modal-title" id="exampleModalPopoversLabel">Modal title</h5> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> + <div class="modal-body"> + <h5>Popover in a modal</h5> + <p>This <a href="#" role="button" class="btn btn-secondary popover-test" title="Popover title" data-content="Popover body content is set in this attribute." data-container="#exampleModalPopovers">button</a> triggers a popover on click.</p> + <hr> + <h5>Tooltips in a modal</h5> + <p><a href="#" class="tooltip-test" title="Tooltip" data-container="#exampleModalPopovers">This link</a> and <a href="#" class="tooltip-test" title="Tooltip" data-container="#exampleModalPopovers">that link</a> have tooltips on hover.</p> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> + <button type="button" class="btn btn-primary">Save changes</button> + </div> + </div> + </div> +</div> + +<div class="bd-example"> + <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalPopovers"> + Launch demo modal + </button> +</div> + +{% highlight html %} +<div class="modal-body"> + <h5>Popover in a modal</h5> + <p>This <a href="#" role="button" class="btn btn-secondary popover-test" title="Popover title" data-content="Popover body content is set in this attribute.">button</a> triggers a popover on click.</p> + <hr> + <h5>Tooltips in a modal</h5> + <p><a href="#" class="tooltip-test" title="Tooltip">This link</a> and <a href="#" class="tooltip-test" title="Tooltip">that link</a> have tooltips on hover.</p> +</div> +{% endhighlight %} + +### Using the grid + +Utilize the Bootstrap grid system within a modal by nesting `.container-fluid` within the `.modal-body`. Then, use the normal grid system classes as you would anywhere else. + +<div class="modal fade" id="gridSystemModal" tabindex="-1" aria-labelledby="gridModalLabel" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <h5 class="modal-title" id="gridModalLabel">Grids in modals</h5> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> + </div> + <div class="modal-body"> + <div class="container-fluid bd-example-row"> + <div class="row"> + <div class="col-md-4">.col-md-4</div> + <div class="col-md-4 ml-auto">.col-md-4 .ml-auto</div> + </div> + <div class="row"> + <div class="col-md-3 ml-auto">.col-md-3 .ml-auto</div> + <div class="col-md-2 ml-auto">.col-md-2 .ml-auto</div> + </div> + <div class="row"> + <div class="col-md-6 ml-auto">.col-md-6 .ml-auto</div> + </div> + <div class="row"> + <div class="col-sm-9"> + Level 1: .col-sm-9 + <div class="row"> + <div class="col-8 col-sm-6"> + Level 2: .col-8 .col-sm-6 + </div> + <div class="col-4 col-sm-6"> + Level 2: .col-4 .col-sm-6 + </div> + </div> + </div> + </div> + </div> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> + <button type="button" class="btn btn-primary">Save changes</button> + </div> + </div> + </div> +</div> + +<div class="bd-example"> +<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#gridSystemModal"> + Launch demo modal +</button> +</div> + +{% highlight html %} +<div class="modal-body"> + <div class="container-fluid"> + <div class="row"> + <div class="col-md-4">.col-md-4</div> + <div class="col-md-4 ml-auto">.col-md-4 .ml-auto</div> + </div> + <div class="row"> + <div class="col-md-3 ml-auto">.col-md-3 .ml-auto</div> + <div class="col-md-2 ml-auto">.col-md-2 .ml-auto</div> + </div> + <div class="row"> + <div class="col-md-6 ml-auto">.col-md-6 .ml-auto</div> + </div> + <div class="row"> + <div class="col-sm-9"> + Level 1: .col-sm-9 + <div class="row"> + <div class="col-8 col-sm-6"> + Level 2: .col-8 .col-sm-6 + </div> + <div class="col-4 col-sm-6"> + Level 2: .col-4 .col-sm-6 + </div> + </div> + </div> + </div> + </div> +</div> +{% endhighlight %} + +### Varying modal content + +Have a bunch of buttons that all trigger the same modal with slightly different contents? Use `event.relatedTarget` and [HTML `data-*` attributes](https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes) (possibly [via jQuery](https://api.jquery.com/data/)) to vary the contents of the modal depending on which button was clicked. + +Below is a live demo followed by example HTML and JavaScript. For more information, [read the modal events docs](#events) for details on `relatedTarget`. + +{% capture example %} +<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" data-whatever="@mdo">Open modal for @mdo</button> +<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" data-whatever="@fat">Open modal for @fat</button> +<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" data-whatever="@getbootstrap">Open modal for @getbootstrap</button> + +<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <h5 class="modal-title" id="exampleModalLabel">New message</h5> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> + <div class="modal-body"> + <form> + <div class="form-group"> + <label for="recipient-name" class="col-form-label">Recipient:</label> + <input type="text" class="form-control" id="recipient-name"> + </div> + <div class="form-group"> + <label for="message-text" class="col-form-label">Message:</label> + <textarea class="form-control" id="message-text"></textarea> + </div> + </form> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> + <button type="button" class="btn btn-primary">Send message</button> + </div> + </div> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +{% highlight js %} +$('#exampleModal').on('show.bs.modal', function (event) { + var button = $(event.relatedTarget) // Button that triggered the modal + var recipient = button.data('whatever') // Extract info from data-* attributes + // If necessary, you could initiate an AJAX request here (and then do the updating in a callback). + // Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead. + var modal = $(this) + modal.find('.modal-title').text('New message to ' + recipient) + modal.find('.modal-body input').val(recipient) +}) +{% endhighlight %} + +### Change animation + +The `$modal-fade-transform` variable determines the transform state of `.modal-dialog` before the modal fade-in animation, the `$modal-show-transform` variable determines the transform of `.modal-dialog` at the end of the modal fade-in animation. + +If you want for example a zoom-in animation, you can set `$modal-fade-transform: scale(.8)`. + +### Remove animation + +For modals that simply appear rather than fade in to view, remove the `.fade` class from your modal markup. + +{% highlight html %} +<div class="modal" tabindex="-1" aria-labelledby="..." aria-hidden="true"> + ... +</div> +{% endhighlight %} + +### Dynamic heights + +If the height of a modal changes while it is open, you should call `$('#myModal').modal('handleUpdate')` to readjust the modal's position in case a scrollbar appears. + +### Accessibility + +Be sure to add `aria-labelledby="..."`, referencing the modal title, to `.modal`. Additionally, you may give a description of your modal dialog with `aria-describedby` on `.modal`. Note that you don't need to add `role="dialog"` since we already add it via JavaScript. + +### Embedding YouTube videos + +Embedding YouTube videos in modals requires additional JavaScript not in Bootstrap to automatically stop playback and more. [See this helpful Stack Overflow post](https://stackoverflow.com/questions/18622508/bootstrap-3-and-youtube-in-modal) for more information. + +## Optional sizes + +Modals have three optional sizes, available via modifier classes to be placed on a `.modal-dialog`. These sizes kick in at certain breakpoints to avoid horizontal scrollbars on narrower viewports. + +<table class="table table-bordered table-striped"> + <thead> + <tr> + <th>Size</th> + <th>Class</th> + <th>Modal max-width</th> + </tr> + </thead> + <tbody> + <tr> + <td>Small</td> + <td><code>.modal-sm</code></td> + <td><code>300px</code></td> + </tr> + <tr> + <td>Default</td> + <td class="text-muted">None</td> + <td><code>500px</code></td> + </tr> + <tr> + <td>Large</td> + <td><code>.modal-lg</code></td> + <td><code>800px</code></td> + </tr> + <tr> + <td>Extra large</td> + <td><code>.modal-xl</code></td> + <td><code>1140px</code></td> + </tr> + </tbody> +</table> + +Our default modal without modifier class constitutes the "medium" size modal. + +<div class="bd-example"> + <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalXl">Extra large modal</button> + <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalLg">Large modal</button> + <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalSm">Small modal</button> +</div> + +{% highlight html %} +<div class="modal-dialog modal-xl">...</div> +<div class="modal-dialog modal-lg">...</div> +<div class="modal-dialog modal-sm">...</div> +{% endhighlight %} + +<div class="modal fade" id="exampleModalXl" tabindex="-1" aria-labelledby="exampleModalXlLabel" aria-hidden="true"> + <div class="modal-dialog modal-xl"> + <div class="modal-content"> + + <div class="modal-header"> + <h5 class="modal-title h4" id="exampleModalXlLabel">Extra large modal</h5> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> + <div class="modal-body"> + ... + </div> + </div> + </div> +</div> + +<div class="modal fade" id="exampleModalLg" tabindex="-1" aria-labelledby="exampleModalLgLabel" aria-hidden="true"> + <div class="modal-dialog modal-lg"> + <div class="modal-content"> + + <div class="modal-header"> + <h5 class="modal-title h4" id="exampleModalLgLabel">Large modal</h5> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> + <div class="modal-body"> + ... + </div> + </div> + </div> +</div> + +<div class="modal fade" id="exampleModalSm" tabindex="-1" aria-labelledby="exampleModalSmLabel" aria-hidden="true"> + <div class="modal-dialog modal-sm"> + <div class="modal-content"> + <div class="modal-header"> + <h5 class="modal-title h4" id="exampleModalSmLabel">Small modal</h5> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> + <div class="modal-body"> + ... + </div> + </div> + </div> +</div> + +## Usage + +The modal plugin toggles your hidden content on demand, via data attributes or JavaScript. It also adds `.modal-open` to the `<body>` to override default scrolling behavior and generates a `.modal-backdrop` to provide a click area for dismissing shown modals when clicking outside the modal. + +### Via data attributes + +Activate a modal without writing JavaScript. Set `data-toggle="modal"` on a controller element, like a button, along with a `data-target="#foo"` or `href="#foo"` to target a specific modal to toggle. + +{% highlight html %} +<button type="button" data-toggle="modal" data-target="#myModal">Launch modal</button> +{% endhighlight %} + +### Via JavaScript + +Call a modal with id `myModal` with a single line of JavaScript: + +{% highlight js %}$('#myModal').modal(options){% endhighlight %} + +### Options + +Options can be passed via data attributes or JavaScript. For data attributes, append the option name to `data-`, as in `data-backdrop=""`. + +<table class="table table-bordered table-striped"> + <thead> + <tr> + <th style="width: 100px;">Name</th> + <th style="width: 50px;">Type</th> + <th style="width: 50px;">Default</th> + <th>Description</th> + </tr> + </thead> + <tbody> + <tr> + <td>backdrop</td> + <td>boolean or the string <code>'static'</code></td> + <td>true</td> + <td>Includes a modal-backdrop element. Alternatively, specify <code>static</code> for a backdrop which doesn't close the modal on click.</td> + </tr> + <tr> + <td>keyboard</td> + <td>boolean</td> + <td>true</td> + <td>Closes the modal when escape key is pressed</td> + </tr> + <tr> + <td>focus</td> + <td>boolean</td> + <td>true</td> + <td>Puts the focus on the modal when initialized.</td> + </tr> + <tr> + <td>show</td> + <td>boolean</td> + <td>true</td> + <td>Shows the modal when initialized.</td> + </tr> + </tbody> +</table> + +### Methods + +{% include callout-danger-async-methods.md %} + +#### `.modal(options)` + +Activates your content as a modal. Accepts an optional options `object`. + +{% highlight js %} +$('#myModal').modal({ + keyboard: false +}) +{% endhighlight %} + +#### `.modal('toggle')` + +Manually toggles a modal. **Returns to the caller before the modal has actually been shown or hidden** (i.e. before the `shown.bs.modal` or `hidden.bs.modal` event occurs). + +{% highlight js %}$('#myModal').modal('toggle'){% endhighlight %} + +#### `.modal('show')` + +Manually opens a modal. **Returns to the caller before the modal has actually been shown** (i.e. before the `shown.bs.modal` event occurs). + +{% highlight js %}$('#myModal').modal('show'){% endhighlight %} + +#### `.modal('hide')` + +Manually hides a modal. **Returns to the caller before the modal has actually been hidden** (i.e. before the `hidden.bs.modal` event occurs). + +{% highlight js %}$('#myModal').modal('hide'){% endhighlight %} + +#### `.modal('handleUpdate')` + +Manually readjust the modal's position if the height of a modal changes while it is open (i.e. in case a scrollbar appears). + +{% highlight js %}$('#myModal').modal('handleUpdate'){% endhighlight %} + +#### `.modal('dispose')` + +Destroys an element's modal. + +### Events + +Bootstrap's modal class exposes a few events for hooking into modal functionality. All modal events are fired at the modal itself (i.e. at the `<div class="modal">`). + +<table class="table table-bordered table-striped"> + <thead> + <tr> + <th style="width: 150px;">Event Type</th> + <th>Description</th> + </tr> + </thead> + <tbody> + <tr> + <td>show.bs.modal</td> + <td>This event fires immediately when the <code>show</code> instance method is called. If caused by a click, the clicked element is available as the <code>relatedTarget</code> property of the event.</td> + </tr> + <tr> + <td>shown.bs.modal</td> + <td>This event is fired when the modal has been made visible to the user (will wait for CSS transitions to complete). If caused by a click, the clicked element is available as the <code>relatedTarget</code> property of the event.</td> + </tr> + <tr> + <td>hide.bs.modal</td> + <td>This event is fired immediately when the <code>hide</code> instance method has been called.</td> + </tr> + <tr> + <td>hidden.bs.modal</td> + <td>This event is fired when the modal has finished being hidden from the user (will wait for CSS transitions to complete).</td> + </tr> + <tr> + <td>hidePrevented.bs.modal</td> + <td>This event is fired when the modal is shown, its backdrop is <code>static</code> and a click outside the modal or an escape key press is performed with the keyboard option or <code>data-keyboard</code> set to <code>false</code>.</td> + </tr> + </tbody> +</table> + +{% highlight js %} +$('#myModal').on('hidden.bs.modal', function (e) { + // do something... +}) +{% endhighlight %} diff --git a/vendor/twbs/bootstrap/site/docs/4.5/components/navbar.md b/vendor/twbs/bootstrap/site/docs/4.5/components/navbar.md new file mode 100644 index 000000000..4d26be319 --- /dev/null +++ b/vendor/twbs/bootstrap/site/docs/4.5/components/navbar.md @@ -0,0 +1,581 @@ +--- +layout: docs +title: Navbar +description: Documentation and examples for Bootstrap's powerful, responsive navigation header, the navbar. Includes support for branding, navigation, and more, including support for our collapse plugin. +group: components +toc: true +--- + +## How it works + +Here's what you need to know before getting started with the navbar: + +- Navbars require a wrapping `.navbar` with `.navbar-expand{-sm|-md|-lg|-xl}` for responsive collapsing and [color scheme](#color-schemes) classes. +- Navbars and their contents are fluid by default. Use [optional containers](#containers) to limit their horizontal width. +- Use our [spacing]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/spacing/) and [flex]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/flex/) utility classes for controlling spacing and alignment within navbars. +- Navbars are responsive by default, but you can easily modify them to change that. Responsive behavior depends on our Collapse JavaScript plugin. +- Navbars are hidden by default when printing. Force them to be printed by adding `.d-print` to the `.navbar`. See the [display]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/display/) utility class. +- Ensure accessibility by using a `<nav>` element or, if using a more generic element such as a `<div>`, add a `role="navigation"` to every navbar to explicitly identify it as a landmark region for users of assistive technologies. + +{% include callout-info-prefersreducedmotion.md %} + +Read on for an example and list of supported sub-components. + +## Supported content + +Navbars come with built-in support for a handful of sub-components. Choose from the following as needed: + +- `.navbar-brand` for your company, product, or project name. +- `.navbar-nav` for a full-height and lightweight navigation (including support for dropdowns). +- `.navbar-toggler` for use with our collapse plugin and other [navigation toggling](#responsive-behaviors) behaviors. +- `.form-inline` for any form controls and actions. +- `.navbar-text` for adding vertically centered strings of text. +- `.collapse.navbar-collapse` for grouping and hiding navbar contents by a parent breakpoint. + +Here's an example of all the sub-components included in a responsive light-themed navbar that automatically collapses at the `lg` (large) breakpoint. + +{% capture example %} +<nav class="navbar navbar-expand-lg navbar-light bg-light"> + <a class="navbar-brand" href="#">Navbar</a> + <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> + <span class="navbar-toggler-icon"></span> + </button> + + <div class="collapse navbar-collapse" id="navbarSupportedContent"> + <ul class="navbar-nav mr-auto"> + <li class="nav-item active"> + <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Link</a> + </li> + <li class="nav-item dropdown"> + <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + Dropdown + </a> + <div class="dropdown-menu" aria-labelledby="navbarDropdown"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Something else here</a> + </div> + </li> + <li class="nav-item"> + <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> + </li> + </ul> + <form class="form-inline my-2 my-lg-0"> + <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search"> + <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button> + </form> + </div> +</nav> +{% endcapture %} +{% include example.html content=example %} + +This example uses [color]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/colors/) (`bg-light`) and [spacing]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/spacing/) (`my-2`, `my-lg-0`, `mr-sm-0`, `my-sm-0`) utility classes. + +### Brand + +The `.navbar-brand` can be applied to most elements, but an anchor works best as some elements might require utility classes or custom styles. + +{% capture example %} +<!-- As a link --> +<nav class="navbar navbar-light bg-light"> + <a class="navbar-brand" href="#">Navbar</a> +</nav> + +<!-- As a heading --> +<nav class="navbar navbar-light bg-light"> + <span class="navbar-brand mb-0 h1">Navbar</span> +</nav> +{% endcapture %} +{% include example.html content=example %} + +Adding images to the `.navbar-brand` will likely always require custom styles or utilities to properly size. Here are some examples to demonstrate. + +{% capture example %} +<!-- Just an image --> +<nav class="navbar navbar-light bg-light"> + <a class="navbar-brand" href="#"> + <img src="{{ site.baseurl }}/docs/{{ site.docs_version }}/assets/brand/bootstrap-solid.svg" width="30" height="30" alt="" loading="lazy"> + </a> +</nav> +{% endcapture %} +{% include example.html content=example %} + +{% capture example %} +<!-- Image and text --> +<nav class="navbar navbar-light bg-light"> + <a class="navbar-brand" href="#"> + <img src="{{ site.baseurl }}/docs/{{ site.docs_version }}/assets/brand/bootstrap-solid.svg" width="30" height="30" class="d-inline-block align-top" alt="" loading="lazy"> + Bootstrap + </a> +</nav> +{% endcapture %} +{% include example.html content=example %} + +### Nav + +Navbar navigation links build on our `.nav` options with their own modifier class and require the use of [toggler classes](#toggler) for proper responsive styling. **Navigation in navbars will also grow to occupy as much horizontal space as possible** to keep your navbar contents securely aligned. + +Active states—with `.active`—to indicate the current page can be applied directly to `.nav-link`s or their immediate parent `.nav-item`s. + +{% capture example %} +<nav class="navbar navbar-expand-lg navbar-light bg-light"> + <a class="navbar-brand" href="#">Navbar</a> + <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"> + <span class="navbar-toggler-icon"></span> + </button> + <div class="collapse navbar-collapse" id="navbarNav"> + <ul class="navbar-nav"> + <li class="nav-item active"> + <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Features</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Pricing</a> + </li> + <li class="nav-item"> + <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> + </li> + </ul> + </div> +</nav> +{% endcapture %} +{% include example.html content=example %} + +And because we use classes for our navs, you can avoid the list-based approach entirely if you like. + +{% capture example %} +<nav class="navbar navbar-expand-lg navbar-light bg-light"> + <a class="navbar-brand" href="#">Navbar</a> + <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation"> + <span class="navbar-toggler-icon"></span> + </button> + <div class="collapse navbar-collapse" id="navbarNavAltMarkup"> + <div class="navbar-nav"> + <a class="nav-link active" href="#">Home <span class="sr-only">(current)</span></a> + <a class="nav-link" href="#">Features</a> + <a class="nav-link" href="#">Pricing</a> + <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> + </div> + </div> +</nav> +{% endcapture %} +{% include example.html content=example %} + +You may also utilize dropdowns in your navbar nav. Dropdown menus require a wrapping element for positioning, so be sure to use separate and nested elements for `.nav-item` and `.nav-link` as shown below. + +{% capture example %} +<nav class="navbar navbar-expand-lg navbar-light bg-light"> + <a class="navbar-brand" href="#">Navbar</a> + <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation"> + <span class="navbar-toggler-icon"></span> + </button> + <div class="collapse navbar-collapse" id="navbarNavDropdown"> + <ul class="navbar-nav"> + <li class="nav-item active"> + <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Features</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Pricing</a> + </li> + <li class="nav-item dropdown"> + <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + Dropdown link + </a> + <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + </div> + </li> + </ul> + </div> +</nav> +{% endcapture %} +{% include example.html content=example %} + +### Forms + +Place various form controls and components within a navbar with `.form-inline`. + +{% capture example %} +<nav class="navbar navbar-light bg-light"> + <form class="form-inline"> + <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search"> + <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button> + </form> +</nav> +{% endcapture %} +{% include example.html content=example %} + +Immediate children elements in `.navbar` use flex layout and will default to `justify-content: space-between`. Use additional [flex utilities]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/flex/) as needed to adjust this behavior. + +{% capture example %} +<nav class="navbar navbar-light bg-light"> + <a class="navbar-brand">Navbar</a> + <form class="form-inline"> + <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search"> + <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button> + </form> +</nav> +{% endcapture %} +{% include example.html content=example %} + +Input groups work, too: + +{% capture example %} +<nav class="navbar navbar-light bg-light"> + <form class="form-inline"> + <div class="input-group"> + <div class="input-group-prepend"> + <span class="input-group-text" id="basic-addon1">@</span> + </div> + <input type="text" class="form-control" placeholder="Username" aria-label="Username" aria-describedby="basic-addon1"> + </div> + </form> +</nav> +{% endcapture %} +{% include example.html content=example %} + +Various buttons are supported as part of these navbar forms, too. This is also a great reminder that vertical alignment utilities can be used to align different sized elements. + +{% capture example %} +<nav class="navbar navbar-light bg-light"> + <form class="form-inline"> + <button class="btn btn-outline-success" type="button">Main button</button> + <button class="btn btn-sm btn-outline-secondary" type="button">Smaller button</button> + </form> +</nav> +{% endcapture %} +{% include example.html content=example %} + +### Text + +Navbars may contain bits of text with the help of `.navbar-text`. This class adjusts vertical alignment and horizontal spacing for strings of text. + +{% capture example %} +<nav class="navbar navbar-light bg-light"> + <span class="navbar-text"> + Navbar text with an inline element + </span> +</nav> +{% endcapture %} +{% include example.html content=example %} + +Mix and match with other components and utilities as needed. + +{% capture example %} +<nav class="navbar navbar-expand-lg navbar-light bg-light"> + <a class="navbar-brand" href="#">Navbar w/ text</a> + <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation"> + <span class="navbar-toggler-icon"></span> + </button> + <div class="collapse navbar-collapse" id="navbarText"> + <ul class="navbar-nav mr-auto"> + <li class="nav-item active"> + <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Features</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Pricing</a> + </li> + </ul> + <span class="navbar-text"> + Navbar text with an inline element + </span> + </div> +</nav> +{% endcapture %} +{% include example.html content=example %} + +## Color schemes + +Theming the navbar has never been easier thanks to the combination of theming classes and `background-color` utilities. Choose from `.navbar-light` for use with light background colors, or `.navbar-dark` for dark background colors. Then, customize with `.bg-*` utilities. + +<div class="bd-example"> + <nav class="navbar navbar-expand-lg navbar-dark bg-dark"> + <a class="navbar-brand" href="#">Navbar</a> + <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarColor01" aria-controls="navbarColor01" aria-expanded="false" aria-label="Toggle navigation"> + <span class="navbar-toggler-icon"></span> + </button> + + <div class="collapse navbar-collapse" id="navbarColor01"> + <ul class="navbar-nav mr-auto"> + <li class="nav-item active"> + <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Features</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Pricing</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">About</a> + </li> + </ul> + <form class="form-inline"> + <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search"> + <button class="btn btn-outline-info my-2 my-sm-0" type="submit">Search</button> + </form> + </div> + </nav> + + <nav class="navbar navbar-expand-lg navbar-dark bg-primary"> + <a class="navbar-brand" href="#">Navbar</a> + <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarColor02" aria-controls="navbarColor02" aria-expanded="false" aria-label="Toggle navigation"> + <span class="navbar-toggler-icon"></span> + </button> + + <div class="collapse navbar-collapse" id="navbarColor02"> + <ul class="navbar-nav mr-auto"> + <li class="nav-item active"> + <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Features</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Pricing</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">About</a> + </li> + </ul> + <form class="form-inline"> + <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search"> + <button class="btn btn-outline-light my-2 my-sm-0" type="submit">Search</button> + </form> + </div> + </nav> + + <nav class="navbar navbar-expand-lg navbar-light" style="background-color: #e3f2fd;"> + <a class="navbar-brand" href="#">Navbar</a> + <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarColor03" aria-controls="navbarColor03" aria-expanded="false" aria-label="Toggle navigation"> + <span class="navbar-toggler-icon"></span> + </button> + + <div class="collapse navbar-collapse" id="navbarColor03"> + <ul class="navbar-nav mr-auto"> + <li class="nav-item active"> + <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Features</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Pricing</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">About</a> + </li> + </ul> + <form class="form-inline"> + <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search"> + <button class="btn btn-outline-primary my-2 my-sm-0" type="submit">Search</button> + </form> + </div> + </nav> +</div> + +{% highlight html %} +<nav class="navbar navbar-dark bg-dark"> + <!-- Navbar content --> +</nav> + +<nav class="navbar navbar-dark bg-primary"> + <!-- Navbar content --> +</nav> + +<nav class="navbar navbar-light" style="background-color: #e3f2fd;"> + <!-- Navbar content --> +</nav> +{% endhighlight %} + +## Containers + +Although it's not required, you can wrap a navbar in a `.container` to center it on a page or add one within to only center the contents of a [fixed or static top navbar](#placement). + +{% capture example %} +<div class="container"> + <nav class="navbar navbar-expand-lg navbar-light bg-light"> + <a class="navbar-brand" href="#">Navbar</a> + </nav> +</div> +{% endcapture %} +{% include example.html content=example %} + +When the container is within your navbar, its horizontal padding is removed at breakpoints lower than your specified `.navbar-expand{-sm|-md|-lg|-xl}` class. This ensures we're not doubling up on padding unnecessarily on lower viewports when your navbar is collapsed. + +{% capture example %} +<nav class="navbar navbar-expand-lg navbar-light bg-light"> + <div class="container"> + <a class="navbar-brand" href="#">Navbar</a> + </div> +</nav> +{% endcapture %} +{% include example.html content=example %} + +## Placement + +Use our [position utilities]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/position/) to place navbars in non-static positions. Choose from fixed to the top, fixed to the bottom, or stickied to the top (scrolls with the page until it reaches the top, then stays there). Fixed navbars use `position: fixed`, meaning they're pulled from the normal flow of the DOM and may require custom CSS (e.g., `padding-top` on the `<body>`) to prevent overlap with other elements. + +Also note that **`.sticky-top` uses `position: sticky`, which [isn't fully supported in every browser](https://caniuse.com/#feat=css-sticky)**. + +{% capture example %} +<nav class="navbar navbar-light bg-light"> + <a class="navbar-brand" href="#">Default</a> +</nav> +{% endcapture %} +{% include example.html content=example %} + +{% capture example %} +<nav class="navbar fixed-top navbar-light bg-light"> + <a class="navbar-brand" href="#">Fixed top</a> +</nav> +{% endcapture %} +{% include example.html content=example %} + +{% capture example %} +<nav class="navbar fixed-bottom navbar-light bg-light"> + <a class="navbar-brand" href="#">Fixed bottom</a> +</nav> +{% endcapture %} +{% include example.html content=example %} + +{% capture example %} +<nav class="navbar sticky-top navbar-light bg-light"> + <a class="navbar-brand" href="#">Sticky top</a> +</nav> +{% endcapture %} +{% include example.html content=example %} + +## Responsive behaviors + +Navbars can utilize `.navbar-toggler`, `.navbar-collapse`, and `.navbar-expand{-sm|-md|-lg|-xl}` classes to change when their content collapses behind a button. In combination with other utilities, you can easily choose when to show or hide particular elements. + +For navbars that never collapse, add the `.navbar-expand` class on the navbar. For navbars that always collapse, don't add any `.navbar-expand` class. + +### Toggler + +Navbar togglers are left-aligned by default, but should they follow a sibling element like a `.navbar-brand`, they'll automatically be aligned to the far right. Reversing your markup will reverse the placement of the toggler. Below are examples of different toggle styles. + +With no `.navbar-brand` shown in lowest breakpoint: + +{% capture example %} +<nav class="navbar navbar-expand-lg navbar-light bg-light"> + <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo01" aria-controls="navbarTogglerDemo01" aria-expanded="false" aria-label="Toggle navigation"> + <span class="navbar-toggler-icon"></span> + </button> + <div class="collapse navbar-collapse" id="navbarTogglerDemo01"> + <a class="navbar-brand" href="#">Hidden brand</a> + <ul class="navbar-nav mr-auto mt-2 mt-lg-0"> + <li class="nav-item active"> + <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Link</a> + </li> + <li class="nav-item"> + <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> + </li> + </ul> + <form class="form-inline my-2 my-lg-0"> + <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search"> + <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button> + </form> + </div> +</nav> +{% endcapture %} +{% include example.html content=example %} + +With a brand name shown on the left and toggler on the right: + +{% capture example %} +<nav class="navbar navbar-expand-lg navbar-light bg-light"> + <a class="navbar-brand" href="#">Navbar</a> + <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo02" aria-controls="navbarTogglerDemo02" aria-expanded="false" aria-label="Toggle navigation"> + <span class="navbar-toggler-icon"></span> + </button> + + <div class="collapse navbar-collapse" id="navbarTogglerDemo02"> + <ul class="navbar-nav mr-auto mt-2 mt-lg-0"> + <li class="nav-item active"> + <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Link</a> + </li> + <li class="nav-item"> + <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> + </li> + </ul> + <form class="form-inline my-2 my-lg-0"> + <input class="form-control mr-sm-2" type="search" placeholder="Search"> + <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button> + </form> + </div> +</nav> +{% endcapture %} +{% include example.html content=example %} + +With a toggler on the left and brand name on the right: + +{% capture example %} +<nav class="navbar navbar-expand-lg navbar-light bg-light"> + <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo03" aria-controls="navbarTogglerDemo03" aria-expanded="false" aria-label="Toggle navigation"> + <span class="navbar-toggler-icon"></span> + </button> + <a class="navbar-brand" href="#">Navbar</a> + + <div class="collapse navbar-collapse" id="navbarTogglerDemo03"> + <ul class="navbar-nav mr-auto mt-2 mt-lg-0"> + <li class="nav-item active"> + <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Link</a> + </li> + <li class="nav-item"> + <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> + </li> + </ul> + <form class="form-inline my-2 my-lg-0"> + <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search"> + <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button> + </form> + </div> +</nav> +{% endcapture %} +{% include example.html content=example %} + +### External content + +Sometimes you want to use the collapse plugin to trigger hidden content elsewhere on the page. Because our plugin works on the `id` and `data-target` matching, that's easily done! + +{% capture example %} +<div class="fixed-top"> + <div class="collapse" id="navbarToggleExternalContent"> + <div class="bg-dark p-4"> + <h5 class="text-white h4">Collapsed content</h5> + <span class="text-muted">Toggleable via the navbar brand.</span> + </div> + </div> + <nav class="navbar navbar-dark bg-dark"> + <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggleExternalContent" aria-controls="navbarToggleExternalContent" aria-expanded="false" aria-label="Toggle navigation"> + <span class="navbar-toggler-icon"></span> + </button> + </nav> +</div> +{% endcapture %} +{% include example.html content=example %} diff --git a/vendor/twbs/bootstrap/site/docs/4.5/components/navs.md b/vendor/twbs/bootstrap/site/docs/4.5/components/navs.md new file mode 100644 index 000000000..4bcf2e320 --- /dev/null +++ b/vendor/twbs/bootstrap/site/docs/4.5/components/navs.md @@ -0,0 +1,666 @@ +--- +layout: docs +title: Navs +description: Documentation and examples for how to use Bootstrap's included navigation components. +group: components +toc: true +--- + +## Base nav + +Navigation available in Bootstrap share general markup and styles, from the base `.nav` class to the active and disabled states. Swap modifier classes to switch between each style. + +The base `.nav` component is built with flexbox and provide a strong foundation for building all types of navigation components. It includes some style overrides (for working with lists), some link padding for larger hit areas, and basic disabled styling. + +{% capture callout %} +The base `.nav` component does not include any `.active` state. The following examples include the class, mainly to demonstrate that this particular class does not trigger any special styling. +{% endcapture %} +{% include callout.html content=callout type="info" %} + +{% capture example %} +<ul class="nav"> + <li class="nav-item"> + <a class="nav-link active" href="#">Active</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Link</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Link</a> + </li> + <li class="nav-item"> + <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> + </li> +</ul> +{% endcapture %} +{% include example.html content=example %} + +Classes are used throughout, so your markup can be super flexible. Use `<ul>`s like above, `<ol>` if the order of your items is important, or roll your own with a `<nav>` element. Because the `.nav` uses `display: flex`, the nav links behave the same as nav items would, but without the extra markup. + +{% capture example %} +<nav class="nav"> + <a class="nav-link active" href="#">Active</a> + <a class="nav-link" href="#">Link</a> + <a class="nav-link" href="#">Link</a> + <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> +</nav> +{% endcapture %} +{% include example.html content=example %} + +## Available styles + +Change the style of `.nav`s component with modifiers and utilities. Mix and match as needed, or build your own. + +### Horizontal alignment + +Change the horizontal alignment of your nav with [flexbox utilities]({{ site.baseurl }}/docs/{{ site.docs_version }}/layout/grid/#horizontal-alignment). By default, navs are left-aligned, but you can easily change them to center or right aligned. + +Centered with `.justify-content-center`: + +{% capture example %} +<ul class="nav justify-content-center"> + <li class="nav-item"> + <a class="nav-link active" href="#">Active</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Link</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Link</a> + </li> + <li class="nav-item"> + <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> + </li> +</ul> +{% endcapture %} +{% include example.html content=example %} + +Right-aligned with `.justify-content-end`: + +{% capture example %} +<ul class="nav justify-content-end"> + <li class="nav-item"> + <a class="nav-link active" href="#">Active</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Link</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Link</a> + </li> + <li class="nav-item"> + <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> + </li> +</ul> +{% endcapture %} +{% include example.html content=example %} + +### Vertical + +Stack your navigation by changing the flex item direction with the `.flex-column` utility. Need to stack them on some viewports but not others? Use the responsive versions (e.g., `.flex-sm-column`). + +{% capture example %} +<ul class="nav flex-column"> + <li class="nav-item"> + <a class="nav-link active" href="#">Active</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Link</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Link</a> + </li> + <li class="nav-item"> + <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> + </li> +</ul> +{% endcapture %} +{% include example.html content=example %} + +As always, vertical navigation is possible without `<ul>`s, too. + +{% capture example %} +<nav class="nav flex-column"> + <a class="nav-link active" href="#">Active</a> + <a class="nav-link" href="#">Link</a> + <a class="nav-link" href="#">Link</a> + <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> +</nav> +{% endcapture %} +{% include example.html content=example %} + +### Tabs + +Takes the basic nav from above and adds the `.nav-tabs` class to generate a tabbed interface. Use them to create tabbable regions with our [tab JavaScript plugin](#javascript-behavior). + +{% capture example %} +<ul class="nav nav-tabs"> + <li class="nav-item"> + <a class="nav-link active" href="#">Active</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Link</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Link</a> + </li> + <li class="nav-item"> + <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> + </li> +</ul> +{% endcapture %} +{% include example.html content=example %} + +### Pills + +Take that same HTML, but use `.nav-pills` instead: + +{% capture example %} +<ul class="nav nav-pills"> + <li class="nav-item"> + <a class="nav-link active" href="#">Active</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Link</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Link</a> + </li> + <li class="nav-item"> + <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> + </li> +</ul> +{% endcapture %} +{% include example.html content=example %} + +### Fill and justify + +Force your `.nav`'s contents to extend the full available width one of two modifier classes. To proportionately fill all available space with your `.nav-item`s, use `.nav-fill`. Notice that all horizontal space is occupied, but not every nav item has the same width. + +{% capture example %} +<ul class="nav nav-pills nav-fill"> + <li class="nav-item"> + <a class="nav-link active" href="#">Active</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Much longer nav link</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Link</a> + </li> + <li class="nav-item"> + <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> + </li> +</ul> +{% endcapture %} +{% include example.html content=example %} + +When using a `<nav>`-based navigation, you can safely omit `.nav-item` as only `.nav-link` is required for styling `<a>` elements. + +{% capture example %} +<nav class="nav nav-pills nav-fill"> + <a class="nav-link active" href="#">Active</a> + <a class="nav-link" href="#">Much longer nav link</a> + <a class="nav-link" href="#">Link</a> + <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> +</nav> +{% endcapture %} +{% include example.html content=example %} + +For equal-width elements, use `.nav-justified`. All horizontal space will be occupied by nav links, but unlike the `.nav-fill` above, every nav item will be the same width. + +{% capture example %} +<ul class="nav nav-pills nav-justified"> + <li class="nav-item"> + <a class="nav-link active" href="#">Active</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Much longer nav link</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Link</a> + </li> + <li class="nav-item"> + <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> + </li> +</ul> +{% endcapture %} +{% include example.html content=example %} + +Similar to the `.nav-fill` example using a `<nav>`-based navigation. + +{% capture example %} +<nav class="nav nav-pills nav-justified"> + <a class="nav-link active" href="#">Active</a> + <a class="nav-link" href="#">Much longer nav link</a> + <a class="nav-link" href="#">Link</a> + <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> +</nav> + +{% endcapture %} +{% include example.html content=example %} +## Working with flex utilities + +If you need responsive nav variations, consider using a series of [flexbox utilities]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/flex/). While more verbose, these utilities offer greater customization across responsive breakpoints. In the example below, our nav will be stacked on the lowest breakpoint, then adapt to a horizontal layout that fills the available width starting from the small breakpoint. + +{% capture example %} +<nav class="nav nav-pills flex-column flex-sm-row"> + <a class="flex-sm-fill text-sm-center nav-link active" href="#">Active</a> + <a class="flex-sm-fill text-sm-center nav-link" href="#">Longer nav link</a> + <a class="flex-sm-fill text-sm-center nav-link" href="#">Link</a> + <a class="flex-sm-fill text-sm-center nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> +</nav> +{% endcapture %} +{% include example.html content=example %} + +## Regarding accessibility + +If you're using navs to provide a navigation bar, be sure to add a `role="navigation"` to the most logical parent container of the `<ul>`, or wrap a `<nav>` element around the whole navigation. Do not add the role to the `<ul>` itself, as this would prevent it from being announced as an actual list by assistive technologies. + +Note that navigation bars, even if visually styled as tabs with the `.nav-tabs` class, should **not** be given `role="tablist"`, `role="tab"` or `role="tabpanel"` attributes. These are only appropriate for dynamic tabbed interfaces, as described in the [<abbr title="Web Accessibility Initiative">WAI</abbr> <abbr title="Accessible Rich Internet Applications">ARIA</abbr> Authoring Practices](https://www.w3.org/TR/wai-aria-practices/#tabpanel). See [JavaScript behavior](#javascript-behavior) for dynamic tabbed interfaces in this section for an example. + +## Using dropdowns + +Add dropdown menus with a little extra HTML and the [dropdowns JavaScript plugin]({{ site.baseurl }}/docs/{{ site.docs_version }}/components/dropdowns/#usage). + +### Tabs with dropdowns + +{% capture example %} +<ul class="nav nav-tabs"> + <li class="nav-item"> + <a class="nav-link active" href="#">Active</a> + </li> + <li class="nav-item dropdown"> + <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Dropdown</a> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Link</a> + </li> + <li class="nav-item"> + <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> + </li> +</ul> +{% endcapture %} +{% include example.html content=example %} + +### Pills with dropdowns + +{% capture example %} +<ul class="nav nav-pills"> + <li class="nav-item"> + <a class="nav-link active" href="#">Active</a> + </li> + <li class="nav-item dropdown"> + <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Dropdown</a> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#">Action</a> + <a class="dropdown-item" href="#">Another action</a> + <a class="dropdown-item" href="#">Something else here</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="#">Separated link</a> + </div> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Link</a> + </li> + <li class="nav-item"> + <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> + </li> +</ul> +{% endcapture %} +{% include example.html content=example %} + +## JavaScript behavior + +Use the tab JavaScript plugin—include it individually or through the compiled `bootstrap.js` file—to extend our navigational tabs and pills to create tabbable panes of local content, even via dropdown menus. + +If you're building our JavaScript from source, it [requires `util.js`]({{ site.baseurl }}/docs/{{ site.docs_version }}/getting-started/javascript/#util). + +Dynamic tabbed interfaces, as described in the [<abbr title="Web Accessibility Initiative">WAI</abbr> <abbr title="Accessible Rich Internet Applications">ARIA</abbr> Authoring Practices](https://www.w3.org/TR/wai-aria-practices/#tabpanel), require `role="tablist"`, `role="tab"`, `role="tabpanel"`, and additional `aria-` attributes in order to convey their structure, functionality and current state to users of assistive technologies (such as screen readers). + +Note that dynamic tabbed interfaces should <em>not</em> contain dropdown menus, as this causes both usability and accessibility issues. From a usability perspective, the fact that the currently displayed tab's trigger element is not immediately visible (as it's inside the closed dropdown menu) can cause confusion. From an accessibility point of view, there is currently no sensible way to map this sort of construct to a standard WAI ARIA pattern, meaning that it cannot be easily made understandable to users of assistive technologies. + +<div class="bd-example bd-example-tabs"> + <ul class="nav nav-tabs" id="myTab" role="tablist"> + <li class="nav-item" role="presentation"> + <a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true">Home</a> + </li> + <li class="nav-item" role="presentation"> + <a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab" aria-controls="profile" aria-selected="false">Profile</a> + </li> + <li class="nav-item" role="presentation"> + <a class="nav-link" id="contact-tab" data-toggle="tab" href="#contact" role="tab" aria-controls="contact" aria-selected="false">Contact</a> + </li> + </ul> + <div class="tab-content" id="myTabContent"> + <div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab"> + <p>Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.</p> + </div> + <div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab"> + <p>Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.</p> + </div> + <div class="tab-pane fade" id="contact" role="tabpanel" aria-labelledby="contact-tab"> + <p>Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney's organic lomo retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR banksy irony. Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred you probably haven't heard of them, vinyl craft beer blog stumptown. Pitchfork sustainable tofu synth chambray yr.</p> + </div> + </div> +</div> + +{% highlight html %} +<ul class="nav nav-tabs" id="myTab" role="tablist"> + <li class="nav-item" role="presentation"> + <a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true">Home</a> + </li> + <li class="nav-item" role="presentation"> + <a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab" aria-controls="profile" aria-selected="false">Profile</a> + </li> + <li class="nav-item" role="presentation"> + <a class="nav-link" id="contact-tab" data-toggle="tab" href="#contact" role="tab" aria-controls="contact" aria-selected="false">Contact</a> + </li> +</ul> +<div class="tab-content" id="myTabContent"> + <div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">...</div> + <div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">...</div> + <div class="tab-pane fade" id="contact" role="tabpanel" aria-labelledby="contact-tab">...</div> +</div> +{% endhighlight %} + +To help fit your needs, this works with `<ul>`-based markup, as shown above, or with any arbitrary "roll your own" markup. Note that if you're using `<nav>`, you shouldn't add `role="tablist"` directly to it, as this would override the element's native role as a navigation landmark. Instead, switch to an alternative element (in the example below, a simple `<div>`) and wrap the `<nav>` around it. + +<div class="bd-example bd-example-tabs"> + <nav> + <div class="nav nav-tabs" id="nav-tab" role="tablist"> + <a class="nav-link active" id="nav-home-tab" data-toggle="tab" href="#nav-home" role="tab" aria-controls="nav-home" aria-selected="true">Home</a> + <a class="nav-link" id="nav-profile-tab" data-toggle="tab" href="#nav-profile" role="tab" aria-controls="nav-profile" aria-selected="false">Profile</a> + <a class="nav-link" id="nav-contact-tab" data-toggle="tab" href="#nav-contact" role="tab" aria-controls="nav-contact" aria-selected="false">Contact</a> + </div> + </nav> + <div class="tab-content" id="nav-tabContent"> + <div class="tab-pane fade show active" id="nav-home" role="tabpanel" aria-labelledby="nav-home-tab"> + <p>Et et consectetur ipsum labore excepteur est proident excepteur ad velit occaecat qui minim occaecat veniam. Fugiat veniam incididunt anim aliqua enim pariatur veniam sunt est aute sit dolor anim. Velit non irure adipisicing aliqua ullamco irure incididunt irure non esse consectetur nostrud minim non minim occaecat. Amet duis do nisi duis veniam non est eiusmod tempor incididunt tempor dolor ipsum in qui sit. Exercitation mollit sit culpa nisi culpa non adipisicing reprehenderit do dolore. Duis reprehenderit occaecat anim ullamco ad duis occaecat ex.</p> + </div> + <div class="tab-pane fade" id="nav-profile" role="tabpanel" aria-labelledby="nav-profile-tab"> + <p>Nulla est ullamco ut irure incididunt nulla Lorem Lorem minim irure officia enim reprehenderit. Magna duis labore cillum sint adipisicing exercitation ipsum. Nostrud ut anim non exercitation velit laboris fugiat cupidatat. Commodo esse dolore fugiat sint velit ullamco magna consequat voluptate minim amet aliquip ipsum aute laboris nisi. Labore labore veniam irure irure ipsum pariatur mollit magna in cupidatat dolore magna irure esse tempor ad mollit. Dolore commodo nulla minim amet ipsum officia consectetur amet ullamco voluptate nisi commodo ea sit eu.</p> + </div> + <div class="tab-pane fade" id="nav-contact" role="tabpanel" aria-labelledby="nav-contact-tab"> + <p>Sint sit mollit irure quis est nostrud cillum consequat Lorem esse do quis dolor esse fugiat sunt do. Eu ex commodo veniam Lorem aliquip laborum occaecat qui Lorem esse mollit dolore anim cupidatat. Deserunt officia id Lorem nostrud aute id commodo elit eiusmod enim irure amet eiusmod qui reprehenderit nostrud tempor. Fugiat ipsum excepteur in aliqua non et quis aliquip ad irure in labore cillum elit enim. Consequat aliquip incididunt ipsum et minim laborum laborum laborum et cillum labore. Deserunt adipisicing cillum id nulla minim nostrud labore eiusmod et amet. Laboris consequat consequat commodo non ut non aliquip reprehenderit nulla anim occaecat. Sunt sit ullamco reprehenderit irure ea ullamco Lorem aute nostrud magna.</p> + </div> + </div> +</div> + +{% highlight html %} +<nav> + <div class="nav nav-tabs" id="nav-tab" role="tablist"> + <a class="nav-link active" id="nav-home-tab" data-toggle="tab" href="#nav-home" role="tab" aria-controls="nav-home" aria-selected="true">Home</a> + <a class="nav-link" id="nav-profile-tab" data-toggle="tab" href="#nav-profile" role="tab" aria-controls="nav-profile" aria-selected="false">Profile</a> + <a class="nav-link" id="nav-contact-tab" data-toggle="tab" href="#nav-contact" role="tab" aria-controls="nav-contact" aria-selected="false">Contact</a> + </div> +</nav> +<div class="tab-content" id="nav-tabContent"> + <div class="tab-pane fade show active" id="nav-home" role="tabpanel" aria-labelledby="nav-home-tab">...</div> + <div class="tab-pane fade" id="nav-profile" role="tabpanel" aria-labelledby="nav-profile-tab">...</div> + <div class="tab-pane fade" id="nav-contact" role="tabpanel" aria-labelledby="nav-contact-tab">...</div> +</div> +{% endhighlight %} + +The tabs plugin also works with pills. + +<div class="bd-example bd-example-tabs"> + <ul class="nav nav-pills mb-3" id="pills-tab" role="tablist"> + <li class="nav-item" role="presentation"> + <a class="nav-link active" id="pills-home-tab" data-toggle="pill" href="#pills-home" role="tab" aria-controls="pills-home" aria-selected="true">Home</a> + </li> + <li class="nav-item" role="presentation"> + <a class="nav-link" id="pills-profile-tab" data-toggle="pill" href="#pills-profile" role="tab" aria-controls="pills-profile" aria-selected="false">Profile</a> + </li> + <li class="nav-item" role="presentation"> + <a class="nav-link" id="pills-contact-tab" data-toggle="pill" href="#pills-contact" role="tab" aria-controls="pills-contact" aria-selected="false">Contact</a> + </li> + </ul> + <div class="tab-content" id="pills-tabContent"> + <div class="tab-pane fade show active" id="pills-home" role="tabpanel" aria-labelledby="pills-home-tab"> + <p>Consequat occaecat ullamco amet non eiusmod nostrud dolore irure incididunt est duis anim sunt officia. Fugiat velit proident aliquip nisi incididunt nostrud exercitation proident est nisi. Irure magna elit commodo anim ex veniam culpa eiusmod id nostrud sit cupidatat in veniam ad. Eiusmod consequat eu adipisicing minim anim aliquip cupidatat culpa excepteur quis. Occaecat sit eu exercitation irure Lorem incididunt nostrud.</p> + </div> + <div class="tab-pane fade" id="pills-profile" role="tabpanel" aria-labelledby="pills-profile-tab"> + <p>Ad pariatur nostrud pariatur exercitation ipsum ipsum culpa mollit commodo mollit ex. Aute sunt incididunt amet commodo est sint nisi deserunt pariatur do. Aliquip ex eiusmod voluptate exercitation cillum id incididunt elit sunt. Qui minim sit magna Lorem id et dolore velit Lorem amet exercitation duis deserunt. Anim id labore elit adipisicing ut in id occaecat pariatur ut ullamco ea tempor duis.</p> + </div> + <div class="tab-pane fade" id="pills-contact" role="tabpanel" aria-labelledby="pills-contact-tab"> + <p>Est quis nulla laborum officia ad nisi ex nostrud culpa Lorem excepteur aliquip dolor aliqua irure ex. Nulla ut duis ipsum nisi elit fugiat commodo sunt reprehenderit laborum veniam eu veniam. Eiusmod minim exercitation fugiat irure ex labore incididunt do fugiat commodo aliquip sit id deserunt reprehenderit aliquip nostrud. Amet ex cupidatat excepteur aute veniam incididunt mollit cupidatat esse irure officia elit do ipsum ullamco Lorem. Ullamco ut ad minim do mollit labore ipsum laboris ipsum commodo sunt tempor enim incididunt. Commodo quis sunt dolore aliquip aute tempor irure magna enim minim reprehenderit. Ullamco consectetur culpa veniam sint cillum aliqua incididunt velit ullamco sunt ullamco quis quis commodo voluptate. Mollit nulla nostrud adipisicing aliqua cupidatat aliqua pariatur mollit voluptate voluptate consequat non.</p> + </div> + </div> +</div> + +{% highlight html %} +<ul class="nav nav-pills mb-3" id="pills-tab" role="tablist"> + <li class="nav-item" role="presentation"> + <a class="nav-link active" id="pills-home-tab" data-toggle="pill" href="#pills-home" role="tab" aria-controls="pills-home" aria-selected="true">Home</a> + </li> + <li class="nav-item" role="presentation"> + <a class="nav-link" id="pills-profile-tab" data-toggle="pill" href="#pills-profile" role="tab" aria-controls="pills-profile" aria-selected="false">Profile</a> + </li> + <li class="nav-item" role="presentation"> + <a class="nav-link" id="pills-contact-tab" data-toggle="pill" href="#pills-contact" role="tab" aria-controls="pills-contact" aria-selected="false">Contact</a> + </li> +</ul> +<div class="tab-content" id="pills-tabContent"> + <div class="tab-pane fade show active" id="pills-home" role="tabpanel" aria-labelledby="pills-home-tab">...</div> + <div class="tab-pane fade" id="pills-profile" role="tabpanel" aria-labelledby="pills-profile-tab">...</div> + <div class="tab-pane fade" id="pills-contact" role="tabpanel" aria-labelledby="pills-contact-tab">...</div> +</div> +{% endhighlight %} + +And with vertical pills. + +<div class="bd-example bd-example-tabs"> + <div class="row"> + <div class="col-3"> + <div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical"> + <a class="nav-link active" id="v-pills-home-tab" data-toggle="pill" href="#v-pills-home" role="tab" aria-controls="v-pills-home" aria-selected="true">Home</a> + <a class="nav-link" id="v-pills-profile-tab" data-toggle="pill" href="#v-pills-profile" role="tab" aria-controls="v-pills-profile" aria-selected="false">Profile</a> + <a class="nav-link" id="v-pills-messages-tab" data-toggle="pill" href="#v-pills-messages" role="tab" aria-controls="v-pills-messages" aria-selected="false">Messages</a> + <a class="nav-link" id="v-pills-settings-tab" data-toggle="pill" href="#v-pills-settings" role="tab" aria-controls="v-pills-settings" aria-selected="false">Settings</a> + </div> + </div> + <div class="col-9"> + <div class="tab-content" id="v-pills-tabContent"> + <div class="tab-pane fade show active" id="v-pills-home" role="tabpanel" aria-labelledby="v-pills-home-tab"> + <p>Cillum ad ut irure tempor velit nostrud occaecat ullamco aliqua anim Lorem sint. Veniam sint duis incididunt do esse magna mollit excepteur laborum qui. Id id reprehenderit sit est eu aliqua occaecat quis et velit excepteur laborum mollit dolore eiusmod. Ipsum dolor in occaecat commodo et voluptate minim reprehenderit mollit pariatur. Deserunt non laborum enim et cillum eu deserunt excepteur ea incididunt minim occaecat.</p> + </div> + <div class="tab-pane fade" id="v-pills-profile" role="tabpanel" aria-labelledby="v-pills-profile-tab"> + <p>Culpa dolor voluptate do laboris laboris irure reprehenderit id incididunt duis pariatur mollit aute magna pariatur consectetur. Eu veniam duis non ut dolor deserunt commodo et minim in quis laboris ipsum velit id veniam. Quis ut consectetur adipisicing officia excepteur non sit. Ut et elit aliquip labore Lorem enim eu. Ullamco mollit occaecat dolore ipsum id officia mollit qui esse anim eiusmod do sint minim consectetur qui.</p> + </div> + <div class="tab-pane fade" id="v-pills-messages" role="tabpanel" aria-labelledby="v-pills-messages-tab"> + <p>Fugiat id quis dolor culpa eiusmod anim velit excepteur proident dolor aute qui magna. Ad proident laboris ullamco esse anim Lorem Lorem veniam quis Lorem irure occaecat velit nostrud magna nulla. Velit et et proident Lorem do ea tempor officia dolor. Reprehenderit Lorem aliquip labore est magna commodo est ea veniam consectetur.</p> + </div> + <div class="tab-pane fade" id="v-pills-settings" role="tabpanel" aria-labelledby="v-pills-settings-tab"> + <p>Eu dolore ea ullamco dolore Lorem id cupidatat excepteur reprehenderit consectetur elit id dolor proident in cupidatat officia. Voluptate excepteur commodo labore nisi cillum duis aliqua do. Aliqua amet qui mollit consectetur nulla mollit velit aliqua veniam nisi id do Lorem deserunt amet. Culpa ullamco sit adipisicing labore officia magna elit nisi in aute tempor commodo eiusmod.</p> + </div> + </div> + </div> + </div> +</div> + +{% highlight html %} +<div class="row"> + <div class="col-3"> + <div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical"> + <a class="nav-link active" id="v-pills-home-tab" data-toggle="pill" href="#v-pills-home" role="tab" aria-controls="v-pills-home" aria-selected="true">Home</a> + <a class="nav-link" id="v-pills-profile-tab" data-toggle="pill" href="#v-pills-profile" role="tab" aria-controls="v-pills-profile" aria-selected="false">Profile</a> + <a class="nav-link" id="v-pills-messages-tab" data-toggle="pill" href="#v-pills-messages" role="tab" aria-controls="v-pills-messages" aria-selected="false">Messages</a> + <a class="nav-link" id="v-pills-settings-tab" data-toggle="pill" href="#v-pills-settings" role="tab" aria-controls="v-pills-settings" aria-selected="false">Settings</a> + </div> + </div> + <div class="col-9"> + <div class="tab-content" id="v-pills-tabContent"> + <div class="tab-pane fade show active" id="v-pills-home" role="tabpanel" aria-labelledby="v-pills-home-tab">...</div> + <div class="tab-pane fade" id="v-pills-profile" role="tabpanel" aria-labelledby="v-pills-profile-tab">...</div> + <div class="tab-pane fade" id="v-pills-messages" role="tabpanel" aria-labelledby="v-pills-messages-tab">...</div> + <div class="tab-pane fade" id="v-pills-settings" role="tabpanel" aria-labelledby="v-pills-settings-tab">...</div> + </div> + </div> +</div> +{% endhighlight %} + +### Using data attributes + +You can activate a tab or pill navigation without writing any JavaScript by simply specifying `data-toggle="tab"` or `data-toggle="pill"` on an element. Use these data attributes on `.nav-tabs` or `.nav-pills`. + +{% highlight html %} +<!-- Nav tabs --> +<ul class="nav nav-tabs" id="myTab" role="tablist"> + <li class="nav-item" role="presentation"> + <a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true">Home</a> + </li> + <li class="nav-item" role="presentation"> + <a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab" aria-controls="profile" aria-selected="false">Profile</a> + </li> + <li class="nav-item" role="presentation"> + <a class="nav-link" id="messages-tab" data-toggle="tab" href="#messages" role="tab" aria-controls="messages" aria-selected="false">Messages</a> + </li> + <li class="nav-item" role="presentation"> + <a class="nav-link" id="settings-tab" data-toggle="tab" href="#settings" role="tab" aria-controls="settings" aria-selected="false">Settings</a> + </li> +</ul> + +<!-- Tab panes --> +<div class="tab-content"> + <div class="tab-pane active" id="home" role="tabpanel" aria-labelledby="home-tab">...</div> + <div class="tab-pane" id="profile" role="tabpanel" aria-labelledby="profile-tab">...</div> + <div class="tab-pane" id="messages" role="tabpanel" aria-labelledby="messages-tab">...</div> + <div class="tab-pane" id="settings" role="tabpanel" aria-labelledby="settings-tab">...</div> +</div> +{% endhighlight %} + +### Via JavaScript + +Enable tabbable tabs via JavaScript (each tab needs to be activated individually): + +{% highlight js %} +$('#myTab a').on('click', function (e) { + e.preventDefault() + $(this).tab('show') +}) +{% endhighlight %} + +You can activate individual tabs in several ways: + +{% highlight js %} +$('#myTab a[href="#profile"]').tab('show') // Select tab by name +$('#myTab li:first-child a').tab('show') // Select first tab +$('#myTab li:last-child a').tab('show') // Select last tab +$('#myTab li:nth-child(3) a').tab('show') // Select third tab +{% endhighlight %} + +### Fade effect + +To make tabs fade in, add `.fade` to each `.tab-pane`. The first tab pane must also have `.show` to make the initial content visible. + +{% highlight html %} +<div class="tab-content"> + <div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">...</div> + <div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">...</div> + <div class="tab-pane fade" id="messages" role="tabpanel" aria-labelledby="messages-tab">...</div> + <div class="tab-pane fade" id="settings" role="tabpanel" aria-labelledby="settings-tab">...</div> +</div> +{% endhighlight %} + +### Methods + +{% include callout-danger-async-methods.md %} + +#### $().tab + +Activates a tab element and content container. Tab should have either a `data-target` or an `href` targeting a container node in the DOM. + +{% highlight html %} +<ul class="nav nav-tabs" id="myTab" role="tablist"> + <li class="nav-item" role="presentation"> + <a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true">Home</a> + </li> + <li class="nav-item" role="presentation"> + <a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab" aria-controls="profile" aria-selected="false">Profile</a> + </li> + <li class="nav-item" role="presentation"> + <a class="nav-link" id="messages-tab" data-toggle="tab" href="#messages" role="tab" aria-controls="messages" aria-selected="false">Messages</a> + </li> + <li class="nav-item" role="presentation"> + <a class="nav-link" id="settings-tab" data-toggle="tab" href="#settings" role="tab" aria-controls="settings" aria-selected="false">Settings</a> + </li> +</ul> + +<div class="tab-content"> + <div class="tab-pane active" id="home" role="tabpanel" aria-labelledby="home-tab">...</div> + <div class="tab-pane" id="profile" role="tabpanel" aria-labelledby="profile-tab">...</div> + <div class="tab-pane" id="messages" role="tabpanel" aria-labelledby="messages-tab">...</div> + <div class="tab-pane" id="settings" role="tabpanel" aria-labelledby="settings-tab">...</div> +</div> + +<script> + $(function () { + $('#myTab li:last-child a').tab('show') + }) +</script> +{% endhighlight %} + +#### .tab('show') + +Selects the given tab and shows its associated pane. Any other tab that was previously selected becomes unselected and its associated pane is hidden. **Returns to the caller before the tab pane has actually been shown** (i.e. before the `shown.bs.tab` event occurs). + +{% highlight js %} +$('#someTab').tab('show') +{% endhighlight %} + +#### .tab('dispose') + +Destroys an element's tab. + +### Events + +When showing a new tab, the events fire in the following order: + +1. `hide.bs.tab` (on the current active tab) +2. `show.bs.tab` (on the to-be-shown tab) +3. `hidden.bs.tab` (on the previous active tab, the same one as for the `hide.bs.tab` event) +4. `shown.bs.tab` (on the newly-active just-shown tab, the same one as for the `show.bs.tab` event) + +If no tab was already active, then the `hide.bs.tab` and `hidden.bs.tab` events will not be fired. + +<table class="table table-bordered table-striped"> + <thead> + <tr> + <th style="width: 150px;">Event Type</th> + <th>Description</th> + </tr> + </thead> + <tbody> + <tr> + <td>show.bs.tab</td> + <td>This event fires on tab show, but before the new tab has been shown. Use <code>event.target</code> and <code>event.relatedTarget</code> to target the active tab and the previous active tab (if available) respectively.</td> + </tr> + <tr> + <td>shown.bs.tab</td> + <td>This event fires on tab show after a tab has been shown. Use <code>event.target</code> and <code>event.relatedTarget</code> to target the active tab and the previous active tab (if available) respectively.</td> + </tr> + <tr> + <td>hide.bs.tab</td> + <td>This event fires when a new tab is to be shown (and thus the previous active tab is to be hidden). Use <code>event.target</code> and <code>event.relatedTarget</code> to target the current active tab and the new soon-to-be-active tab, respectively.</td> + </tr> + <tr> + <td>hidden.bs.tab</td> + <td>This event fires after a new tab is shown (and thus the previous active tab is hidden). Use <code>event.target</code> and <code>event.relatedTarget</code> to target the previous active tab and the new active tab, respectively.</td> + </tr> + </tbody> +</table> + +{% highlight js %} +$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { + e.target // newly activated tab + e.relatedTarget // previous active tab +}) +{% endhighlight %} diff --git a/vendor/twbs/bootstrap/site/docs/4.5/components/pagination.md b/vendor/twbs/bootstrap/site/docs/4.5/components/pagination.md new file mode 100644 index 000000000..b1f8e58a2 --- /dev/null +++ b/vendor/twbs/bootstrap/site/docs/4.5/components/pagination.md @@ -0,0 +1,174 @@ +--- +layout: docs +title: Pagination +description: Documentation and examples for showing pagination to indicate a series of related content exists across multiple pages. +group: components +toc: true +--- + +## Overview + +We use a large block of connected links for our pagination, making links hard to miss and easily scalable—all while providing large hit areas. Pagination is built with list HTML elements so screen readers can announce the number of available links. Use a wrapping `<nav>` element to identify it as a navigation section to screen readers and other assistive technologies. + +In addition, as pages likely have more than one such navigation section, it's advisable to provide a descriptive `aria-label` for the `<nav>` to reflect its purpose. For example, if the pagination component is used to navigate between a set of search results, an appropriate label could be `aria-label="Search results pages"`. + +{% capture example %} +<nav aria-label="Page navigation example"> + <ul class="pagination"> + <li class="page-item"><a class="page-link" href="#">Previous</a></li> + <li class="page-item"><a class="page-link" href="#">1</a></li> + <li class="page-item"><a class="page-link" href="#">2</a></li> + <li class="page-item"><a class="page-link" href="#">3</a></li> + <li class="page-item"><a class="page-link" href="#">Next</a></li> + </ul> +</nav> +{% endcapture %} +{% include example.html content=example %} + +## Working with icons + +Looking to use an icon or symbol in place of text for some pagination links? Be sure to provide proper screen reader support with `aria` attributes. + +{% capture example %} +<nav aria-label="Page navigation example"> + <ul class="pagination"> + <li class="page-item"> + <a class="page-link" href="#" aria-label="Previous"> + <span aria-hidden="true">«</span> + </a> + </li> + <li class="page-item"><a class="page-link" href="#">1</a></li> + <li class="page-item"><a class="page-link" href="#">2</a></li> + <li class="page-item"><a class="page-link" href="#">3</a></li> + <li class="page-item"> + <a class="page-link" href="#" aria-label="Next"> + <span aria-hidden="true">»</span> + </a> + </li> + </ul> +</nav> +{% endcapture %} +{% include example.html content=example %} + +## Disabled and active states + +Pagination links are customizable for different circumstances. Use `.disabled` for links that appear un-clickable and `.active` to indicate the current page. + +While the `.disabled` class uses `pointer-events: none` to _try_ to disable the link functionality of `<a>`s, that CSS property is not yet standardized and doesn't account for keyboard navigation. As such, you should always add `tabindex="-1"` on disabled links and use custom JavaScript to fully disable their functionality. + +{% capture example %} +<nav aria-label="..."> + <ul class="pagination"> + <li class="page-item disabled"> + <a class="page-link" href="#" tabindex="-1" aria-disabled="true">Previous</a> + </li> + <li class="page-item"><a class="page-link" href="#">1</a></li> + <li class="page-item active" aria-current="page"> + <a class="page-link" href="#">2 <span class="sr-only">(current)</span></a> + </li> + <li class="page-item"><a class="page-link" href="#">3</a></li> + <li class="page-item"> + <a class="page-link" href="#">Next</a> + </li> + </ul> +</nav> +{% endcapture %} +{% include example.html content=example %} + +You can optionally swap out active or disabled anchors for `<span>`, or omit the anchor in the case of the prev/next arrows, to remove click functionality and prevent keyboard focus while retaining intended styles. + +{% capture example %} +<nav aria-label="..."> + <ul class="pagination"> + <li class="page-item disabled"> + <span class="page-link">Previous</span> + </li> + <li class="page-item"><a class="page-link" href="#">1</a></li> + <li class="page-item active" aria-current="page"> + <span class="page-link"> + 2 + <span class="sr-only">(current)</span> + </span> + </li> + <li class="page-item"><a class="page-link" href="#">3</a></li> + <li class="page-item"> + <a class="page-link" href="#">Next</a> + </li> + </ul> +</nav> +{% endcapture %} +{% include example.html content=example %} + +## Sizing + +Fancy larger or smaller pagination? Add `.pagination-lg` or `.pagination-sm` for additional sizes. + +{% capture example %} +<nav aria-label="..."> + <ul class="pagination pagination-lg"> + <li class="page-item active" aria-current="page"> + <span class="page-link"> + 1 + <span class="sr-only">(current)</span> + </span> + </li> + <li class="page-item"><a class="page-link" href="#">2</a></li> + <li class="page-item"><a class="page-link" href="#">3</a></li> + </ul> +</nav> +{% endcapture %} +{% include example.html content=example %} + +{% capture example %} +<nav aria-label="..."> + <ul class="pagination pagination-sm"> + <li class="page-item active" aria-current="page"> + <span class="page-link"> + 1 + <span class="sr-only">(current)</span> + </span> + </li> + <li class="page-item"><a class="page-link" href="#">2</a></li> + <li class="page-item"><a class="page-link" href="#">3</a></li> + </ul> +</nav> +{% endcapture %} +{% include example.html content=example %} + +## Alignment + +Change the alignment of pagination components with [flexbox utilities]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/flex/). + +{% capture example %} +<nav aria-label="Page navigation example"> + <ul class="pagination justify-content-center"> + <li class="page-item disabled"> + <a class="page-link" href="#" tabindex="-1" aria-disabled="true">Previous</a> + </li> + <li class="page-item"><a class="page-link" href="#">1</a></li> + <li class="page-item"><a class="page-link" href="#">2</a></li> + <li class="page-item"><a class="page-link" href="#">3</a></li> + <li class="page-item"> + <a class="page-link" href="#">Next</a> + </li> + </ul> +</nav> +{% endcapture %} +{% include example.html content=example %} + +{% capture example %} +<nav aria-label="Page navigation example"> + <ul class="pagination justify-content-end"> + <li class="page-item disabled"> + <a class="page-link" href="#" tabindex="-1" aria-disabled="true">Previous</a> + </li> + <li class="page-item"><a class="page-link" href="#">1</a></li> + <li class="page-item"><a class="page-link" href="#">2</a></li> + <li class="page-item"><a class="page-link" href="#">3</a></li> + <li class="page-item"> + <a class="page-link" href="#">Next</a> + </li> + </ul> +</nav> +{% endcapture %} +{% include example.html content=example %} diff --git a/vendor/twbs/bootstrap/site/docs/4.5/components/popovers.md b/vendor/twbs/bootstrap/site/docs/4.5/components/popovers.md new file mode 100644 index 000000000..bdd201b15 --- /dev/null +++ b/vendor/twbs/bootstrap/site/docs/4.5/components/popovers.md @@ -0,0 +1,396 @@ +--- +layout: docs +title: Popovers +description: Documentation and examples for adding Bootstrap popovers, like those found in iOS, to any element on your site. +group: components +toc: true +--- + +## Overview + +Things to know when using the popover plugin: + +- Popovers rely on the 3rd party library [Popper.js](https://popper.js.org/) for positioning. You must include [popper.min.js]({{ site.cdn.popper }}) before bootstrap.js or use `bootstrap.bundle.min.js` / `bootstrap.bundle.js` which contains Popper.js in order for popovers to work! +- Popovers require the [tooltip plugin]({{ site.baseurl }}/docs/{{ site.docs_version }}/components/tooltips/) as a dependency. +- If you're building our JavaScript from source, it [requires `util.js`]({{ site.baseurl }}/docs/{{ site.docs_version }}/getting-started/javascript/#util). +- Popovers are opt-in for performance reasons, so **you must initialize them yourself**. +- Zero-length `title` and `content` values will never show a popover. +- Specify `container: 'body'` to avoid rendering problems in more complex components (like our input groups, button groups, etc). +- Triggering popovers on hidden elements will not work. +- Popovers for `.disabled` or `disabled` elements must be triggered on a wrapper element. +- When triggered from anchors that wrap across multiple lines, popovers will be centered between the anchors' overall width. Use `.text-nowrap` on your `<a>`s to avoid this behavior. +- Popovers must be hidden before their corresponding elements have been removed from the DOM. +- Popovers can be triggered thanks to an element inside a shadow DOM. + +{% include callout-info-prefersreducedmotion.md %} + +Keep reading to see how popovers work with some examples. + +## Example: Enable popovers everywhere + +One way to initialize all popovers on a page would be to select them by their `data-toggle` attribute: + +{% highlight js %} +$(function () { + $('[data-toggle="popover"]').popover() +}) +{% endhighlight %} + +## Example: Using the `container` option + +When you have some styles on a parent element that interfere with a popover, you'll want to specify a custom `container` so that the popover's HTML appears within that element instead. + +{% highlight js %} +$(function () { + $('.example-popover').popover({ + container: 'body' + }) +}) +{% endhighlight %} + +## Example + +{% capture example %} +<button type="button" class="btn btn-lg btn-danger" data-toggle="popover" title="Popover title" data-content="And here's some amazing content. It's very engaging. Right?">Click to toggle popover</button> +{% endcapture %} +{% include example.html content=example %} + +### Four directions + +Four options are available: top, right, bottom, and left aligned. + +<div class="bd-example popover-demo"> + <div class="bd-example-popovers"> + <button type="button" class="btn btn-secondary" data-container="body" data-toggle="popover" data-placement="top" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus."> + Popover on top + </button> + <button type="button" class="btn btn-secondary" data-container="body" data-toggle="popover" data-placement="right" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus."> + Popover on right + </button> + <button type="button" class="btn btn-secondary" data-container="body" data-toggle="popover" data-placement="bottom" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus."> + Popover on bottom + </button> + <button type="button" class="btn btn-secondary" data-container="body" data-toggle="popover" data-placement="left" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus."> + Popover on left + </button> + </div> +</div> + +{% highlight html %} +<button type="button" class="btn btn-secondary" data-container="body" data-toggle="popover" data-placement="top" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus."> + Popover on top +</button> + +<button type="button" class="btn btn-secondary" data-container="body" data-toggle="popover" data-placement="right" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus."> + Popover on right +</button> + +<button type="button" class="btn btn-secondary" data-container="body" data-toggle="popover" data-placement="bottom" data-content="Vivamus +sagittis lacus vel augue laoreet rutrum faucibus."> + Popover on bottom +</button> + +<button type="button" class="btn btn-secondary" data-container="body" data-toggle="popover" data-placement="left" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus."> + Popover on left +</button> +{% endhighlight %} + +### Dismiss on next click + +Use the `focus` trigger to dismiss popovers on the user's next click of a different element than the toggle element. + +{% capture callout %} +#### Specific markup required for dismiss-on-next-click + +For proper cross-browser and cross-platform behavior, you must use the `<a>` tag, _not_ the `<button>` tag, and you also must include a [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) attribute. +{% endcapture %} +{% include callout.html content=callout type="danger" %} + +{% capture example %} +<a tabindex="0" class="btn btn-lg btn-danger" role="button" data-toggle="popover" data-trigger="focus" title="Dismissible popover" data-content="And here's some amazing content. It's very engaging. Right?">Dismissible popover</a> +{% endcapture %} +{% include example.html content=example %} + +{% highlight js %} +$('.popover-dismiss').popover({ + trigger: 'focus' +}) +{% endhighlight %} + +### Disabled elements + +Elements with the `disabled` attribute aren't interactive, meaning users cannot hover or click them to trigger a popover (or tooltip). As a workaround, you'll want to trigger the popover from a wrapper `<div>` or `<span>` and override the `pointer-events` on the disabled element. + +For disabled popover triggers, you may also prefer `data-trigger="hover"` so that the popover appears as immediate visual feedback to your users as they may not expect to _click_ on a disabled element. + +{% capture example %} +<span class="d-inline-block" data-toggle="popover" data-content="Disabled popover"> + <button class="btn btn-primary" style="pointer-events: none;" type="button" disabled>Disabled button</button> +</span> +{% endcapture %} +{% include example.html content=example %} + +## Usage + +Enable popovers via JavaScript: + +{% highlight js %}$('#example').popover(options){% endhighlight %} + +{% capture callout %} +### Making popovers work for keyboard and assistive technology users + +To allow keyboard users to activate your popovers, you should only add them to HTML elements that are traditionally keyboard-focusable and interactive (such as links or form controls). Although arbitrary HTML elements (such as `<span>`s) can be made focusable by adding the `tabindex="0"` attribute, this will add potentially annoying and confusing tab stops on non-interactive elements for keyboard users, and most assistive technologies currently do not announce the popover's content in this situation. Additionally, do not rely solely on `hover` as the trigger for your popovers, as this will make them impossible to trigger for keyboard users. + +While you can insert rich, structured HTML in popovers with the `html` option, we strongly recommend that you avoid adding an excessive amount of content. The way popovers currently work is that, once displayed, their content is tied to the trigger element with the `aria-describedby` attribute. As a result, the entirety of the popover's content will be announced to assistive technology users as one long, uninterrupted stream. + +Additionally, while it is possible to also include interactive controls (such as form elements or links) in your popover (by adding these elements to the `whiteList` or allowed attributes and tags), be aware that currently the popover does not manage keyboard focus order. When a keyboard user opens a popover, focus remains on the triggering element, and as the popover usually does not immediately follow the trigger in the document's structure, there is no guarantee that moving forward/pressing <kbd>TAB</kbd> will move a keyboard user into the popover itself. In short, simply adding interactive controls to a popover is likely to make these controls unreachable/unusable for keyboard users and users of assistive technologies, or at the very least make for an illogical overall focus order. In these cases, consider using a modal dialog instead. +{% endcapture %} +{% include callout.html content=callout type="warning" %} + +### Options + +Options can be passed via data attributes or JavaScript. For data attributes, append the option name to `data-`, as in `data-animation=""`. + +{% capture callout %} +Note that for security reasons the `sanitize`, `sanitizeFn` and `whiteList` options cannot be supplied using data attributes. +{% endcapture %} +{% include callout.html content=callout type="warning" %} + +<table class="table table-bordered table-striped"> + <thead> + <tr> + <th style="width: 100px;">Name</th> + <th style="width: 100px;">Type</th> + <th style="width: 50px;">Default</th> + <th>Description</th> + </tr> + </thead> + <tbody> + <tr> + <td>animation</td> + <td>boolean</td> + <td>true</td> + <td>Apply a CSS fade transition to the popover</td> + </tr> + <tr> + <td>container</td> + <td>string | element | false</td> + <td>false</td> + <td> + <p>Appends the popover to a specific element. Example: <code>container: 'body'</code>. This option is particularly useful in that it allows you to position the popover in the flow of the document near the triggering element - which will prevent the popover from floating away from the triggering element during a window resize.</p> + </td> + </tr> + <tr> + <td>content</td> + <td>string | element | function</td> + <td>''</td> + <td> + <p>Default content value if <code>data-content</code> attribute isn't present.</p> + <p>If a function is given, it will be called with its <code>this</code> reference set to the element that the popover is attached to.</p> + </td> + </tr> + <tr> + <td>delay</td> + <td>number | object</td> + <td>0</td> + <td> + <p>Delay showing and hiding the popover (ms) - does not apply to manual trigger type</p> + <p>If a number is supplied, delay is applied to both hide/show</p> + <p>Object structure is: <code>delay: { "show": 500, "hide": 100 }</code></p> + </td> + </tr> + <tr> + <td>html</td> + <td>boolean</td> + <td>false</td> + <td>Insert HTML into the popover. If false, jQuery's <code>text</code> method will be used to insert content into the DOM. Use text if you're worried about XSS attacks.</td> + </tr> + <tr> + <td>placement</td> + <td>string | function</td> + <td>'right'</td> + <td> + <p>How to position the popover - auto | top | bottom | left | right.<br>When <code>auto</code> is specified, it will dynamically reorient the popover.</p> + <p>When a function is used to determine the placement, it is called with the popover DOM node as its first argument and the triggering element DOM node as its second. The <code>this</code> context is set to the popover instance.</p> + </td> + </tr> + <tr> + <td>selector</td> + <td>string | false</td> + <td>false</td> + <td>If a selector is provided, popover objects will be delegated to the specified targets. In practice, this is used to enable dynamic HTML content to have popovers added. See <a href="{{ site.repo }}/issues/4215">this</a> and <a href="https://codepen.io/Johann-S/pen/djJYPb">an informative example</a>.</td> + </tr> + <tr> + <td>template</td> + <td>string</td> + <td><code>'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>'</code></td> + <td> + <p>Base HTML to use when creating the popover.</p> + <p>The popover's <code>title</code> will be injected into the <code>.popover-header</code>.</p> + <p>The popover's <code>content</code> will be injected into the <code>.popover-body</code>.</p> + <p><code>.arrow</code> will become the popover's arrow.</p> + <p>The outermost wrapper element should have the <code>.popover</code> class.</p> + </td> + </tr> + <tr> + <td>title</td> + <td>string | element | function</td> + <td>''</td> + <td> + <p>Default title value if <code>title</code> attribute isn't present.</p> + <p>If a function is given, it will be called with its <code>this</code> reference set to the element that the popover is attached to.</p> + </td> + </tr> + <tr> + <td>trigger</td> + <td>string</td> + <td>'click'</td> + <td>How popover is triggered - click | hover | focus | manual. You may pass multiple triggers; separate them with a space. <code>manual</code> cannot be combined with any other trigger.</td> + </tr> + <tr> + <td>offset</td> + <td>number | string</td> + <td>0</td> + <td>Offset of the popover relative to its target. For more information refer to Popper.js's <a href="https://popper.js.org/docs/v1/#modifiers..offset.offset">offset docs</a>.</td> + </tr> + <tr> + <td>fallbackPlacement</td> + <td>string | array</td> + <td>'flip'</td> + <td>Allow to specify which position Popper will use on fallback. For more information refer to + Popper.js's <a href="https://popper.js.org/docs/v1/#modifiers..flip.behavior">behavior docs</a></td> + </tr> + <tr> + <td>boundary</td> + <td>string | element</td> + <td>'scrollParent'</td> + <td>Overflow constraint boundary of the popover. Accepts the values of <code>'viewport'</code>, <code>'window'</code>, <code>'scrollParent'</code>, or an HTMLElement reference (JavaScript only). For more information refer to Popper.js's <a href="https://popper.js.org/docs/v1/#modifiers..preventOverflow.boundariesElement">preventOverflow docs</a>.</td> + </tr> + <tr> + <td>sanitize</td> + <td>boolean</td> + <td>true</td> + <td>Enable or disable the sanitization. If activated <code>'template'</code>, <code>'content'</code> and <code>'title'</code> options will be sanitized.</td> + </tr> + <tr> + <td>whiteList</td> + <td>object</td> + <td><a href="{{ site.baseurl }}/docs/{{ site.docs_version }}/getting-started/javascript/#sanitizer">Default value</a></td> + <td>Object which contains allowed attributes and tags</td> + </tr> + <tr> + <td>sanitizeFn</td> + <td>null | function</td> + <td>null</td> + <td>Here you can supply your own sanitize function. This can be useful if you prefer to use a dedicated library to perform sanitization.</td> + </tr> + <tr> + <td>popperConfig</td> + <td>null | object</td> + <td>null</td> + <td>To change Bootstrap's default Popper.js config, see <a href="https://popper.js.org/docs/v1/#Popper.Defaults">Popper.js's configuration</a></td> + </tr> + </tbody> +</table> + +{% capture callout %} +#### Data attributes for individual popovers + +Options for individual popovers can alternatively be specified through the use of data attributes, as explained above. +{% endcapture %} +{% include callout.html content=callout type="info" %} + +### Methods + +{% include callout-danger-async-methods.md %} + +#### `$().popover(options)` + +Initializes popovers for an element collection. + +#### `.popover('show')` + +Reveals an element's popover. **Returns to the caller before the popover has actually been shown** (i.e. before the `shown.bs.popover` event occurs). This is considered a "manual" triggering of the popover. Popovers whose title and content are both zero-length are never displayed. + +{% highlight js %}$('#element').popover('show'){% endhighlight %} + +#### `.popover('hide')` + +Hides an element's popover. **Returns to the caller before the popover has actually been hidden** (i.e. before the `hidden.bs.popover` event occurs). This is considered a "manual" triggering of the popover. + +{% highlight js %}$('#element').popover('hide'){% endhighlight %} + +#### `.popover('toggle')` + +Toggles an element's popover. **Returns to the caller before the popover has actually been shown or hidden** (i.e. before the `shown.bs.popover` or `hidden.bs.popover` event occurs). This is considered a "manual" triggering of the popover. + +{% highlight js %}$('#element').popover('toggle'){% endhighlight %} + +#### `.popover('dispose')` + +Hides and destroys an element's popover. Popovers that use delegation (which are created using [the `selector` option](#options)) cannot be individually destroyed on descendant trigger elements. + +{% highlight js %}$('#element').popover('dispose'){% endhighlight %} + +#### `.popover('enable')` + +Gives an element's popover the ability to be shown. **Popovers are enabled by default.** + +{% highlight js %}$('#element').popover('enable'){% endhighlight %} + +#### `.popover('disable')` + +Removes the ability for an element's popover to be shown. The popover will only be able to be shown if it is re-enabled. + +{% highlight js %}$('#element').popover('disable'){% endhighlight %} + +#### `.popover('toggleEnabled')` + +Toggles the ability for an element's popover to be shown or hidden. + +{% highlight js %}$('#element').popover('toggleEnabled'){% endhighlight %} + +#### `.popover('update')` + +Updates the position of an element's popover. + +{% highlight js %}$('#element').popover('update'){% endhighlight %} + +### Events + +<table class="table table-bordered table-striped"> + <thead> + <tr> + <th style="width: 150px;">Event Type</th> + <th>Description</th> + </tr> + </thead> + <tbody> + <tr> + <td>show.bs.popover</td> + <td>This event fires immediately when the <code>show</code> instance method is called.</td> + </tr> + <tr> + <td>shown.bs.popover</td> + <td>This event is fired when the popover has been made visible to the user (will wait for CSS transitions to complete).</td> + </tr> + <tr> + <td>hide.bs.popover</td> + <td>This event is fired immediately when the <code>hide</code> instance method has been called.</td> + </tr> + <tr> + <td>hidden.bs.popover</td> + <td>This event is fired when the popover has finished being hidden from the user (will wait for CSS transitions to complete).</td> + </tr> + <tr> + <td>inserted.bs.popover</td> + <td>This event is fired after the <code>show.bs.popover</code> event when the popover template has been added to the DOM.</td> + </tr> + </tbody> +</table> + +{% highlight js %} +$('#myPopover').on('hidden.bs.popover', function () { + // do something... +}) +{% endhighlight %} diff --git a/vendor/twbs/bootstrap/site/docs/4.5/components/progress.md b/vendor/twbs/bootstrap/site/docs/4.5/components/progress.md new file mode 100644 index 000000000..7c42aec3e --- /dev/null +++ b/vendor/twbs/bootstrap/site/docs/4.5/components/progress.md @@ -0,0 +1,146 @@ +--- +layout: docs +title: Progress +description: Documentation and examples for using Bootstrap custom progress bars featuring support for stacked bars, animated backgrounds, and text labels. +group: components +toc: true +--- + +## How it works + +Progress components are built with two HTML elements, some CSS to set the width, and a few attributes. We don't use [the HTML5 `<progress>` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/progress), ensuring you can stack progress bars, animate them, and place text labels over them. + +- We use the `.progress` as a wrapper to indicate the max value of the progress bar. +- We use the inner `.progress-bar` to indicate the progress so far. +- The `.progress-bar` requires an inline style, utility class, or custom CSS to set their width. +- The `.progress-bar` also requires some `role` and `aria` attributes to make it accessible. + +Put that all together, and you have the following examples. + +{% capture example %} +<div class="progress"> + <div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div> +</div> +<div class="progress"> + <div class="progress-bar" role="progressbar" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div> +</div> +<div class="progress"> + <div class="progress-bar" role="progressbar" style="width: 50%" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"></div> +</div> +<div class="progress"> + <div class="progress-bar" role="progressbar" style="width: 75%" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div> +</div> +<div class="progress"> + <div class="progress-bar" role="progressbar" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div> +</div> +{% endcapture %} +{% include example.html content=example %} + +Bootstrap provides a handful of [utilities for setting width]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/sizing/). Depending on your needs, these may help with quickly configuring progress. + +{% capture example %} +<div class="progress"> + <div class="progress-bar w-75" role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Labels + +Add labels to your progress bars by placing text within the `.progress-bar`. + +{% capture example %} +<div class="progress"> + <div class="progress-bar" role="progressbar" style="width: 25%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">25%</div> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Height + +We only set a `height` value on the `.progress`, so if you change that value the inner `.progress-bar` will automatically resize accordingly. + +{% capture example %} +<div class="progress" style="height: 1px;"> + <div class="progress-bar" role="progressbar" style="width: 25%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div> +</div> +<div class="progress" style="height: 20px;"> + <div class="progress-bar" role="progressbar" style="width: 25%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Backgrounds + +Use background utility classes to change the appearance of individual progress bars. + +{% capture example %} +<div class="progress"> + <div class="progress-bar bg-success" role="progressbar" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div> +</div> +<div class="progress"> + <div class="progress-bar bg-info" role="progressbar" style="width: 50%" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"></div> +</div> +<div class="progress"> + <div class="progress-bar bg-warning" role="progressbar" style="width: 75%" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div> +</div> +<div class="progress"> + <div class="progress-bar bg-danger" role="progressbar" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Multiple bars + +Include multiple progress bars in a progress component if you need. + +{% capture example %} +<div class="progress"> + <div class="progress-bar" role="progressbar" style="width: 15%" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100"></div> + <div class="progress-bar bg-success" role="progressbar" style="width: 30%" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100"></div> + <div class="progress-bar bg-info" role="progressbar" style="width: 20%" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"></div> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Striped + +Add `.progress-bar-striped` to any `.progress-bar` to apply a stripe via CSS gradient over the progress bar's background color. + +{% capture example %} +<div class="progress"> + <div class="progress-bar progress-bar-striped" role="progressbar" style="width: 10%" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100"></div> +</div> +<div class="progress"> + <div class="progress-bar progress-bar-striped bg-success" role="progressbar" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div> +</div> +<div class="progress"> + <div class="progress-bar progress-bar-striped bg-info" role="progressbar" style="width: 50%" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"></div> +</div> +<div class="progress"> + <div class="progress-bar progress-bar-striped bg-warning" role="progressbar" style="width: 75%" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div> +</div> +<div class="progress"> + <div class="progress-bar progress-bar-striped bg-danger" role="progressbar" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Animated stripes + +The striped gradient can also be animated. Add `.progress-bar-animated` to `.progress-bar` to animate the stripes right to left via CSS3 animations. + +<div class="bd-example"> + <div class="progress"> + <div class="progress-bar progress-bar-striped" role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100" style="width: 75%"></div> + </div> + <button type="button" class="btn btn-secondary bd-toggle-animated-progress" data-toggle="button" aria-pressed="false"> + Toggle animation + </button> +</div> + +{% highlight html %} +<div class="progress"> + <div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100" style="width: 75%"></div> +</div> +{% endhighlight %} diff --git a/vendor/twbs/bootstrap/site/docs/4.5/components/scrollspy.md b/vendor/twbs/bootstrap/site/docs/4.5/components/scrollspy.md new file mode 100644 index 000000000..eb5b4ba6f --- /dev/null +++ b/vendor/twbs/bootstrap/site/docs/4.5/components/scrollspy.md @@ -0,0 +1,345 @@ +--- +layout: docs +title: Scrollspy +description: Automatically update Bootstrap navigation or list group components based on scroll position to indicate which link is currently active in the viewport. +group: components +toc: true +--- + +## How it works + +Scrollspy has a few requirements to function properly: + +- If you're building our JavaScript from source, it [requires `util.js`]({{ site.baseurl }}/docs/{{ site.docs_version }}/getting-started/javascript/#util). +- It must be used on a Bootstrap [nav component]({{ site.baseurl }}/docs/{{ site.docs_version }}/components/navs/) or [list group]({{ site.baseurl }}/docs/{{ site.docs_version }}/components/list-group/). +- Scrollspy requires `position: relative;` on the element you're spying on, usually the `<body>`. +- When spying on elements other than the `<body>`, be sure to have a `height` set and `overflow-y: scroll;` applied. +- Anchors (`<a>`) are required and must point to an element with that `id`. + +When successfully implemented, your nav or list group will update accordingly, moving the `.active` class from one item to the next based on their associated targets. + +## Example in navbar + +Scroll the area below the navbar and watch the active class change. The dropdown items will be highlighted as well. + +<div class="bd-example"> + <nav id="navbar-example2" class="navbar navbar-light bg-light"> + <a class="navbar-brand" href="#">Navbar</a> + <ul class="nav nav-pills"> + <li class="nav-item"> + <a class="nav-link" href="#fat">@fat</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#mdo">@mdo</a> + </li> + <li class="nav-item dropdown"> + <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Dropdown</a> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#one">one</a> + <a class="dropdown-item" href="#two">two</a> + <div role="separator" class="dropdown-divider"></div> + <a class="dropdown-item" href="#three">three</a> + </div> + </li> + </ul> + </nav> + <div data-spy="scroll" data-target="#navbar-example2" data-offset="0" class="scrollspy-example"> + <h4 id="fat">@fat</h4> + <p>Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.</p> + <h4 id="mdo">@mdo</h4> + <p>Veniam marfa mustache skateboard, adipisicing fugiat velit pitchfork beard. Freegan beard aliqua cupidatat mcsweeney's vero. Cupidatat four loko nisi, ea helvetica nulla carles. Tattooed cosby sweater food truck, mcsweeney's quis non freegan vinyl. Lo-fi wes anderson +1 sartorial. Carles non aesthetic exercitation quis gentrify. Brooklyn adipisicing craft beer vice keytar deserunt.</p> + <h4 id="one">one</h4> + <p>Occaecat commodo aliqua delectus. Fap craft beer deserunt skateboard ea. Lomo bicycle rights adipisicing banh mi, velit ea sunt next level locavore single-origin coffee in magna veniam. High life id vinyl, echo park consequat quis aliquip banh mi pitchfork. Vero VHS est adipisicing. Consectetur nisi DIY minim messenger bag. Cred ex in, sustainable delectus consectetur fanny pack iphone.</p> + <h4 id="two">two</h4> + <p>In incididunt echo park, officia deserunt mcsweeney's proident master cleanse thundercats sapiente veniam. Excepteur VHS elit, proident shoreditch +1 biodiesel laborum craft beer. Single-origin coffee wayfarers irure four loko, cupidatat terry richardson master cleanse. Assumenda you probably haven't heard of them art party fanny pack, tattooed nulla cardigan tempor ad. Proident wolf nesciunt sartorial keffiyeh eu banh mi sustainable. Elit wolf voluptate, lo-fi ea portland before they sold out four loko. Locavore enim nostrud mlkshk brooklyn nesciunt.</p> + <h4 id="three">three</h4> + <p>Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.</p> + <p>Keytar twee blog, culpa messenger bag marfa whatever delectus food truck. Sapiente synth id assumenda. Locavore sed helvetica cliche irony, thundercats you probably haven't heard of them consequat hoodie gluten-free lo-fi fap aliquip. Labore elit placeat before they sold out, terry richardson proident brunch nesciunt quis cosby sweater pariatur keffiyeh ut helvetica artisan. Cardigan craft beer seitan readymade velit. VHS chambray laboris tempor veniam. Anim mollit minim commodo ullamco thundercats. + </p> + </div> +</div> + +{% highlight html %} +<nav id="navbar-example2" class="navbar navbar-light bg-light"> + <a class="navbar-brand" href="#">Navbar</a> + <ul class="nav nav-pills"> + <li class="nav-item"> + <a class="nav-link" href="#fat">@fat</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#mdo">@mdo</a> + </li> + <li class="nav-item dropdown"> + <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Dropdown</a> + <div class="dropdown-menu"> + <a class="dropdown-item" href="#one">one</a> + <a class="dropdown-item" href="#two">two</a> + <div role="separator" class="dropdown-divider"></div> + <a class="dropdown-item" href="#three">three</a> + </div> + </li> + </ul> +</nav> +<div data-spy="scroll" data-target="#navbar-example2" data-offset="0"> + <h4 id="fat">@fat</h4> + <p>...</p> + <h4 id="mdo">@mdo</h4> + <p>...</p> + <h4 id="one">one</h4> + <p>...</p> + <h4 id="two">two</h4> + <p>...</p> + <h4 id="three">three</h4> + <p>...</p> +</div> +{% endhighlight %} + +## Example with nested nav + +Scrollspy also works with nested `.nav`s. If a nested `.nav` is `.active`, its parents will also be `.active`. Scroll the area next to the navbar and watch the active class change. + +<div class="bd-example"> + <div class="row"> + <div class="col-4"> + <nav id="navbar-example3" class="navbar navbar-light bg-light flex-column"> + <a class="navbar-brand" href="#">Navbar</a> + <nav class="nav nav-pills flex-column"> + <a class="nav-link" href="#item-1">Item 1</a> + <nav class="nav nav-pills flex-column"> + <a class="nav-link ml-3 my-1" href="#item-1-1">Item 1-1</a> + <a class="nav-link ml-3 my-1" href="#item-1-2">Item 1-2</a> + </nav> + <a class="nav-link" href="#item-2">Item 2</a> + <a class="nav-link" href="#item-3">Item 3</a> + <nav class="nav nav-pills flex-column"> + <a class="nav-link ml-3 my-1" href="#item-3-1">Item 3-1</a> + <a class="nav-link ml-3 my-1" href="#item-3-2">Item 3-2</a> + </nav> + </nav> + </nav> + </div> + <div class="col-8"> + <div data-spy="scroll" data-target="#navbar-example3" data-offset="0" class="scrollspy-example-2"> + <h4 id="item-1">Item 1</h4> + <p>Ex consequat commodo adipisicing exercitation aute excepteur occaecat ullamco duis aliqua id magna ullamco eu. Do aute ipsum ipsum ullamco cillum consectetur ut et aute consectetur labore. Fugiat laborum incididunt tempor eu consequat enim dolore proident. Qui laborum do non excepteur nulla magna eiusmod consectetur in. Aliqua et aliqua officia quis et incididunt voluptate non anim reprehenderit adipisicing dolore ut consequat deserunt mollit dolore. Aliquip nulla enim veniam non fugiat id cupidatat nulla elit cupidatat commodo velit ut eiusmod cupidatat elit dolore.</p> + <h5 id="item-1-1">Item 1-1</h5> + <p>Amet tempor mollit aliquip pariatur excepteur commodo do ea cillum commodo Lorem et occaecat elit qui et. Aliquip labore ex ex esse voluptate occaecat Lorem ullamco deserunt. Aliqua cillum excepteur irure consequat id quis ea. Sit proident ullamco aute magna pariatur nostrud labore. Reprehenderit aliqua commodo eiusmod aliquip est do duis amet proident magna consectetur consequat eu commodo fugiat non quis. Enim aliquip exercitation ullamco adipisicing voluptate excepteur minim exercitation minim minim commodo adipisicing exercitation officia nisi adipisicing. Anim id duis qui consequat labore adipisicing sint dolor elit cillum anim et fugiat.</p> + <h5 id="item-1-2">Item 1-2</h5> + <p>Cillum nisi deserunt magna eiusmod qui eiusmod velit voluptate pariatur laborum sunt enim. Irure laboris mollit consequat incididunt sint et culpa culpa incididunt adipisicing magna magna occaecat. Nulla ipsum cillum eiusmod sint elit excepteur ea labore enim consectetur in labore anim. Proident ullamco ipsum esse elit ut Lorem eiusmod dolor et eiusmod. Anim occaecat nulla in non consequat eiusmod velit incididunt.</p> + <h4 id="item-2">Item 2</h4> + <p>Quis magna Lorem anim amet ipsum do mollit sit cillum voluptate ex nulla tempor. Laborum consequat non elit enim exercitation cillum aliqua consequat id aliqua. Esse ex consectetur mollit voluptate est in duis laboris ad sit ipsum anim Lorem. Incididunt veniam velit elit elit veniam Lorem aliqua quis ullamco deserunt sit enim elit aliqua esse irure. Laborum nisi sit est tempor laborum mollit labore officia laborum excepteur commodo non commodo dolor excepteur commodo. Ipsum fugiat ex est consectetur ipsum commodo tempor sunt in proident.</p> + <h4 id="item-3">Item 3</h4> + <p>Quis anim sit do amet fugiat dolor velit sit ea ea do reprehenderit culpa duis. Nostrud aliqua ipsum fugiat minim proident occaecat excepteur aliquip culpa aute tempor reprehenderit. Deserunt tempor mollit elit ex pariatur dolore velit fugiat mollit culpa irure ullamco est ex ullamco excepteur.</p> + <h5 id="item-3-1">Item 3-1</h5> + <p>Deserunt quis elit Lorem eiusmod amet enim enim amet minim Lorem proident nostrud. Ea id dolore anim exercitation aute fugiat labore voluptate cillum do laboris labore. Ex velit exercitation nisi enim labore reprehenderit labore nostrud ut ut. Esse officia sunt duis aliquip ullamco tempor eiusmod deserunt irure nostrud irure. Ullamco proident veniam laboris ea consectetur magna sunt ex exercitation aliquip minim enim culpa occaecat exercitation. Est tempor excepteur aliquip laborum consequat do deserunt laborum esse eiusmod irure proident ipsum esse qui.</p> + <h5 id="item-3-2">Item 3-2</h5> + <p>Labore sit culpa commodo elit adipisicing sit aliquip elit proident voluptate minim mollit nostrud aute reprehenderit do. Mollit excepteur eu Lorem ipsum anim commodo sint labore Lorem in exercitation velit incididunt. Occaecat consectetur nisi in occaecat proident minim enim sunt reprehenderit exercitation cupidatat et do officia. Aliquip consequat ad labore labore mollit ut amet. Sit pariatur tempor proident in veniam culpa aliqua excepteur elit magna fugiat eiusmod amet officia.</p> + </div> + </div> + </div> +</div> + +{% highlight html %} +<nav id="navbar-example3" class="navbar navbar-light bg-light"> + <a class="navbar-brand" href="#">Navbar</a> + <nav class="nav nav-pills flex-column"> + <a class="nav-link" href="#item-1">Item 1</a> + <nav class="nav nav-pills flex-column"> + <a class="nav-link ml-3 my-1" href="#item-1-1">Item 1-1</a> + <a class="nav-link ml-3 my-1" href="#item-1-2">Item 1-2</a> + </nav> + <a class="nav-link" href="#item-2">Item 2</a> + <a class="nav-link" href="#item-3">Item 3</a> + <nav class="nav nav-pills flex-column"> + <a class="nav-link ml-3 my-1" href="#item-3-1">Item 3-1</a> + <a class="nav-link ml-3 my-1" href="#item-3-2">Item 3-2</a> + </nav> + </nav> +</nav> + +<div data-spy="scroll" data-target="#navbar-example3" data-offset="0"> + <h4 id="item-1">Item 1</h4> + <p>...</p> + <h5 id="item-1-1">Item 1-1</h5> + <p>...</p> + <h5 id="item-1-2">Item 1-2</h5> + <p>...</p> + <h4 id="item-2">Item 2</h4> + <p>...</p> + <h4 id="item-3">Item 3</h4> + <p>...</p> + <h5 id="item-3-1">Item 3-1</h5> + <p>...</p> + <h5 id="item-3-2">Item 3-2</h5> + <p>...</p> +</div> +{% endhighlight %} + +## Example with list-group + +Scrollspy also works with `.list-group`s. Scroll the area next to the list group and watch the active class change. + +<div class="bd-example"> + <div class="row"> + <div class="col-4"> + <div id="list-example" class="list-group"> + <a class="list-group-item list-group-item-action" href="#list-item-1">Item 1</a> + <a class="list-group-item list-group-item-action" href="#list-item-2">Item 2</a> + <a class="list-group-item list-group-item-action" href="#list-item-3">Item 3</a> + <a class="list-group-item list-group-item-action" href="#list-item-4">Item 4</a> + </div> + </div> + <div class="col-8"> + <div data-spy="scroll" data-target="#list-example" data-offset="0" class="scrollspy-example"> + <h4 id="list-item-1">Item 1</h4> + <p>Ex consequat commodo adipisicing exercitation aute excepteur occaecat ullamco duis aliqua id magna ullamco eu. Do aute ipsum ipsum ullamco cillum consectetur ut et aute consectetur labore. Fugiat laborum incididunt tempor eu consequat enim dolore proident. Qui laborum do non excepteur nulla magna eiusmod consectetur in. Aliqua et aliqua officia quis et incididunt voluptate non anim reprehenderit adipisicing dolore ut consequat deserunt mollit dolore. Aliquip nulla enim veniam non fugiat id cupidatat nulla elit cupidatat commodo velit ut eiusmod cupidatat elit dolore.</p> + <h4 id="list-item-2">Item 2</h4> + <p>Quis magna Lorem anim amet ipsum do mollit sit cillum voluptate ex nulla tempor. Laborum consequat non elit enim exercitation cillum aliqua consequat id aliqua. Esse ex consectetur mollit voluptate est in duis laboris ad sit ipsum anim Lorem. Incididunt veniam velit elit elit veniam Lorem aliqua quis ullamco deserunt sit enim elit aliqua esse irure. Laborum nisi sit est tempor laborum mollit labore officia laborum excepteur commodo non commodo dolor excepteur commodo. Ipsum fugiat ex est consectetur ipsum commodo tempor sunt in proident.</p> + <h4 id="list-item-3">Item 3</h4> + <p>Quis anim sit do amet fugiat dolor velit sit ea ea do reprehenderit culpa duis. Nostrud aliqua ipsum fugiat minim proident occaecat excepteur aliquip culpa aute tempor reprehenderit. Deserunt tempor mollit elit ex pariatur dolore velit fugiat mollit culpa irure ullamco est ex ullamco excepteur.</p> + <h4 id="list-item-4">Item 4</h4> + <p>Quis anim sit do amet fugiat dolor velit sit ea ea do reprehenderit culpa duis. Nostrud aliqua ipsum fugiat minim proident occaecat excepteur aliquip culpa aute tempor reprehenderit. Deserunt tempor mollit elit ex pariatur dolore velit fugiat mollit culpa irure ullamco est ex ullamco excepteur.</p> + </div> + </div> + </div> +</div> + +{% highlight html %} +<div id="list-example" class="list-group"> + <a class="list-group-item list-group-item-action" href="#list-item-1">Item 1</a> + <a class="list-group-item list-group-item-action" href="#list-item-2">Item 2</a> + <a class="list-group-item list-group-item-action" href="#list-item-3">Item 3</a> + <a class="list-group-item list-group-item-action" href="#list-item-4">Item 4</a> +</div> +<div data-spy="scroll" data-target="#list-example" data-offset="0" class="scrollspy-example"> + <h4 id="list-item-1">Item 1</h4> + <p>...</p> + <h4 id="list-item-2">Item 2</h4> + <p>...</p> + <h4 id="list-item-3">Item 3</h4> + <p>...</p> + <h4 id="list-item-4">Item 4</h4> + <p>...</p> +</div> +{% endhighlight %} + + +## Usage + +### Via data attributes + +To easily add scrollspy behavior to your topbar navigation, add `data-spy="scroll"` to the element you want to spy on (most typically this would be the `<body>`). Then add the `data-target` attribute with the ID or class of the parent element of any Bootstrap `.nav` component. + +{% highlight css %} +body { + position: relative; +} +{% endhighlight %} + +{% highlight html %} +<body data-spy="scroll" data-target="#navbar-example"> + ... + <div id="navbar-example"> + <ul class="nav nav-tabs" role="tablist"> + ... + </ul> + </div> + ... +</body> +{% endhighlight %} + +### Via JavaScript + +After adding `position: relative;` in your CSS, call the scrollspy via JavaScript: + +{% highlight js %} +$('body').scrollspy({ target: '#navbar-example' }) +{% endhighlight %} + +{% capture callout %} +#### Resolvable ID targets required + +Navbar links must have resolvable id targets. For example, a `<a href="#home">home</a>` must correspond to something in the DOM like `<div id="home"></div>`. +{% endcapture %} +{% include callout.html content=callout type="danger" %} + +{% capture callout %} +#### Non-`:visible` target elements ignored + +Target elements that are not [`:visible` according to jQuery](https://api.jquery.com/visible-selector/) will be ignored and their corresponding nav items will never be highlighted. +{% endcapture %} +{% include callout.html content=callout type="info" %} + +### Methods + +#### `.scrollspy('refresh')` + +When using scrollspy in conjunction with adding or removing of elements from the DOM, you'll need to call the refresh method like so: + +{% highlight js %} +$('[data-spy="scroll"]').each(function () { + var $spy = $(this).scrollspy('refresh') +}) +{% endhighlight %} + +#### `.scrollspy('dispose')` + +Destroys an element's scrollspy. + +### Options + +Options can be passed via data attributes or JavaScript. For data attributes, append the option name to `data-`, as in `data-offset=""`. + +<table class="table table-bordered table-striped"> + <thead> + <tr> + <th style="width: 100px;">Name</th> + <th style="width: 100px;">Type</th> + <th style="width: 50px;">Default</th> + <th>Description</th> + </tr> + </thead> + <tbody> + <tr> + <td>offset</td> + <td>number</td> + <td>10</td> + <td>Pixels to offset from top when calculating position of scroll.</td> + </tr> + <tr> + <td>method</td> + <td>string</td> + <td>auto</td> + <td>Finds which section the spied element is in. <code>auto</code> will choose the best method to get scroll coordinates. <code>offset</code> will use jQuery offset method to get scroll coordinates. <code>position</code> will use jQuery position method to get scroll coordinates.</td> + </tr> + <tr> + <td>target</td> + <td>string | jQuery object | DOM element</td> + <td></td> + <td>Specifies element to apply Scrollspy plugin.</td> + </tr> + </tbody> +</table> + +### Events + +<table class="table table-bordered table-striped"> + <thead> + <tr> + <th style="width: 150px;">Event Type</th> + <th>Description</th> + </tr> + </thead> + <tbody> + <tr> + <td>activate.bs.scrollspy</td> + <td>This event fires on the scroll element whenever a new item becomes activated by the scrollspy.</td> + </tr> + </tbody> +</table> + +{% highlight js %} +$('[data-spy="scroll"]').on('activate.bs.scrollspy', function () { + // do something... +}) +{% endhighlight %} diff --git a/vendor/twbs/bootstrap/site/docs/4.5/components/spinners.md b/vendor/twbs/bootstrap/site/docs/4.5/components/spinners.md new file mode 100644 index 000000000..c16594572 --- /dev/null +++ b/vendor/twbs/bootstrap/site/docs/4.5/components/spinners.md @@ -0,0 +1,185 @@ +--- +layout: docs +title: Spinners +description: Indicate the loading state of a component or page with Bootstrap spinners, built entirely with HTML, CSS, and no JavaScript. +group: components +toc: true +--- + +## About + +Bootstrap "spinners" can be used to show the loading state in your projects. They're built only with HTML and CSS, meaning you don't need any JavaScript to create them. You will, however, need some custom JavaScript to toggle their visibility. Their appearance, alignment, and sizing can be easily customized with our amazing utility classes. + +For accessibility purposes, each loader here includes `role="status"` and a nested `<span class="sr-only">Loading...</span>`. + +## Border spinner + +Use the border spinners for a lightweight loading indicator. + +{% capture example %} +<div class="spinner-border" role="status"> + <span class="sr-only">Loading...</span> +</div> +{% endcapture %} +{% include example.html content=example %} + +### Colors + +The border spinner uses `currentColor` for its `border-color`, meaning you can customize the color with [text color utilities][color]. You can use any of our text color utilities on the standard spinner. + +{% capture example %} +{% for color in site.data.theme-colors %} +<div class="spinner-border text-{{ color.name }}" role="status"> + <span class="sr-only">Loading...</span> +</div>{% endfor %} +{% endcapture %} +{% include example.html content=example %} + +{% capture callout %} +**Why not use `border-color` utilities?** Each border spinner specifies a `transparent` border for at least one side, so `.border-{color}` utilities would override that. +{% endcapture %} +{% include callout.html content=callout type="info" %} + +## Growing spinner + +If you don't fancy a border spinner, switch to the grow spinner. While it doesn't technically spin, it does repeatedly grow! + +{% capture example %} +<div class="spinner-grow" role="status"> + <span class="sr-only">Loading...</span> +</div> +{% endcapture %} +{% include example.html content=example %} + +Once again, this spinner is built with `currentColor`, so you can easily change its appearance with [text color utilities][color]. Here it is in blue, along with the supported variants. + +{% capture example %} +{% for color in site.data.theme-colors %} +<div class="spinner-grow text-{{ color.name }}" role="status"> + <span class="sr-only">Loading...</span> +</div>{% endfor %} +{% endcapture %} +{% include example.html content=example %} + +## Alignment + +Spinners in Bootstrap are built with `rem`s, `currentColor`, and `display: inline-flex`. This means they can easily be resized, recolored, and quickly aligned. + +### Margin + +Use [margin utilities][margin] like `.m-5` for easy spacing. + +{% capture example %} +<div class="spinner-border m-5" role="status"> + <span class="sr-only">Loading...</span> +</div> +{% endcapture %} +{% include example.html content=example %} + +### Placement + +Use [flexbox utilities][flex], [float utilities][float], or [text alignment][text] utilities to place spinners exactly where you need them in any situation. + +#### Flex + +{% capture example %} +<div class="d-flex justify-content-center"> + <div class="spinner-border" role="status"> + <span class="sr-only">Loading...</span> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +{% capture example %} +<div class="d-flex align-items-center"> + <strong>Loading...</strong> + <div class="spinner-border ml-auto" role="status" aria-hidden="true"></div> +</div> +{% endcapture %} +{% include example.html content=example %} + +#### Floats + +{% capture example %} +<div class="clearfix"> + <div class="spinner-border float-right" role="status"> + <span class="sr-only">Loading...</span> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +#### Text align + +{% capture example %} +<div class="text-center"> + <div class="spinner-border" role="status"> + <span class="sr-only">Loading...</span> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Size + +Add `.spinner-border-sm` and `.spinner-grow-sm` to make a smaller spinner that can quickly be used within other components. + +{% capture example %} +<div class="spinner-border spinner-border-sm" role="status"> + <span class="sr-only">Loading...</span> +</div> +<div class="spinner-grow spinner-grow-sm" role="status"> + <span class="sr-only">Loading...</span> +</div> +{% endcapture %} +{% include example.html content=example %} + +Or, use custom CSS or inline styles to change the dimensions as needed. + +{% capture example %} +<div class="spinner-border" style="width: 3rem; height: 3rem;" role="status"> + <span class="sr-only">Loading...</span> +</div> +<div class="spinner-grow" style="width: 3rem; height: 3rem;" role="status"> + <span class="sr-only">Loading...</span> +</div> +{% endcapture %} +{% include example.html content=example %} + +## Buttons + +Use spinners within buttons to indicate an action is currently processing or taking place. You may also swap the text out of the spinner element and utilize button text as needed. + +{% capture example %} +<button class="btn btn-primary" type="button" disabled> + <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> + <span class="sr-only">Loading...</span> +</button> +<button class="btn btn-primary" type="button" disabled> + <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> + Loading... +</button> +{% endcapture %} +{% include example.html content=example %} + +{% capture example %} +<button class="btn btn-primary" type="button" disabled> + <span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span> + <span class="sr-only">Loading...</span> +</button> +<button class="btn btn-primary" type="button" disabled> + <span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span> + Loading... +</button> +{% endcapture %} +{% include example.html content=example %} + + +[color]: {{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/colors/ +[display]: {{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/display/ +[flex]: {{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/flex/ +[float]: {{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/float/ +[margin]: {{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/spacing/ +[sizing]: {{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/sizing/ +[text]: {{ site.baseurl }}/docs/{{ site.docs_version }}/content/typography/ diff --git a/vendor/twbs/bootstrap/site/docs/4.5/components/toasts.md b/vendor/twbs/bootstrap/site/docs/4.5/components/toasts.md new file mode 100644 index 000000000..7ef36c7f7 --- /dev/null +++ b/vendor/twbs/bootstrap/site/docs/4.5/components/toasts.md @@ -0,0 +1,332 @@ +--- +layout: docs +title: Toasts +description: Push notifications to your visitors with a toast, a lightweight and easily customizable alert message. +group: components +toc: true +--- + +Toasts are lightweight notifications designed to mimic the push notifications that have been popularized by mobile and desktop operating systems. They're built with flexbox, so they're easy to align and position. + +## Overview + +Things to know when using the toast plugin: + +- If you're building our JavaScript from source, it [requires `util.js`]({{ site.baseurl }}/docs/{{ site.docs_version }}/getting-started/javascript/#util). +- Toasts are opt-in for performance reasons, so **you must initialize them yourself**. +- **Please note that you are responsible for positioning toasts.** +- Toasts will automatically hide if you do not specify `autohide: false`. + +{% include callout-info-prefersreducedmotion.md %} + +## Examples + +### Basic + +To encourage extensible and predictable toasts, we recommend a header and body. Toast headers use `display: flex`, allowing easy alignment of content thanks to our margin and flexbox utilities. + +Toasts are as flexible as you need and have very little required markup. At a minimum, we require a single element to contain your "toasted" content and strongly encourage a dismiss button. + +{% capture example %} +<div class="toast" role="alert" aria-live="assertive" aria-atomic="true"> + <div class="toast-header"> + {% include icons/placeholder.svg width="20" height="20" background="#007aff" class="rounded mr-2" text=" " title=" " %} + <strong class="mr-auto">Bootstrap</strong> + <small>11 mins ago</small> + <button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> + <div class="toast-body"> + Hello, world! This is a toast message. + </div> +</div> +{% endcapture %} +{% include example.html content=example class="bg-light" %} + +### Translucent + +Toasts are slightly translucent, too, so they blend over whatever they might appear over. For browsers that support the `backdrop-filter` CSS property, we'll also attempt to blur the elements under a toast. + +{% capture example %} +<div class="toast" role="alert" aria-live="assertive" aria-atomic="true"> + <div class="toast-header"> + {% include icons/placeholder.svg width="20" height="20" background="#007aff" class="rounded mr-2" text=" " title=" " %} + <strong class="mr-auto">Bootstrap</strong> + <small class="text-muted">11 mins ago</small> + <button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> + <div class="toast-body"> + Hello, world! This is a toast message. + </div> +</div> +{% endcapture %} +{% include example.html content=example class="bg-dark" %} + +### Stacking + +When you have multiple toasts, we default to vertically stacking them in a readable manner. + +{% capture example %} +<div class="toast" role="alert" aria-live="assertive" aria-atomic="true"> + <div class="toast-header"> + {% include icons/placeholder.svg width="20" height="20" background="#007aff" class="rounded mr-2" text=" " title=" " %} + <strong class="mr-auto">Bootstrap</strong> + <small class="text-muted">just now</small> + <button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> + <div class="toast-body"> + See? Just like this. + </div> +</div> + +<div class="toast" role="alert" aria-live="assertive" aria-atomic="true"> + <div class="toast-header"> + {% include icons/placeholder.svg width="20" height="20" background="#007aff" class="rounded mr-2" text=" " title=" " %} + <strong class="mr-auto">Bootstrap</strong> + <small class="text-muted">2 seconds ago</small> + <button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> + <div class="toast-body"> + Heads up, toasts will stack automatically + </div> +</div> +{% endcapture %} +{% include example.html content=example class="bg-light" %} + +## Placement + +Place toasts with custom CSS as you need them. The top right is often used for notifications, as is the top middle. If you're only ever going to show one toast at a time, put the positioning styles right on the `.toast`. + +{% capture example %} +<div aria-live="polite" aria-atomic="true" style="position: relative; min-height: 200px;"> + <div class="toast" style="position: absolute; top: 0; right: 0;"> + <div class="toast-header"> + {% include icons/placeholder.svg width="20" height="20" background="#007aff" class="rounded mr-2" text=" " title=" " %} + <strong class="mr-auto">Bootstrap</strong> + <small>11 mins ago</small> + <button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> + <div class="toast-body"> + Hello, world! This is a toast message. + </div> + </div> +</div> +{% endcapture %} +{% include example.html content=example class="bg-dark" %} + +For systems that generate more notifications, consider using a wrapping element so they can easily stack. + +{% capture example %} +<div aria-live="polite" aria-atomic="true" style="position: relative; min-height: 200px;"> + <!-- Position it --> + <div style="position: absolute; top: 0; right: 0;"> + + <!-- Then put toasts within --> + <div class="toast" role="alert" aria-live="assertive" aria-atomic="true"> + <div class="toast-header"> + {% include icons/placeholder.svg width="20" height="20" background="#007aff" class="rounded mr-2" text=" " title=" " %} + <strong class="mr-auto">Bootstrap</strong> + <small class="text-muted">just now</small> + <button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> + <div class="toast-body"> + See? Just like this. + </div> + </div> + + <div class="toast" role="alert" aria-live="assertive" aria-atomic="true"> + <div class="toast-header"> + {% include icons/placeholder.svg width="20" height="20" background="#007aff" class="rounded mr-2" text=" " title=" " %} + <strong class="mr-auto">Bootstrap</strong> + <small class="text-muted">2 seconds ago</small> + <button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> + <div class="toast-body"> + Heads up, toasts will stack automatically + </div> + </div> + </div> +</div> +{% endcapture %} +{% include example.html content=example class="bg-dark" %} + +You can also get fancy with flexbox utilities to align toasts horizontally and/or vertically. + +{% capture example %} +<!-- Flexbox container for aligning the toasts --> +<div aria-live="polite" aria-atomic="true" class="d-flex justify-content-center align-items-center" style="height: 200px;"> + + <!-- Then put toasts within --> + <div class="toast" role="alert" aria-live="assertive" aria-atomic="true"> + <div class="toast-header"> + {% include icons/placeholder.svg width="20" height="20" background="#007aff" class="rounded mr-2" text=" " title=" " %} + <strong class="mr-auto">Bootstrap</strong> + <small>11 mins ago</small> + <button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> + <div class="toast-body"> + Hello, world! This is a toast message. + </div> + </div> +</div> +{% endcapture %} +{% include example.html content=example class="bg-dark" %} + +## Accessibility + +Toasts are intended to be small interruptions to your visitors or users, so to help those with screen readers and similar assistive technologies, you should wrap your toasts in an [`aria-live` region](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions). Changes to live regions (such as injecting/updating a toast component) are automatically announced by screen readers without needing to move the user's focus or otherwise interrupt the user. Additionally, include `aria-atomic="true"` to ensure that the entire toast is always announced as a single (atomic) unit, rather than announcing what was changed (which could lead to problems if you only update part of the toast's content, or if displaying the same toast content at a later point in time). If the information needed is important for the process, e.g. for a list of errors in a form, then use the [alert component]({{ site.baseurl }}/docs/{{ site.docs_version }}/components/alerts/) instead of toast. + +Note that the live region needs to be present in the markup *before* the toast is generated or updated. If you dynamically generate both at the same time and inject them into the page, they will generally not be announced by assistive technologies. + +You also need to adapt the `role` and `aria-live` level depending on the content. If it's an important message like an error, use `role="alert" aria-live="assertive"`, otherwise use `role="status" aria-live="polite"` attributes. + +As the content you're displaying changes, be sure to update the [`delay` timeout](#options) to ensure people have enough time to read the toast. + +{% highlight html %} +<div class="toast" role="alert" aria-live="polite" aria-atomic="true" data-delay="10000"> + <div role="alert" aria-live="assertive" aria-atomic="true">...</div> +</div> +{% endhighlight %} + +When using `autohide: false`, you must add a close button to allow users to dismiss the toast. + +{% capture example %} +<div role="alert" aria-live="assertive" aria-atomic="true" class="toast" data-autohide="false"> + <div class="toast-header"> + {% include icons/placeholder.svg width="20" height="20" background="#007aff" class="rounded mr-2" text=" " title=" " %} + <strong class="mr-auto">Bootstrap</strong> + <small>11 mins ago</small> + <button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> + <div class="toast-body"> + Hello, world! This is a toast message. + </div> +</div> +{% endcapture %} +{% include example.html content=example class="bg-light" %} + +## JavaScript behavior + +### Usage + +Initialize toasts via JavaScript: + +{% highlight js %} +$('.toast').toast(option) +{% endhighlight %} + +### Options + +Options can be passed via data attributes or JavaScript. For data attributes, append the option name to `data-`, as in `data-animation=""`. + +<table class="table table-bordered table-striped"> + <thead> + <tr> + <th style="width: 100px;">Name</th> + <th style="width: 100px;">Type</th> + <th style="width: 50px;">Default</th> + <th>Description</th> + </tr> + </thead> + <tbody> + <tr> + <td>animation</td> + <td>boolean</td> + <td>true</td> + <td>Apply a CSS fade transition to the toast</td> + </tr> + <tr> + <td>autohide</td> + <td>boolean</td> + <td>true</td> + <td>Auto hide the toast</td> + </tr> + <tr> + <td>delay</td> + <td>number</td> + <td> + <code>500</code> + </td> + <td>Delay hiding the toast (ms)</td> + </tr> + </tbody> +</table> + +### Methods + +{% include callout-danger-async-methods.md %} + +#### `$().toast(options)` + +Attaches a toast handler to an element collection. + +#### `.toast('show')` + +Reveals an element's toast. **Returns to the caller before the toast has actually been shown** (i.e. before the `shown.bs.toast` event occurs). +You have to manually call this method, instead your toast won't show. + +{% highlight js %}$('#element').toast('show'){% endhighlight %} + +#### `.toast('hide')` + +Hides an element's toast. **Returns to the caller before the toast has actually been hidden** (i.e. before the `hidden.bs.toast` event occurs). You have to manually call this method if you made `autohide` to `false`. + +{% highlight js %}$('#element').toast('hide'){% endhighlight %} + +#### `.toast('dispose')` + +Hides an element's toast. Your toast will remain on the DOM but won't show anymore. + +{% highlight js %}$('#element').toast('dispose'){% endhighlight %} + +### Events + +<table class="table table-bordered table-striped"> + <thead> + <tr> + <th style="width: 150px;">Event Type</th> + <th>Description</th> + </tr> + </thead> + <tbody> + <tr> + <td>show.bs.toast</td> + <td>This event fires immediately when the <code>show</code> instance method is called.</td> + </tr> + <tr> + <td>shown.bs.toast</td> + <td>This event is fired when the toast has been made visible to the user.</td> + </tr> + <tr> + <td>hide.bs.toast</td> + <td>This event is fired immediately when the <code>hide</code> instance method has been called.</td> + </tr> + <tr> + <td>hidden.bs.toast</td> + <td>This event is fired when the toast has finished being hidden from the user.</td> + </tr> + </tbody> +</table> + +{% highlight js %} +$('#myToast').on('hidden.bs.toast', function () { + // do something... +}) +{% endhighlight %} diff --git a/vendor/twbs/bootstrap/site/docs/4.5/components/tooltips.md b/vendor/twbs/bootstrap/site/docs/4.5/components/tooltips.md new file mode 100644 index 000000000..2d23c4987 --- /dev/null +++ b/vendor/twbs/bootstrap/site/docs/4.5/components/tooltips.md @@ -0,0 +1,388 @@ +--- +layout: docs +title: Tooltips +description: Documentation and examples for adding custom Bootstrap tooltips with CSS and JavaScript using CSS3 for animations and data-attributes for local title storage. +group: components +toc: true +--- + +## Overview + +Things to know when using the tooltip plugin: + +- Tooltips rely on the 3rd party library [Popper.js](https://popper.js.org/) for positioning. You must include [popper.min.js]({{ site.cdn.popper }}) before bootstrap.js or use `bootstrap.bundle.min.js` / `bootstrap.bundle.js` which contains Popper.js in order for tooltips to work! +- If you're building our JavaScript from source, it [requires `util.js`]({{ site.baseurl }}/docs/{{ site.docs_version }}/getting-started/javascript/#util). +- Tooltips are opt-in for performance reasons, so **you must initialize them yourself**. +- Tooltips with zero-length titles are never displayed. +- Specify `container: 'body'` to avoid rendering problems in more complex components (like our input groups, button groups, etc). +- Triggering tooltips on hidden elements will not work. +- Tooltips for `.disabled` or `disabled` elements must be triggered on a wrapper element. +- When triggered from hyperlinks that span multiple lines, tooltips will be centered. Use `white-space: nowrap;` on your `<a>`s to avoid this behavior. +- Tooltips must be hidden before their corresponding elements have been removed from the DOM. +- Tooltips can be triggered thanks to an element inside a shadow DOM. + +{% include callout-info-prefersreducedmotion.md %} + +Got all that? Great, let's see how they work with some examples. + +## Example: Enable tooltips everywhere + +One way to initialize all tooltips on a page would be to select them by their `data-toggle` attribute: + +{% highlight js %} +$(function () { + $('[data-toggle="tooltip"]').tooltip() +}) +{% endhighlight %} + +## Examples + +Hover over the links below to see tooltips: + +<div class="bd-example tooltip-demo"> + <p class="muted">Tight pants next level keffiyeh <a href="#" data-toggle="tooltip" title="Default tooltip">you probably</a> haven't heard of them. Photo booth beard raw denim letterpress vegan messenger bag stumptown. Farm-to-table seitan, mcsweeney's fixie sustainable quinoa 8-bit american apparel <a href="#" data-toggle="tooltip" title="Another tooltip">have a</a> terry richardson vinyl chambray. Beard stumptown, cardigans banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, four loko mcsweeney's cleanse vegan chambray. A really ironic artisan <a href="#" data-toggle="tooltip" title="Another one here too">whatever keytar</a>, scenester farm-to-table banksy Austin <a href="#" data-toggle="tooltip" title="The last tip!">twitter handle</a> freegan cred raw denim single-origin coffee viral. + </p> +</div> + +Hover over the buttons below to see the four tooltips directions: top, right, bottom, and left. + +<div class="bd-example tooltip-demo"> + <div class="bd-example-tooltips"> + <button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="top" title="Tooltip on top">Tooltip on top</button> + <button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="right" title="Tooltip on right">Tooltip on right</button> + <button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="bottom" title="Tooltip on bottom">Tooltip on bottom</button> + <button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="left" title="Tooltip on left">Tooltip on left</button> + <button type="button" class="btn btn-secondary" data-toggle="tooltip" data-html="true" title="<em>Tooltip</em> <u>with</u> <b>HTML</b>">Tooltip with HTML</button> + </div> +</div> + +{% highlight html %} +<button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="top" title="Tooltip on top"> + Tooltip on top +</button> +<button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="right" title="Tooltip on right"> + Tooltip on right +</button> +<button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="bottom" title="Tooltip on bottom"> + Tooltip on bottom +</button> +<button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="left" title="Tooltip on left"> + Tooltip on left +</button> +{% endhighlight %} + +And with custom HTML added: + +{% highlight html %} +<button type="button" class="btn btn-secondary" data-toggle="tooltip" data-html="true" title="<em>Tooltip</em> <u>with</u> <b>HTML</b>"> + Tooltip with HTML +</button> +{% endhighlight %} + +## Usage + +The tooltip plugin generates content and markup on demand, and by default places tooltips after their trigger element. + +Trigger the tooltip via JavaScript: + +{% highlight js %} +$('#example').tooltip(options) +{% endhighlight %} + +{% capture callout %} +##### Overflow `auto` and `scroll` + +Tooltip position attempts to automatically change when a parent container has `overflow: auto` or `overflow: scroll` like our `.table-responsive`, but still keeps the original placement's positioning. To resolve, set the `boundary` option to anything other than default value, `'scrollParent'`, such as `'window'`: + +{% highlight js %} +$('#example').tooltip({ boundary: 'window' }) +{% endhighlight %} +{% endcapture %} +{% include callout.html content=callout type="warning" %} + +### Markup + +The required markup for a tooltip is only a `data` attribute and `title` on the HTML element you wish to have a tooltip. The generated markup of a tooltip is rather simple, though it does require a position (by default, set to `top` by the plugin). + +{% capture callout %} +##### Making tooltips work for keyboard and assistive technology users + +You should only add tooltips to HTML elements that are traditionally keyboard-focusable and interactive (such as links or form controls). Although arbitrary HTML elements (such as `<span>`s) can be made focusable by adding the `tabindex="0"` attribute, this will add potentially annoying and confusing tab stops on non-interactive elements for keyboard users, and most assistive technologies currently do not announce the tooltip in this situation. Additionally, do not rely solely on `hover` as the trigger for your tooltip, as this will make your tooltips impossible to trigger for keyboard users. +{% endcapture %} +{% include callout.html content=callout type="warning" %} + +{% highlight html %} +<!-- HTML to write --> +<a href="#" data-toggle="tooltip" title="Some tooltip text!">Hover over me</a> + +<!-- Generated markup by the plugin --> +<div class="tooltip bs-tooltip-top" role="tooltip"> + <div class="arrow"></div> + <div class="tooltip-inner"> + Some tooltip text! + </div> +</div> +{% endhighlight %} + +### Disabled elements + +Elements with the `disabled` attribute aren't interactive, meaning users cannot focus, hover, or click them to trigger a tooltip (or popover). As a workaround, you'll want to trigger the tooltip from a wrapper `<div>` or `<span>`, ideally made keyboard-focusable using `tabindex="0"`, and override the `pointer-events` on the disabled element. + +<div class="tooltip-demo"> +{% capture example %} +<span class="d-inline-block" tabindex="0" data-toggle="tooltip" title="Disabled tooltip"> + <button class="btn btn-primary" style="pointer-events: none;" type="button" disabled>Disabled button</button> +</span> +{% endcapture %} +{% include example.html content=example %} +</div> + +### Options + +Options can be passed via data attributes or JavaScript. For data attributes, append the option name to `data-`, as in `data-animation=""`. + +{% capture callout %} +Note that for security reasons the `sanitize`, `sanitizeFn` and `whiteList` options cannot be supplied using data attributes. +{% endcapture %} +{% include callout.html content=callout type="warning" %} + +<table class="table table-bordered table-striped"> + <thead> + <tr> + <th style="width: 100px;">Name</th> + <th style="width: 100px;">Type</th> + <th style="width: 50px;">Default</th> + <th>Description</th> + </tr> + </thead> + <tbody> + <tr> + <td>animation</td> + <td>boolean</td> + <td>true</td> + <td>Apply a CSS fade transition to the tooltip</td> + </tr> + <tr> + <td>container</td> + <td>string | element | false</td> + <td>false</td> + <td> + <p>Appends the tooltip to a specific element. Example: <code>container: 'body'</code>. This option is particularly useful in that it allows you to position the tooltip in the flow of the document near the triggering element - which will prevent the tooltip from floating away from the triggering element during a window resize.</p> + </td> + </tr> + <tr> + <td>delay</td> + <td>number | object</td> + <td>0</td> + <td> + <p>Delay showing and hiding the tooltip (ms) - does not apply to manual trigger type</p> + <p>If a number is supplied, delay is applied to both hide/show</p> + <p>Object structure is: <code>delay: { "show": 500, "hide": 100 }</code></p> + </td> + </tr> + <tr> + <td>html</td> + <td>boolean</td> + <td>false</td> + <td> + <p>Allow HTML in the tooltip.</p> + <p>If true, HTML tags in the tooltip's <code>title</code> will be rendered in the tooltip. If false, jQuery's <code>text</code> method will be used to insert content into the DOM.</p> + <p>Use text if you're worried about XSS attacks.</p> + </td> + </tr> + <tr> + <td>placement</td> + <td>string | function</td> + <td>'top'</td> + <td> + <p>How to position the tooltip - auto | top | bottom | left | right.<br>When <code>auto</code> is specified, it will dynamically reorient the tooltip.</p> + <p>When a function is used to determine the placement, it is called with the tooltip DOM node as its first argument and the triggering element DOM node as its second. The <code>this</code> context is set to the tooltip instance.</p> + </td> + </tr> + <tr> + <td>selector</td> + <td>string | false</td> + <td>false</td> + <td>If a selector is provided, tooltip objects will be delegated to the specified targets. In practice, this is used to also apply tooltips to dynamically added DOM elements (<code>jQuery.on</code> support). See <a href="{{ site.repo }}/issues/4215">this</a> and <a href="https://codepen.io/Johann-S/pen/djJYPb">an informative example</a>.</td> + </tr> + <tr> + <td>template</td> + <td>string</td> + <td><code>'<div class="tooltip" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>'</code></td> + <td> + <p>Base HTML to use when creating the tooltip.</p> + <p>The tooltip's <code>title</code> will be injected into the <code>.tooltip-inner</code>.</p> + <p><code>.arrow</code> will become the tooltip's arrow.</p> + <p>The outermost wrapper element should have the <code>.tooltip</code> class and <code>role="tooltip"</code>.</p> + </td> + </tr> + <tr> + <td>title</td> + <td>string | element | function</td> + <td>''</td> + <td> + <p>Default title value if <code>title</code> attribute isn't present.</p> + <p>If a function is given, it will be called with its <code>this</code> reference set to the element that the tooltip is attached to.</p> + </td> + </tr> + <tr> + <td>trigger</td> + <td>string</td> + <td>'hover focus'</td> + <td> + <p>How tooltip is triggered - click | hover | focus | manual. You may pass multiple triggers; separate them with a space.</p> + <p><code>'manual'</code> indicates that the tooltip will be triggered programmatically via the <code>.tooltip('show')</code>, <code>.tooltip('hide')</code> and <code>.tooltip('toggle')</code> methods; this value cannot be combined with any other trigger.</p> + <p><code>'hover'</code> on its own will result in tooltips that cannot be triggered via the keyboard, and should only be used if alternative methods for conveying the same information for keyboard users is present.</p> + </td> + </tr> + <tr> + <td>offset</td> + <td>number | string | function</td> + <td>0</td> + <td> + <p>Offset of the tooltip relative to its target.</p> + <p>When a function is used to determine the offset, it is called with an object containing the offset data as its first argument. The function must return an object with the same structure. The triggering element DOM node is passed as the second argument.</p> + <p>For more information refer to Popper.js's <a href="https://popper.js.org/docs/v1/#modifiers..offset.offset">offset docs</a>.</p> + </td> + </tr> + <tr> + <td>fallbackPlacement</td> + <td>string | array</td> + <td>'flip'</td> + <td>Allow to specify which position Popper will use on fallback. For more information refer to + Popper.js's <a href="https://popper.js.org/docs/v1/#modifiers..flip.behavior">behavior docs</a></td> + </tr> + <tr> + <td>boundary</td> + <td>string | element</td> + <td>'scrollParent'</td> + <td>Overflow constraint boundary of the tooltip. Accepts the values of <code>'viewport'</code>, <code>'window'</code>, <code>'scrollParent'</code>, or an HTMLElement reference (JavaScript only). For more information refer to Popper.js's <a href="https://popper.js.org/docs/v1/#modifiers..preventOverflow.boundariesElement">preventOverflow docs</a>.</td> + </tr> + <tr> + <td>sanitize</td> + <td>boolean</td> + <td>true</td> + <td>Enable or disable the sanitization. If activated <code>'template'</code> and <code>'title'</code> options will be sanitized.</td> + </tr> + <tr> + <td>whiteList</td> + <td>object</td> + <td><a href="{{ site.baseurl }}/docs/{{ site.docs_version }}/getting-started/javascript/#sanitizer">Default value</a></td> + <td>Object which contains allowed attributes and tags</td> + </tr> + <tr> + <td>sanitizeFn</td> + <td>null | function</td> + <td>null</td> + <td>Here you can supply your own sanitize function. This can be useful if you prefer to use a dedicated library to perform sanitization.</td> + </tr> + <tr> + <td>popperConfig</td> + <td>null | object</td> + <td>null</td> + <td>To change Bootstrap's default Popper.js config, see <a href="https://popper.js.org/docs/v1/#Popper.Defaults">Popper.js's configuration</a></td> + </tr> + </tbody> +</table> + +{% capture callout %} +#### Data attributes for individual tooltips + +Options for individual tooltips can alternatively be specified through the use of data attributes, as explained above. +{% endcapture %} +{% include callout.html content=callout type="info" %} + +### Methods + +{% include callout-danger-async-methods.md %} + +#### `$().tooltip(options)` + +Attaches a tooltip handler to an element collection. + +#### `.tooltip('show')` + +Reveals an element's tooltip. **Returns to the caller before the tooltip has actually been shown** (i.e. before the `shown.bs.tooltip` event occurs). This is considered a "manual" triggering of the tooltip. Tooltips with zero-length titles are never displayed. + +{% highlight js %}$('#element').tooltip('show'){% endhighlight %} + +#### `.tooltip('hide')` + +Hides an element's tooltip. **Returns to the caller before the tooltip has actually been hidden** (i.e. before the `hidden.bs.tooltip` event occurs). This is considered a "manual" triggering of the tooltip. + +{% highlight js %}$('#element').tooltip('hide'){% endhighlight %} + +#### `.tooltip('toggle')` + +Toggles an element's tooltip. **Returns to the caller before the tooltip has actually been shown or hidden** (i.e. before the `shown.bs.tooltip` or `hidden.bs.tooltip` event occurs). This is considered a "manual" triggering of the tooltip. + +{% highlight js %}$('#element').tooltip('toggle'){% endhighlight %} + +#### `.tooltip('dispose')` + +Hides and destroys an element's tooltip. Tooltips that use delegation (which are created using [the `selector` option](#options)) cannot be individually destroyed on descendant trigger elements. + +{% highlight js %}$('#element').tooltip('dispose'){% endhighlight %} + +#### `.tooltip('enable')` + +Gives an element's tooltip the ability to be shown. **Tooltips are enabled by default.** + +{% highlight js %}$('#element').tooltip('enable'){% endhighlight %} + +#### `.tooltip('disable')` + +Removes the ability for an element's tooltip to be shown. The tooltip will only be able to be shown if it is re-enabled. + +{% highlight js %}$('#element').tooltip('disable'){% endhighlight %} + +#### `.tooltip('toggleEnabled')` + +Toggles the ability for an element's tooltip to be shown or hidden. + +{% highlight js %}$('#element').tooltip('toggleEnabled'){% endhighlight %} + +#### `.tooltip('update')` + +Updates the position of an element's tooltip. + +{% highlight js %}$('#element').tooltip('update'){% endhighlight %} + +### Events + +<table class="table table-bordered table-striped"> + <thead> + <tr> + <th style="width: 150px;">Event Type</th> + <th>Description</th> + </tr> + </thead> + <tbody> + <tr> + <td>show.bs.tooltip</td> + <td>This event fires immediately when the <code>show</code> instance method is called.</td> + </tr> + <tr> + <td>shown.bs.tooltip</td> + <td>This event is fired when the tooltip has been made visible to the user (will wait for CSS transitions to complete).</td> + </tr> + <tr> + <td>hide.bs.tooltip</td> + <td>This event is fired immediately when the <code>hide</code> instance method has been called.</td> + </tr> + <tr> + <td>hidden.bs.tooltip</td> + <td>This event is fired when the tooltip has finished being hidden from the user (will wait for CSS transitions to complete).</td> + </tr> + <tr> + <td>inserted.bs.tooltip</td> + <td>This event is fired after the <code>show.bs.tooltip</code> event when the tooltip template has been added to the DOM.</td> + </tr> + </tbody> +</table> + +{% highlight js %} +$('#myTooltip').on('hidden.bs.tooltip', function () { + // do something... +}) +{% endhighlight %} |