diff --git a/site/assets/scss/_content.scss b/site/assets/scss/_content.scss index e79108fc69c9..e8ec8ac1501e 100644 --- a/site/assets/scss/_content.scss +++ b/site/assets/scss/_content.scss @@ -31,15 +31,12 @@ } // Override Bootstrap defaults - > .table { - max-width: 100%; + > .table, + > .table-responsive .table { margin-bottom: 1.5rem; @include font-size(.875rem); @include media-breakpoint-down(lg) { - display: block; - overflow-x: auto; - &.table-bordered { border: 0; } @@ -61,6 +58,7 @@ } // Prevent breaking of code + // stylelint-disable-next-line selector-max-compound-selectors td:first-child > code { white-space: nowrap; } diff --git a/site/content/docs/5.1/components/alerts.md b/site/content/docs/5.1/components/alerts.md index 68a18be7ada8..32df609f5b82 100644 --- a/site/content/docs/5.1/components/alerts.md +++ b/site/content/docs/5.1/components/alerts.md @@ -209,53 +209,29 @@ See the [triggers](#triggers) section for more details. ### Methods - - - - - - - - - - - - - - - - - - - - - - - - - -
MethodDescription
- 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. -
- dispose - - Destroys an element's alert. (Removes stored data on the DOM element) -
- getInstance - - Static method which allows you to get the alert instance associated to a DOM element, you can use it like this: bootstrap.Alert.getInstance(alert) -
- getOrCreateInstance - - Static method which returns an alert instance associated to a DOM element or create a new one in case it wasn't initialized. - You can use it like this: bootstrap.Alert.getOrCreateInstance(element) -
+You can create an alert instance with the alert constructor, for example: + +```js +var myAlert = document.getElementById('myAlert') +var bsAlert = new bootstrap.Alert(myAlert) +``` + +This makes an alert listen for click events on descendant elements which have the `data-bs-dismiss="alert"` attribute. (Not necessary when using the data-api’s auto-initialization.) + +{{< bs-table >}} +| Method | Description | +| --- | --- | +| `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. | +| `dispose` | Destroys an element's alert. (Removes stored data on the DOM element) | +| `getInstance` | Static method which allows you to get the alert instance associated to a DOM element. For example: `bootstrap.Alert.getInstance(alert)`. | +| `getOrCreateInstance` | Static method which returns an alert instance associated to a DOM element or create a new one in case it wasn't initialized. You can use it like this: bootstrap.Alert.getOrCreateInstance(element). | +{{< /bs-table >}} + +Basic usage: ```js var alertNode = document.querySelector('.alert') -var alert = bootstrap.Alert.getInstance(alertNode) +var alert = bootstrap.Alert.getOrCreateInstance(alertNode) alert.close() ``` @@ -263,28 +239,12 @@ alert.close() Bootstrap's alert plugin exposes a few events for hooking into alert functionality. - - - - - - - - - - - - - - - - - -
EventDescription
close.bs.alert - Fires immediately when the close instance method is called. -
closed.bs.alert - Fired when the alert has been closed and CSS transitions have completed. -
+{{< bs-table >}} +| Event | Description | +| --- | --- | +| `close.bs.alert` | Fires immediately when the `close` instance method is called. | +| `closed.bs.alert` | Fired when the alert has been closed and CSS transitions have completed. | +{{< /bs-table >}} ```js var myAlert = document.getElementById('myAlert') diff --git a/site/content/docs/5.1/components/buttons.md b/site/content/docs/5.1/components/buttons.md index 7f400df1a19f..bacc6b23d2f1 100644 --- a/site/content/docs/5.1/components/buttons.md +++ b/site/content/docs/5.1/components/buttons.md @@ -184,49 +184,14 @@ var button = document.getElementById('myButton') var bsButton = new bootstrap.Button(button) ``` - - - - - - - - - - - - - - - - - - - - - - - - - -
MethodDescription
- toggle - - Toggles push state. Gives the button the appearance that it has been activated. -
- dispose - - Destroys an element's button. (Removes stored data on the DOM element) -
- getInstance - - Static method which allows you to get the button instance associated to a DOM element, you can use it like this: bootstrap.Button.getInstance(element) -
- getOrCreateInstance - - Static method which returns a button instance associated to a DOM element or create a new one in case it wasn't initialized. - You can use it like this: bootstrap.Button.getOrCreateInstance(element) -
+{{< bs-table "table" >}} +| Method | Description | +| --- | --- | +| `toggle` | Toggles push state. Gives the button the appearance that it has been activated. | +| `dispose` | Destroys an element's button. (Removes stored data on the DOM element) | +| `getInstance` | Static method which allows you to get the button instance associated to a DOM element, you can use it like this: `bootstrap.Button.getInstance(element)`| +| `getOrCreateInstance` | Static method which returns a button instance associated to a DOM element or create a new one in case it wasn't initialized. You can use it like this: `bootstrap.Button.getOrCreateInstance(element)` | +{{< /bs-table >}} For example, to toggle all buttons diff --git a/site/content/docs/5.1/components/carousel.md b/site/content/docs/5.1/components/carousel.md index c7f710893940..86de96a074e3 100644 --- a/site/content/docs/5.1/components/carousel.md +++ b/site/content/docs/5.1/components/carousel.md @@ -310,55 +310,16 @@ var carousel = new bootstrap.Carousel(myCarousel) Options can be passed via data attributes or JavaScript. For data attributes, append the option name to `data-bs-`, as in `data-bs-interval=""`. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDefaultDescription
intervalnumber5000The amount of time to delay between automatically cycling an item. If false, carousel will not automatically cycle.
keyboardbooleantrueWhether the carousel should react to keyboard events.
pausestring | boolean'hover'

If set to 'hover', pauses the cycling of the carousel on mouseenter and resumes the cycling of the carousel on mouseleave. If set to false, hovering over the carousel won't pause it.

-

On touch-enabled devices, when set to 'hover', cycling will pause on touchend (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.

ridestring | booleanfalseAutoplays the carousel after the user manually cycles the first item. If set to 'carousel', autoplays the carousel on load.
wrapbooleantrueWhether the carousel should cycle continuously or have hard stops.
touchbooleantrueWhether the carousel should support left/right swipe interactions on touchscreen devices.
+{{< bs-table >}} +| Name | Type | Default | Description | +| --- | --- | --- | --- | +| `interval` | number | `5000` | The amount of time to delay between automatically cycling an item. If `false`, carousel will not automatically cycle. | +| `keyboard` | boolean | `true` | Whether the carousel should react to keyboard events. | +| `pause` | string, boolean | `"hover"` | If set to `"hover"`, pauses the cycling of the carousel on `mouseenter` and resumes the cycling of the carousel on `mouseleave`. If set to `false`, hovering over the carousel won't pause it. On touch-enabled devices, when set to `"hover"`, cycling will pause on `touchend` (once the user finished interacting with the carousel) for two intervals, before automatically resuming. This is in addition to the mouse behavior. | +| `ride` | string, boolean | `false` | Autoplays the carousel after the user manually cycles the first item. If set to`"carousel"`, autoplays the carousel on load. | +| `wrap` | boolean | `true` | Whether the carousel should cycle continuously or have hard stops. | +| `touch` | boolean | `true` | Whether the carousel should support left/right swipe interactions on touchscreen devices. | +{{< /bs-table >}} ### Methods @@ -376,61 +337,19 @@ var carousel = new bootstrap.Carousel(myCarousel, { }) ``` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MethodDescription
cycleCycles through the carousel items from left to right.
pauseStops the carousel from cycling through items.
prevCycles to the previous item. Returns to the caller before the previous item has been shown (e.g., before the slid.bs.carousel event occurs).
nextCycles to the next item. Returns to the caller before the next item has been shown (e.g., before the slid.bs.carousel event occurs).
nextWhenVisibleDon't cycle carousel to next when the page isn't visible or the carousel or its parent isn't visible. Returns to the caller before the target item has been shown -
toCycles the carousel to a particular frame (0 based, similar to an array). Returns to the caller before the target item has been shown (e.g., before the slid.bs.carousel event occurs).
disposeDestroys an element's carousel. (Removes stored data on the DOM element)
- getInstance - - Static method which allows you to get the carousel instance associated to a DOM element, you can use it like this: bootstrap.Carousel.getInstance(element) -
- getOrCreateInstance - - Static method which returns a carousel instance associated to a DOM element or create a new one in case it wasn't initialized. - You can use it like this: bootstrap.Carousel.getOrCreateInstance(element) -
+{{< bs-table >}} +| Method | Description | +| --- | --- | +| `cycle` | Cycles through the carousel items from left to right. | +| `pause` | Stops the carousel from cycling through items. | +| `prev` | Cycles to the previous item. **Returns to the caller before the previous item has been shown** (e.g., before the `slid.bs.carousel` event occurs). | +| `next` | Cycles to the next item. **Returns to the caller before the next item has been shown** (e.g., before the `slid.bs.carousel` event occurs). | +| `nextWhenVisible` | Don't cycle carousel to next when the page isn't visible or the carousel or its parent isn't visible. **Returns to the caller before the target item has been shown** | +| `to` | Cycles the carousel to a particular frame (0 based, similar to an array). **Returns to the caller before the target item has been shown** (e.g., before the `slid.bs.carousel` event occurs). | +| `dispose` | Destroys an element's carousel. (Removes stored data on the DOM element) | +| `getInstance` | Static method which allows you to get the carousel instance associated to a DOM element, you can use it like this: `bootstrap.Carousel.getInstance(element)` | +| `getOrCreateInstance` | Static method which returns a carousel instance associated to a DOM element or create a new one in case it wasn't initialized. You can use it like this: `bootstrap.Carousel.getOrCreateInstance(element)` | +{{< /bs-table >}} ### Events @@ -443,24 +362,12 @@ Bootstrap's carousel class exposes two events for hooking into carousel function All carousel events are fired at the carousel itself (i.e. at the `