설명 없음
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.

_button-group.scss 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. // stylelint-disable selector-no-qualifying-type
  2. // Make the div behave like a button
  3. .btn-group,
  4. .btn-group-vertical {
  5. position: relative;
  6. display: inline-flex;
  7. vertical-align: middle; // match .btn alignment given font-size hack above
  8. > .btn {
  9. position: relative;
  10. flex: 0 1 auto;
  11. // Bring the hover, focused, and "active" buttons to the front to overlay
  12. // the borders properly
  13. @include hover {
  14. z-index: 1;
  15. }
  16. &:focus,
  17. &:active,
  18. &.active {
  19. z-index: 1;
  20. }
  21. }
  22. // Prevent double borders when buttons are next to each other
  23. .btn + .btn,
  24. .btn + .btn-group,
  25. .btn-group + .btn,
  26. .btn-group + .btn-group {
  27. margin-left: -$btn-border-width;
  28. }
  29. }
  30. // Optional: Group multiple button groups together for a toolbar
  31. .btn-toolbar {
  32. display: flex;
  33. flex-wrap: wrap;
  34. justify-content: flex-start;
  35. .input-group {
  36. width: auto;
  37. }
  38. }
  39. .btn-group {
  40. > .btn:first-child {
  41. margin-left: 0;
  42. }
  43. // Reset rounded corners
  44. > .btn:not(:last-child):not(.dropdown-toggle),
  45. > .btn-group:not(:last-child) > .btn {
  46. @include border-right-radius(0);
  47. }
  48. > .btn:not(:first-child),
  49. > .btn-group:not(:first-child) > .btn {
  50. @include border-left-radius(0);
  51. }
  52. }
  53. // Sizing
  54. //
  55. // Remix the default button sizing classes into new ones for easier manipulation.
  56. .btn-group-sm > .btn { @extend .btn-sm; }
  57. .btn-group-lg > .btn { @extend .btn-lg; }
  58. //
  59. // Split button dropdowns
  60. //
  61. .dropdown-toggle-split {
  62. padding-right: $btn-padding-x * .75;
  63. padding-left: $btn-padding-x * .75;
  64. &::after,
  65. .dropup &::after,
  66. .dropright &::after {
  67. margin-left: 0;
  68. }
  69. .dropleft &::before {
  70. margin-right: 0;
  71. }
  72. }
  73. .btn-sm + .dropdown-toggle-split {
  74. padding-right: $btn-padding-x-sm * .75;
  75. padding-left: $btn-padding-x-sm * .75;
  76. }
  77. .btn-lg + .dropdown-toggle-split {
  78. padding-right: $btn-padding-x-lg * .75;
  79. padding-left: $btn-padding-x-lg * .75;
  80. }
  81. // The clickable button for toggling the menu
  82. // Set the same inset shadow as the :active state
  83. .btn-group.show .dropdown-toggle {
  84. @include box-shadow($btn-active-box-shadow);
  85. // Show no shadow for `.btn-link` since it has no other button styles.
  86. &.btn-link {
  87. @include box-shadow(none);
  88. }
  89. }
  90. //
  91. // Vertical button groups
  92. //
  93. .btn-group-vertical {
  94. flex-direction: column;
  95. align-items: flex-start;
  96. justify-content: center;
  97. .btn,
  98. .btn-group {
  99. width: 100%;
  100. }
  101. > .btn + .btn,
  102. > .btn + .btn-group,
  103. > .btn-group + .btn,
  104. > .btn-group + .btn-group {
  105. margin-top: -$btn-border-width;
  106. margin-left: 0;
  107. }
  108. // Reset rounded corners
  109. > .btn:not(:last-child):not(.dropdown-toggle),
  110. > .btn-group:not(:last-child) > .btn {
  111. @include border-bottom-radius(0);
  112. }
  113. > .btn:not(:first-child),
  114. > .btn-group:not(:first-child) > .btn {
  115. @include border-top-radius(0);
  116. }
  117. }
  118. // Checkbox and radio options
  119. //
  120. // In order to support the browser's form validation feedback, powered by the
  121. // `required` attribute, we have to "hide" the inputs via `clip`. We cannot use
  122. // `display: none;` or `visibility: hidden;` as that also hides the popover.
  123. // Simply visually hiding the inputs via `opacity` would leave them clickable in
  124. // certain cases which is prevented by using `clip` and `pointer-events`.
  125. // This way, we ensure a DOM element is visible to position the popover from.
  126. //
  127. // See https://github.com/twbs/bootstrap/pull/12794 and
  128. // https://github.com/twbs/bootstrap/pull/14559 for more information.
  129. .btn-group-toggle {
  130. > .btn,
  131. > .btn-group > .btn {
  132. margin-bottom: 0; // Override default `<label>` value
  133. input[type="radio"],
  134. input[type="checkbox"] {
  135. position: absolute;
  136. clip: rect(0, 0, 0, 0);
  137. pointer-events: none;
  138. }
  139. }
  140. }