_list-group.scss 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. // Base class
  2. //
  3. // Easily usable on <ul>, <ol>, or <div>.
  4. .list-group {
  5. // No need to set list-style: none; since .list-group-item is block level
  6. padding-left: 0; // reset padding because ul and ol
  7. margin-bottom: 0;
  8. }
  9. // Individual list items
  10. //
  11. // Use on `li`s or `div`s within the `.list-group` parent.
  12. .list-group-item {
  13. position: relative;
  14. display: block;
  15. padding: .75rem 1.25rem;
  16. // Place the border on the list items and negative margin up for better styling
  17. margin-bottom: -$list-group-border-width;
  18. background-color: $list-group-bg;
  19. border: $list-group-border-width solid $list-group-border-color;
  20. // Round the first and last items
  21. &:first-child {
  22. @include border-top-radius($list-group-border-radius);
  23. }
  24. &:last-child {
  25. margin-bottom: 0;
  26. @include border-bottom-radius($list-group-border-radius);
  27. }
  28. }
  29. .list-group-flush {
  30. .list-group-item {
  31. border-width: $list-group-border-width 0;
  32. border-radius: 0;
  33. }
  34. &:first-child {
  35. .list-group-item:first-child {
  36. border-top: 0;
  37. }
  38. }
  39. &:last-child {
  40. .list-group-item:last-child {
  41. border-bottom: 0;
  42. }
  43. }
  44. }
  45. // Interactive list items
  46. //
  47. // Use anchor or button elements instead of `li`s or `div`s to create interactive
  48. // list items. Includes an extra `.active` modifier class for selected items.
  49. a.list-group-item,
  50. button.list-group-item {
  51. width: 100%;
  52. color: $list-group-link-color;
  53. text-align: inherit;
  54. .list-group-item-heading {
  55. color: $list-group-link-heading-color;
  56. }
  57. // Hover state
  58. @include hover-focus {
  59. color: $list-group-link-hover-color;
  60. text-decoration: none;
  61. background-color: $list-group-hover-bg;
  62. }
  63. }
  64. .list-group-item {
  65. // Disabled state
  66. &.disabled {
  67. @include plain-hover-focus {
  68. color: $list-group-disabled-color;
  69. cursor: $cursor-disabled;
  70. background-color: $list-group-disabled-bg;
  71. // Force color to inherit for custom content
  72. .list-group-item-heading {
  73. color: inherit;
  74. }
  75. .list-group-item-text {
  76. color: $list-group-disabled-text-color;
  77. }
  78. }
  79. }
  80. // Active class on item itself, not parent
  81. &.active {
  82. @include plain-hover-focus {
  83. z-index: 2; // Place active items above their siblings for proper border styling
  84. color: $list-group-active-color;
  85. background-color: $list-group-active-bg;
  86. border-color: $list-group-active-border;
  87. // Force color to inherit for custom content
  88. .list-group-item-heading,
  89. .list-group-item-heading > small,
  90. .list-group-item-heading > .small {
  91. color: inherit;
  92. }
  93. .list-group-item-text {
  94. color: $list-group-active-text-color;
  95. }
  96. }
  97. }
  98. }
  99. // Contextual variants
  100. //
  101. // Add modifier classes to change text and background color on individual items.
  102. // Organizationally, this must come after the `:hover` states.
  103. @include list-group-item-variant(success, $state-success-bg, $state-success-text);
  104. @include list-group-item-variant(info, $state-info-bg, $state-info-text);
  105. @include list-group-item-variant(warning, $state-warning-bg, $state-warning-text);
  106. @include list-group-item-variant(danger, $state-danger-bg, $state-danger-text);
  107. // Custom content options
  108. //
  109. // Extra classes for creating well-formatted content within `.list-group-item`s.
  110. .list-group-item-heading {
  111. margin-top: 0;
  112. margin-bottom: 5px;
  113. }
  114. .list-group-item-text {
  115. margin-bottom: 0;
  116. line-height: 1.3;
  117. }