diff --git a/docs/components/list-group.md b/docs/components/list-group.md index 0e06d3a7f2..3def6e7923 100644 --- a/docs/components/list-group.md +++ b/docs/components/list-group.md @@ -5,7 +5,7 @@ description: Learn about Bootstrap's list group component for rendering series o group: components --- -List groups are a flexible and powerful component for displaying not only simple lists of elements, but complex ones with custom content. +List groups are a flexible and powerful component for displaying a series of content. List group items can be modified and extended to support just about any content within. They can also be used as navigation with the right modifier class. ## Contents @@ -13,7 +13,7 @@ List groups are a flexible and powerful component for displaying not only simple {:toc} ## Basic example -The most basic list group is simply an unordered list with list items, and the proper classes. Build upon it with the options that follow, or your own CSS as needed. +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. {% example html %} {% endexample %} -## Badge +## Active items -Add badges to any list group item to show unread counts, activity, and more with the help of some utilities. Note the [`justify-content-between` utility class]({{ site.baseurl }}/layout/grid/#horizontal-alignment), the badge's placement, and the lack of a float and margin utilities on the badges. +Add `.active` to a `.list-group-item` to indicate the current active selection. -{% highlight html %} +{% example html %} -{% endhighlight %} - +{% endexample %} ## Disabled items -Add `.disabled` to a `.list-group-item` to gray it out to appear disabled. +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). {% example html %} -
- - Cras justo odio - - Dapibus ac facilisis in - Morbi leo risus - Porta ac consectetur ac - Vestibulum at eros -
+ {% endexample %} -## Anchors and buttons +## Links and buttons -Use anchors or buttons to create actionable list group items with hover, disabled, and active states by adding `.list-group-item-action`. This separate class contains a few overrides to add compatibility for ``s and ` - + {% endexample %} @@ -109,6 +101,27 @@ Use contextual classes to style list items, default or linked. Also includes `.a {% capture callout-include %}{% include callout-warning-color-assistive-technologies.md %}{% endcapture %} {{ callout-include | markdownify }} +## With badges + +Add badges to any list group item to show unread counts, activity, and more with the help of some utilities. Note the [`justify-content-between` utility class]({{ site.baseurl }}/layout/grid/#horizontal-alignment) and the badge's placement. + +{% example html %} + +{% endexample %} + ## Custom content Add nearly any HTML within, even for linked list groups like the one below. @@ -116,16 +129,16 @@ Add nearly any HTML within, even for linked list groups like the one below. {% example html %}
-
List group item heading
-

Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.

+
List group item heading
+ Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.
-
List group item heading
-

Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.

+
List group item heading
+ Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.
-
List group item heading
-

Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.

+
List group item heading
+ Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.
{% endexample %} diff --git a/scss/_list-group.scss b/scss/_list-group.scss index 4d78d95c0e..ec813c807e 100644 --- a/scss/_list-group.scss +++ b/scss/_list-group.scss @@ -12,6 +12,34 @@ } +// Interactive list items +// +// Use anchor or button elements instead of `li`s or `div`s to create interactive +// list items. Includes an extra `.active` modifier class for selected items. + +.list-group-item-action { + width: 100%; // For `