Skip to content

Commit 9b8408a

Browse files
committed
docs: update documentation
1 parent 53a61a8 commit 9b8408a

File tree

16 files changed

+662
-290
lines changed

16 files changed

+662
-290
lines changed

docs/assets/scss/_component-examples.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@
324324
pre {
325325
padding: 0;
326326
margin-top: .625rem;
327+
margin-right: 1.875rem;
327328
margin-bottom: .625rem;
328329
white-space: pre;
329330
background-color: transparent;

docs/assets/scss/_content.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@
4242
}
4343

4444
thead {
45-
border-bottom: 2px solid currentColor;
45+
border-bottom: 2px solid currentcolor;
4646
}
4747

4848
tbody:not(:first-child) {
49-
border-top: 2px solid currentColor;
49+
border-top: 2px solid currentcolor;
5050
}
5151

5252
th,
@@ -92,7 +92,7 @@
9292
.bi {
9393
width: 1em;
9494
height: 1em;
95-
fill: currentColor;
95+
fill: currentcolor;
9696
}
9797

9898
.icon-link {

docs/content/components/carousel.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,4 +379,10 @@ myCarousel.addEventListener('slide.coreui.carousel', event => {
379379

380380
### SASS Variables
381381

382+
Variables for all carousels:
383+
382384
{{< scss-docs name="carousel-variables" file="scss/_variables.scss" >}}
385+
386+
Variables for the [dark carousel](#dark-variant):
387+
388+
{{< scss-docs name="carousel-dark-variables" file="scss/_variables.scss" >}}

docs/content/components/collapse.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ const collapseList = [...collapseElementList].map(collapseEl => new coreui.Colla
138138
{{< bs-table "table" >}}
139139
| Name | Type | Default | Description |
140140
| --- | --- | --- | --- |
141-
`parent` | selector, jQuery object, DOM element | `false` | 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 `card` class). The attribute has to be set on the target collapsible area. |
141+
`parent` | selector, jQuery object, DOM element | `null` | 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 `card` class). The attribute has to be set on the target collapsible area. |
142142
`toggle` | boolean | `true` | Toggles the collapsible element on invocation |
143143
{{< /bs-table >}}
144144

docs/content/components/dropdowns.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,11 +1039,11 @@ Regardless of whether you call your dropdown via JavaScript or instead use the d
10391039
| Name | Type | Default | Description |
10401040
| --- | --- | --- | --- |
10411041
| `autoClose` | boolean, string | `true` | Configure the auto close behavior of the dropdown: <ul class="my-2"><li>`true` - the dropdown will be closed by clicking outside or inside the dropdown menu.</li><li>`false` - the dropdown will be closed by clicking the toggle button and manually calling `hide` or `toggle` method. (Also will not be closed by pressing <kbd>esc</kbd> key)</li><li>`'inside'` - the dropdown will be closed (only) by clicking inside the dropdown menu.</li> <li>`'outside'` - the dropdown will be closed (only) by clicking outside the dropdown menu.</li></ul> Note: the dropdown can always be closed with the <kbd>ESC</kbd> key |
1042-
| `boundary` | string, element | `'scrollParent'` | Overflow constraint boundary of the dropdown menu (applies only to Popper's preventOverflow modifier). By default it's `clippingParents` and can accept an HTMLElement reference (via JavaScript only). For more information refer to Popper's [detectOverflow docs](https://popper.js.org/docs/v2/utils/detect-overflow/#boundary). |
1042+
| `boundary` | string, element | `'clippingParents'` | Overflow constraint boundary of the dropdown menu (applies only to Popper's preventOverflow modifier). By default it's `clippingParents` and can accept an HTMLElement reference (via JavaScript only). For more information refer to Popper's [detectOverflow docs](https://popper.js.org/docs/v2/utils/detect-overflow/#boundary). |
10431043
| `display` | string | `'dynamic'` | By default, we use Popper for dynamic positioning. Disable this with `static`. |
1044-
| `offset` | number, string, function | `[0, 2]` | Offset of the dropdown relative to its target. You can pass a string in data attributes with comma separated values like: `data-coreui-offset="10,20"`. When a function is used to determine the offset, it is called with an object containing the popper placement, the reference, and popper rects as its first argument. The triggering element DOM node is passed as the second argument. The function must return an array with two numbers: [skidding](https://popper.js.org/docs/v2/modifiers/offset/#skidding-1), [distance](https://popper.js.org/docs/v2/modifiers/offset/#distance-1). For more information refer to Popper's [offset docs](https://popper.js.org/docs/v2/modifiers/offset/#options). |
1044+
| `offset` | array, string, function | `[0, 2]` | Offset of the dropdown relative to its target. You can pass a string in data attributes with comma separated values like: `data-coreui-offset="10,20"`. When a function is used to determine the offset, it is called with an object containing the popper placement, the reference, and popper rects as its first argument. The triggering element DOM node is passed as the second argument. The function must return an array with two numbers: [skidding](https://popper.js.org/docs/v2/modifiers/offset/#skidding-1), [distance](https://popper.js.org/docs/v2/modifiers/offset/#distance-1). For more information refer to Popper's [offset docs](https://popper.js.org/docs/v2/modifiers/offset/#options). |
10451045
| `popperConfig` | null, object, function | `null` | To change CoreUI for Bootstrap's default Popper config, see [Popper's configuration](https://popper.js.org/docs/v2/constructors/#options). When a function is used to create the Popper configuration, it's called with an object that contains the CoreUI for Bootstrap's default Popper configuration. It helps you use and merge the default with your own configuration. The function must return a configuration object for Popper. |
1046-
| `reference` | string, element | `'toggle'` | Reference element of the dropdown menu. Accepts the values of `'toggle'`, `'parent'`, an HTMLElement reference or an object providing `getBoundingClientRect`. For more information refer to Popper's [constructor docs](https://popper.js.org/docs/v2/constructors/#createpopper) and [virtual element docs](https://popper.js.org/docs/v2/virtual-elements/). |
1046+
| `reference` | string, element, object | `'toggle'` | Reference element of the dropdown menu. Accepts the values of `'toggle'`, `'parent'`, an HTMLElement reference or an object providing `getBoundingClientRect`. For more information refer to Popper's [constructor docs](https://popper.js.org/docs/v2/constructors/#createpopper) and [virtual element docs](https://popper.js.org/docs/v2/virtual-elements/). |
10471047
{{< /bs-table >}}
10481048

10491049
#### Using function with `popperConfig`

docs/content/components/list-group.md

Lines changed: 14 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -422,60 +422,26 @@ To make tabs panel fade in, add `.fade` to each `.tab-pane`. The first tab pane
422422

423423
#### constructor
424424

425-
Activates a list item element and content container. Tab should have either a `data-coreui-target` or an `href` targeting a container node in the DOM.
426-
427-
```html
428-
<div class="list-group" id="myList" role="tablist">
429-
<a class="list-group-item list-group-item-action active" data-coreui-toggle="list" href="#home" role="tab">Home</a>
430-
<a class="list-group-item list-group-item-action" data-coreui-toggle="list" href="#profile" role="tab">Profile</a>
431-
<a class="list-group-item list-group-item-action" data-coreui-toggle="list" href="#messages" role="tab">Messages</a>
432-
<a class="list-group-item list-group-item-action" data-coreui-toggle="list" href="#settings" role="tab">Settings</a>
433-
</div>
434-
435-
<div class="tab-content">
436-
<div class="tab-pane active" id="home" role="tabpanel">...</div>
437-
<div class="tab-pane" id="profile" role="tabpanel">...</div>
438-
<div class="tab-pane" id="messages" role="tabpanel">...</div>
439-
<div class="tab-pane" id="settings" role="tabpanel">...</div>
440-
</div>
441-
442-
<script>
443-
const firstTabEl = document.querySelector('#myTab a:last-child')
444-
const firstTab = new coreui.Tab(firstTabEl)
445-
446-
firstTab.show()
447-
</script>
448-
```
449-
450-
#### show
451-
452-
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.coreui.tab` event occurs).
453-
454-
```js
455-
const tab = new coreui.Tab('#someListItem')
456-
457-
tab.show()
458-
```
459-
460-
#### dispose
461-
462-
Destroys an element's tab.
425+
{{< callout danger >}}
426+
{{< partial "callout-danger-async-methods.md" >}}
427+
{{< /callout >}}
463428

464-
#### getInstance
429+
Activates your content as a tab element.
465430

466-
*Static* method which allows you to get the tab instance associated with a DOM element
431+
You can create a tab instance with the constructor, for example:
467432

468433
```js
469-
const tab = coreui.Tab.getInstance('#trigger') // Returns a Bootstrap tab instance
434+
const cuiTab = new coreui.Tab('#myTab')
470435
```
471436

472-
#### getOrCreateInstance
473-
474-
*Static* method which allows you to get the tab instance associated with a DOM element, or create a new one in case it wasn't initialized
475-
476-
```js
477-
const tab = coreui.Tab.getOrCreateInstance('#trigger') // Returns a Bootstrap tab instance
478-
```
437+
{{< bs-table >}}
438+
| Method | Description |
439+
| --- | --- |
440+
| `dispose` | Destroys an element's tab. |
441+
| `getInstance` | *Static* method which allows you to get the tab instance associated with a DOM element, you can use it like this: `coreui.Tab.getInstance(element)`. |
442+
| `getOrCreateInstance` | *Static* method which allows you to get the tab instance associated with a DOM element, or create a new one in case it wasn't initialized You can use it like this: `coreui.Tab.getOrCreateInstance(element)`. |
443+
| `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.coreui.tab` event occurs). |
444+
{{< /bs-table >}}
479445

480446
### Events
481447

docs/content/components/navs-tabs.md

Lines changed: 10 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -598,69 +598,20 @@ To make tabs fade in, add `.fade` to each `.tab-pane`. The first tab pane must a
598598

599599
#### constructor
600600

601-
Activates a tab element and content container. Tab should have either a `data-coreui-target` or an `href` targeting a container node in the DOM.
602-
603-
```html
604-
<ul class="nav nav-tabs" id="myTab" role="tablist">
605-
<li class="nav-item" role="presentation">
606-
<button class="nav-link active" id="home-tab" data-coreui-toggle="tab" data-coreui-target="#home" type="button" role="tab" aria-controls="home" aria-selected="true">Home</button>
607-
</li>
608-
<li class="nav-item" role="presentation">
609-
<button class="nav-link" id="profile-tab" data-coreui-toggle="tab" data-coreui-target="#profile" type="button" role="tab" aria-controls="profile" aria-selected="false">Profile</button>
610-
</li>
611-
<li class="nav-item" role="presentation">
612-
<button class="nav-link" id="messages-tab" data-coreui-toggle="tab" data-coreui-target="#messages" type="button" role="tab" aria-controls="messages" aria-selected="false">Messages</button>
613-
</li>
614-
<li class="nav-item" role="presentation">
615-
<button class="nav-link" id="settings-tab" data-coreui-toggle="tab" data-coreui-target="#settings" type="button" role="tab" aria-controls="settings" aria-selected="false">Settings</button>
616-
</li>
617-
</ul>
618-
619-
<div class="tab-content">
620-
<div class="tab-pane active" id="home" role="tabpanel" aria-labelledby="home-tab" tabindex="0">...</div>
621-
<div class="tab-pane" id="profile" role="tabpanel" aria-labelledby="profile-tab" tabindex="0">...</div>
622-
<div class="tab-pane" id="messages" role="tabpanel" aria-labelledby="messages-tab" tabindex="0">...</div>
623-
<div class="tab-pane" id="settings" role="tabpanel" aria-labelledby="settings-tab" tabindex="0">...</div>
624-
</div>
625-
626-
<script>
627-
const firstTabEl = document.querySelector('#myTab li:last-child button')
628-
const firstTab = new coreui.Tab(firstTabEl)
629-
630-
firstTab.show()
631-
</script>
632-
```
633-
634-
#### show
635-
636-
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.coreui.tab` event occurs).
601+
You can create a tab instance with the constructor, for example:
637602

638603
```js
639-
const someTabTriggerEl = document.querySelector('#someTabTrigger')
640-
const tab = new coreui.Tab(someTabTriggerEl)
641-
642-
tab.show()
604+
const cuiTab = new coreui.Tab('#myTab')
643605
```
644606

645-
#### dispose
646-
647-
Destroys an element's tab.
648-
649-
#### getInstance
650-
651-
*Static* method which allows you to get the tab instance associated with a DOM element
652-
653-
```js
654-
const tab = coreui.Tab.getInstance('#trigger') // Returns a Bootstrap tab instance
655-
```
656-
657-
#### getOrCreateInstance
658-
659-
*Static* method which allows you to get the tab instance associated with a DOM element, or create a new one in case it wasn't initialized
660-
661-
```js
662-
const tab = coreui.Tab.getOrCreateInstance('#trigger') // Returns a Bootstrap tab instance
663-
```
607+
{{< bs-table >}}
608+
| Method | Description |
609+
| --- | --- |
610+
| `dispose` | Destroys an element's tab. |
611+
| `getInstance` | *Static* method which allows you to get the tab instance associated with a DOM element, you can use it like this: `coreui.Tab.getInstance(element)`. |
612+
| `getOrCreateInstance` | *Static* method which allows you to get the tab instance associated with a DOM element, or create a new one in case it wasn't initialized You can use it like this: `coreui.Tab.getOrCreateInstance(element)`. |
613+
| `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.coreui.tab` event occurs). |
614+
{{< /bs-table >}}
664615

665616
### Events
666617

docs/content/components/offcanvas.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,6 @@ You can use a link with the `href` attribute, or a button with the `data-coreui-
8080
</div>
8181
{{< /example >}}
8282

83-
### Dark offcanvas
84-
85-
Change the appearance of offcanvases with utilities to better match them to different contexts like dark navbars. Here we add `.text-bg-dark` to the `.offcanvas` and `.btn-close-white` to `.btn-close` for proper styling with a dark offcanvas. If you have dropdowns within, consider also adding `.dropdown-menu-dark` to `.dropdown-menu`.
86-
87-
{{< example class="docs-example-offcanvas p-0 bg-light overflow-hidden" >}}
88-
<div class="offcanvas offcanvas-start show text-bg-dark" tabindex="-1" id="offcanvasDark" aria-labelledby="offcanvasDarkLabel">
89-
<div class="offcanvas-header">
90-
<h5 class="offcanvas-title" id="offcanvasDarkLabel">Offcanvas</h5>
91-
<button type="button" class="btn-close btn-close-white" data-coreui-dismiss="offcanvasDark" aria-label="Close"></button>
92-
</div>
93-
<div class="offcanvas-body">
94-
<p>Place offcanvas content here.</p>
95-
</div>
96-
</div>
97-
{{< /example >}}
98-
9983
### Body scrolling
10084

10185
Scrolling the `<body>` element is disabled when an offcanvas and its backdrop are visible. Use the `data-coreui-scroll` attribute to enable `<body>` scrolling.
@@ -154,6 +138,24 @@ When backdrop is set to static, the offcanvas will not close when clicking outsi
154138
</div>
155139
{{< /example >}}
156140

141+
## Dark offcanvas
142+
143+
<small class="d-inline-flex px-2 py-1 fw-semibold text-success bg-success bg-opacity-10 rounded-2">Added in v4.2.2</small>
144+
145+
Change the appearance of offcanvases with utilities to better match them to different contexts like dark navbars. Here we add `.text-bg-dark` to the `.offcanvas` and `.btn-close-white` to `.btn-close` for proper styling with a dark offcanvas. If you have dropdowns within, consider also adding `.dropdown-menu-dark` to `.dropdown-menu`.
146+
147+
{{< example class="docs-example-offcanvas p-0 bg-light overflow-hidden" >}}
148+
<div class="offcanvas offcanvas-start show text-bg-dark" tabindex="-1" id="offcanvasDark" aria-labelledby="offcanvasDarkLabel">
149+
<div class="offcanvas-header">
150+
<h5 class="offcanvas-title" id="offcanvasDarkLabel">Offcanvas</h5>
151+
<button type="button" class="btn-close btn-close-white" data-coreui-dismiss="offcanvasDark" aria-label="Close"></button>
152+
</div>
153+
<div class="offcanvas-body">
154+
<p>Place offcanvas content here.</p>
155+
</div>
156+
</div>
157+
{{< /example >}}
158+
157159
## Responsive
158160

159161
<small class="d-inline-flex px-2 py-1 fw-semibold text-success bg-success bg-opacity-10 rounded-2">Added in v4.2.2</small>

0 commit comments

Comments
 (0)