No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_dropdown.scss 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. // The dropdown wrapper (`<div>`)
  2. .dropup,
  3. .dropright,
  4. .dropdown,
  5. .dropleft {
  6. position: relative;
  7. }
  8. .dropdown-toggle {
  9. // Generate the caret automatically
  10. @include caret;
  11. }
  12. // The dropdown menu
  13. .dropdown-menu {
  14. position: absolute;
  15. top: 100%;
  16. left: 0;
  17. z-index: $zindex-dropdown;
  18. display: none; // none by default, but block on "open" of the menu
  19. float: left;
  20. min-width: $dropdown-min-width;
  21. padding: $dropdown-padding-y 0;
  22. margin: $dropdown-spacer 0 0; // override default ul
  23. font-size: $font-size-base; // Redeclare because nesting can cause inheritance issues
  24. color: $body-color;
  25. text-align: left; // Ensures proper alignment if parent has it changed (e.g., modal footer)
  26. list-style: none;
  27. background-color: $dropdown-bg;
  28. background-clip: padding-box;
  29. border: $dropdown-border-width solid $dropdown-border-color;
  30. @include border-radius($dropdown-border-radius);
  31. @include box-shadow($dropdown-box-shadow);
  32. }
  33. .dropdown-menu-right {
  34. right: 0;
  35. left: auto;
  36. }
  37. // Allow for dropdowns to go bottom up (aka, dropup-menu)
  38. // Just add .dropup after the standard .dropdown class and you're set.
  39. .dropup {
  40. .dropdown-menu {
  41. top: auto;
  42. bottom: 100%;
  43. margin-top: 0;
  44. margin-bottom: $dropdown-spacer;
  45. }
  46. .dropdown-toggle {
  47. @include caret(up);
  48. }
  49. }
  50. .dropright {
  51. .dropdown-menu {
  52. top: 0;
  53. right: auto;
  54. left: 100%;
  55. margin-top: 0;
  56. margin-left: $dropdown-spacer;
  57. }
  58. .dropdown-toggle {
  59. @include caret(right);
  60. &::after {
  61. vertical-align: 0;
  62. }
  63. }
  64. }
  65. .dropleft {
  66. .dropdown-menu {
  67. top: 0;
  68. right: 100%;
  69. left: auto;
  70. margin-top: 0;
  71. margin-right: $dropdown-spacer;
  72. }
  73. .dropdown-toggle {
  74. @include caret(left);
  75. &::before {
  76. vertical-align: 0;
  77. }
  78. }
  79. }
  80. // When enabled Popper.js, reset basic dropdown position
  81. // stylelint-disable no-duplicate-selectors
  82. .dropdown-menu {
  83. &[x-placement^="top"],
  84. &[x-placement^="right"],
  85. &[x-placement^="bottom"],
  86. &[x-placement^="left"] {
  87. right: auto;
  88. bottom: auto;
  89. }
  90. }
  91. // stylelint-enable no-duplicate-selectors
  92. // Dividers (basically an `<hr>`) within the dropdown
  93. .dropdown-divider {
  94. @include nav-divider($dropdown-divider-bg);
  95. }
  96. // Links, buttons, and more within the dropdown menu
  97. //
  98. // `<button>`-specific styles are denoted with `// For <button>s`
  99. .dropdown-item {
  100. display: block;
  101. width: 100%; // For `<button>`s
  102. padding: $dropdown-item-padding-y $dropdown-item-padding-x;
  103. clear: both;
  104. font-weight: $font-weight-normal;
  105. color: $dropdown-link-color;
  106. text-align: inherit; // For `<button>`s
  107. white-space: nowrap; // prevent links from randomly breaking onto new lines
  108. background-color: transparent; // For `<button>`s
  109. border: 0; // For `<button>`s
  110. @include hover-focus {
  111. color: $dropdown-link-hover-color;
  112. text-decoration: none;
  113. @include gradient-bg($dropdown-link-hover-bg);
  114. }
  115. &.active,
  116. &:active {
  117. color: $dropdown-link-active-color;
  118. text-decoration: none;
  119. @include gradient-bg($dropdown-link-active-bg);
  120. }
  121. &.disabled,
  122. &:disabled {
  123. color: $dropdown-link-disabled-color;
  124. background-color: transparent;
  125. // Remove CSS gradients if they're enabled
  126. @if $enable-gradients {
  127. background-image: none;
  128. }
  129. }
  130. }
  131. .dropdown-menu.show {
  132. display: block;
  133. }
  134. // Dropdown section headers
  135. .dropdown-header {
  136. display: block;
  137. padding: $dropdown-padding-y $dropdown-item-padding-x;
  138. margin-bottom: 0; // for use with heading elements
  139. font-size: $font-size-sm;
  140. color: $dropdown-header-color;
  141. white-space: nowrap; // as with > li > a
  142. }
  143. // Dropdown text
  144. .dropdown-item-text {
  145. display: block;
  146. padding: $dropdown-item-padding-y $dropdown-item-padding-x;
  147. color: $dropdown-link-color;
  148. }