From ec429d98f4e33a01763337e9ddb346d14c3fc4a1 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Mon, 13 Jul 2020 21:57:10 -0700 Subject: [PATCH 1/7] Rewrite JS options, methods, and events in Markdown --- site/content/docs/5.0/components/alerts.md | 69 +---- site/content/docs/5.0/components/buttons.md | 32 +- site/content/docs/5.0/components/carousel.md | 137 ++------- site/content/docs/5.0/components/collapse.md | 103 ++----- site/content/docs/5.0/components/dropdowns.md | 169 ++--------- site/content/docs/5.0/components/modal.md | 141 ++------- site/content/docs/5.0/components/popovers.md | 282 +++--------------- site/content/docs/5.0/components/scrollspy.md | 89 ++---- site/content/docs/5.0/components/toasts.md | 104 ++----- site/content/docs/5.0/components/tooltips.md | 272 +++-------------- 10 files changed, 257 insertions(+), 1141 deletions(-) diff --git a/site/content/docs/5.0/components/alerts.md b/site/content/docs/5.0/components/alerts.md index f35a044ae..aaa306169 100644 --- a/site/content/docs/5.0/components/alerts.md +++ b/site/content/docs/5.0/components/alerts.md @@ -103,40 +103,13 @@ 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.) - - - - - - - - - - - - - - - - - - - - - -
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) -
+{{< bs-table "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, you can use it like this: `bootstrap.Alert.getInstance(alert)`. | +{{< /bs-table >}} ```js var alertNode = document.querySelector('.alert') @@ -148,28 +121,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 "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.0/components/buttons.md b/site/content/docs/5.0/components/buttons.md index be2bc3e70..be8b5661f 100644 --- a/site/content/docs/5.0/components/buttons.md +++ b/site/content/docs/5.0/components/buttons.md @@ -169,32 +169,12 @@ 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) -
+{{< bs-table "table bs-js-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) | +{{< /bs-table >}} For example, to toggle all buttons diff --git a/site/content/docs/5.0/components/carousel.md b/site/content/docs/5.0/components/carousel.md index 85ee9eb44..a4da7f2e8 100644 --- a/site/content/docs/5.0/components/carousel.md +++ b/site/content/docs/5.0/components/carousel.md @@ -272,55 +272,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.

slidestring | booleanfalseAutoplays the carousel after the user manually cycles the first item. If "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 "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. | +| `slide` | string, boolean | `false` | Autoplays the carousel after the user manually cycles the first item. If `"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 @@ -338,48 +299,18 @@ 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)
getInstanceStatic method which allows you to get the carousel instance associated with a DOM element.
+{{< bs-table "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 with a DOM element. | +{{< /bs-table >}} ### Events @@ -392,24 +323,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 `