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.
 
 
 
 
 

225 lines
5.2 KiB

  1. // Make the div behave like a button
  2. .btn-group,
  3. .btn-group-vertical {
  4. position: relative;
  5. display: inline-block;
  6. vertical-align: middle; // match .btn alignment given font-size hack above
  7. > .btn {
  8. position: relative;
  9. float: left;
  10. // Bring the "active" button to the front
  11. &:focus,
  12. &:active,
  13. &.active {
  14. z-index: 2;
  15. }
  16. @include hover {
  17. z-index: 2;
  18. }
  19. }
  20. }
  21. // Prevent double borders when buttons are next to each other
  22. .btn-group {
  23. .btn + .btn,
  24. .btn + .btn-group,
  25. .btn-group + .btn,
  26. .btn-group + .btn-group {
  27. margin-left: -$input-btn-border-width;
  28. }
  29. }
  30. // Optional: Group multiple button groups together for a toolbar
  31. .btn-toolbar {
  32. margin-left: -5px; // Offset the first child's margin
  33. @include clearfix();
  34. .btn-group,
  35. .input-group {
  36. float: left;
  37. }
  38. > .btn,
  39. > .btn-group,
  40. > .input-group {
  41. margin-left: 5px;
  42. }
  43. }
  44. .btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) {
  45. border-radius: 0;
  46. }
  47. // Set corners individual because sometimes a single button can be in a .btn-group and we need :first-child and :last-child to both match
  48. .btn-group > .btn:first-child {
  49. margin-left: 0;
  50. &:not(:last-child):not(.dropdown-toggle) {
  51. @include border-right-radius(0);
  52. }
  53. }
  54. // Need .dropdown-toggle since :last-child doesn't apply given a .dropdown-menu immediately after it
  55. .btn-group > .btn:last-child:not(:first-child),
  56. .btn-group > .dropdown-toggle:not(:first-child) {
  57. @include border-left-radius(0);
  58. }
  59. // Custom edits for including btn-groups within btn-groups (useful for including dropdown buttons within a btn-group)
  60. .btn-group > .btn-group {
  61. float: left;
  62. }
  63. .btn-group > .btn-group:not(:first-child):not(:last-child) > .btn {
  64. border-radius: 0;
  65. }
  66. .btn-group > .btn-group:first-child:not(:last-child) {
  67. > .btn:last-child,
  68. > .dropdown-toggle {
  69. @include border-right-radius(0);
  70. }
  71. }
  72. .btn-group > .btn-group:last-child:not(:first-child) > .btn:first-child {
  73. @include border-left-radius(0);
  74. }
  75. // On active and open, don't show outline
  76. .btn-group .dropdown-toggle:active,
  77. .btn-group.open .dropdown-toggle {
  78. outline: 0;
  79. }
  80. // Sizing
  81. //
  82. // Remix the default button sizing classes into new ones for easier manipulation.
  83. .btn-group-sm > .btn { @extend .btn-sm; }
  84. .btn-group-lg > .btn { @extend .btn-lg; }
  85. //
  86. // Split button dropdowns
  87. //
  88. // Give the line between buttons some depth
  89. .btn-group > .btn + .dropdown-toggle {
  90. padding-right: 8px;
  91. padding-left: 8px;
  92. }
  93. .btn-group > .btn-lg + .dropdown-toggle {
  94. padding-right: 12px;
  95. padding-left: 12px;
  96. }
  97. // The clickable button for toggling the menu
  98. // Remove the gradient and set the same inset shadow as the :active state
  99. .btn-group.open .dropdown-toggle {
  100. @include box-shadow(inset 0 3px 5px rgba(0,0,0,.125));
  101. // Show no shadow for `.btn-link` since it has no other button styles.
  102. &.btn-link {
  103. @include box-shadow(none);
  104. }
  105. }
  106. // Reposition the caret
  107. .btn .caret {
  108. margin-left: 0;
  109. }
  110. // Carets in other button sizes
  111. .btn-lg .caret {
  112. border-width: $caret-width-lg $caret-width-lg 0;
  113. border-bottom-width: 0;
  114. }
  115. // Upside down carets for .dropup
  116. .dropup .btn-lg .caret {
  117. border-width: 0 $caret-width-lg $caret-width-lg;
  118. }
  119. //
  120. // Vertical button groups
  121. //
  122. .btn-group-vertical {
  123. > .btn,
  124. > .btn-group,
  125. > .btn-group > .btn {
  126. display: block;
  127. float: none;
  128. width: 100%;
  129. max-width: 100%;
  130. }
  131. // Clear floats so dropdown menus can be properly placed
  132. > .btn-group {
  133. @include clearfix();
  134. > .btn {
  135. float: none;
  136. }
  137. }
  138. > .btn + .btn,
  139. > .btn + .btn-group,
  140. > .btn-group + .btn,
  141. > .btn-group + .btn-group {
  142. margin-top: -$input-btn-border-width;
  143. margin-left: 0;
  144. }
  145. }
  146. .btn-group-vertical > .btn {
  147. &:not(:first-child):not(:last-child) {
  148. border-radius: 0;
  149. }
  150. &:first-child:not(:last-child) {
  151. border-top-right-radius: $btn-border-radius;
  152. @include border-bottom-radius(0);
  153. }
  154. &:last-child:not(:first-child) {
  155. border-bottom-left-radius: $btn-border-radius;
  156. @include border-top-radius(0);
  157. }
  158. }
  159. .btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn {
  160. border-radius: 0;
  161. }
  162. .btn-group-vertical > .btn-group:first-child:not(:last-child) {
  163. > .btn:last-child,
  164. > .dropdown-toggle {
  165. @include border-bottom-radius(0);
  166. }
  167. }
  168. .btn-group-vertical > .btn-group:last-child:not(:first-child) > .btn:first-child {
  169. @include border-top-radius(0);
  170. }
  171. // Checkbox and radio options
  172. //
  173. // In order to support the browser's form validation feedback, powered by the
  174. // `required` attribute, we have to "hide" the inputs via `clip`. We cannot use
  175. // `display: none;` or `visibility: hidden;` as that also hides the popover.
  176. // Simply visually hiding the inputs via `opacity` would leave them clickable in
  177. // certain cases which is prevented by using `clip` and `pointer-events`.
  178. // This way, we ensure a DOM element is visible to position the popover from.
  179. //
  180. // See https://github.com/twbs/bootstrap/pull/12794 and
  181. // https://github.com/twbs/bootstrap/pull/14559 for more information.
  182. [data-toggle="buttons"] {
  183. > .btn,
  184. > .btn-group > .btn {
  185. input[type="radio"],
  186. input[type="checkbox"] {
  187. position: absolute;
  188. clip: rect(0,0,0,0);
  189. pointer-events: none;
  190. }
  191. }
  192. }