dropbutton.pcss.css

Same filename in this branch
  1. 10 core/themes/olivero/css/components/dropbutton.pcss.css
  2. 10 core/themes/claro/css/components/dropbutton.pcss.css
Same filename in other branches
  1. 9 core/themes/olivero/css/components/dropbutton.pcss.css
  2. 9 core/themes/claro/css/components/dropbutton.pcss.css
  3. 8.9.x core/themes/claro/css/components/dropbutton.pcss.css
  4. 11.x core/misc/dialog/off-canvas/css/dropbutton.pcss.css
  5. 11.x core/themes/olivero/css/components/dropbutton.pcss.css
  6. 11.x core/themes/claro/css/components/dropbutton.pcss.css

Styles for dropbuttons in the off-canvas dialog.

@internal

File

core/misc/dialog/off-canvas/css/dropbutton.pcss.css

View source
  1. /**
  2. * @file
  3. * Styles for dropbuttons in the off-canvas dialog.
  4. *
  5. * @internal
  6. */
  7. #drupal-off-canvas-wrapper {
  8. --off-canvas-dropbutton-height: 24px;
  9. --off-canvas-dropbutton-primary-background-color: var(--off-canvas-button-background-color);
  10. --off-canvas-dropbutton-secondary-background-color: var(--off-canvas-button-hover-background-color);
  11. --off-canvas-dropbutton-border-color: transparent;
  12. --off-canvas-dropbutton-border-width: 1px;
  13. --off-canvas-dropbutton-border-radius: 2px;
  14. --off-canvas-dropbutton-focus-outline-color: var(--off-canvas-focus-outline-color);
  15. --off-canvas-dropbutton-font-size: 12px;
  16. --off-canvas-dropbutton-text-color: var(--off-canvas-button-text-color); /* Minimum 4.5:1 contrast ratio against --off-canvas-dropbutton-primary-background-color and --off-canvas-dropbutton-secondary-background-color. */
  17. --off-canvas-dropbutton-text-color-hover: var(--off-canvas-button-text-color-hover); /* Minimum 4.5:1 contrast ratio against --off-canvas-dropbutton-primary-background-color and --off-canvas-dropbutton-secondary-background-color. */
  18. & .dropbutton-wrapper {
  19. margin-block: var(--off-canvas-vertical-spacing-unit);
  20. /*
  21. * Styles for when the dropbutton is expanded.
  22. */
  23. &.open {
  24. position: relative;
  25. z-index: 100;
  26. & .secondary-action {
  27. visibility: visible;
  28. }
  29. & .dropbutton-widget {
  30. border-radius: var(--off-canvas-dropbutton-border-radius) var(--off-canvas-dropbutton-border-radius) 0 0;
  31. }
  32. & .dropbutton-toggle button::before {
  33. transform: translateY(25%) rotate(225deg);
  34. }
  35. }
  36. /*
  37. * Styles for single link variant of dropbutton.
  38. */
  39. &.dropbutton-single {
  40. & .dropbutton-widget {
  41. padding-inline-end: 0;
  42. }
  43. & .dropbutton-action {
  44. &:first-child {
  45. border-right: solid 1px var(--off-canvas-dropbutton-border-color); /* LTR */
  46. border-radius: var(--off-canvas-dropbutton-border-radius);
  47. &:dir(rtl) {
  48. border: solid 1px var(--off-canvas-dropbutton-border-color);
  49. }
  50. }
  51. & a {
  52. justify-content: center;
  53. }
  54. }
  55. }
  56. }
  57. & .dropbutton-widget {
  58. position: relative;
  59. width: max-content;
  60. max-width: 100%;
  61. height: var(--off-canvas-dropbutton-height);
  62. padding-inline-end: var(--off-canvas-dropbutton-height);
  63. border-radius: var(--off-canvas-dropbutton-border-radius);
  64. }
  65. & .dropbutton {
  66. height: var(--off-canvas-dropbutton-height);
  67. margin-block: 0;
  68. margin-inline-start: 0;
  69. padding-inline-start: 0;
  70. list-style: none;
  71. font-size: var(--off-canvas-dropbutton-font-size);
  72. }
  73. /* This is the button that expands/collapses the secondary options. */
  74. & .dropbutton-toggle {
  75. padding: 0;
  76. border: 0;
  77. & button {
  78. position: absolute;
  79. top: 0;
  80. display: flex;
  81. align-items: center;
  82. justify-content: center;
  83. width: var(--off-canvas-dropbutton-height);
  84. height: var(--off-canvas-dropbutton-height);
  85. padding: 0;
  86. cursor: pointer;
  87. border-color: var(--off-canvas-dropbutton-border-color);
  88. border-radius: 0 var(--border-radius) var(--border-radius) 0; /* LTR */
  89. background: var(--off-canvas-dropbutton-primary-background-color);
  90. inset-inline-end: 0;
  91. &:focus {
  92. outline: solid 2px var(--off-canvas-dropbutton-focus-outline-color);
  93. outline-offset: -2px;
  94. }
  95. &::before {
  96. display: block;
  97. width: 6px;
  98. height: 6px;
  99. content: "";
  100. transform: translateY(-25%) rotate(45deg);
  101. border-right: solid 2px var(--off-canvas-dropbutton-text-color);
  102. border-bottom: solid 2px var(--off-canvas-dropbutton-text-color);
  103. }
  104. &:dir(rtl) {
  105. border-radius: var(--off-canvas-dropbutton-border-radius) 0 0 var(--off-canvas-dropbutton-border-radius);
  106. }
  107. }
  108. }
  109. /* This is the first
  110. element in the list of actions. */
  111. & .dropbutton-action {
  112. &:first-child {
  113. margin-inline-end: 2px;
  114. border: solid var(--off-canvas-dropbutton-border-width) var(--off-canvas-dropbutton-border-color);
  115. border-radius: var(--off-canvas-dropbutton-border-radius) 0 0 var(--off-canvas-dropbutton-border-radius); /* LTR */
  116. background: var(--off-canvas-dropbutton-primary-background-color);
  117. &:dir(rtl) {
  118. border: solid var(--off-canvas-dropbutton-border-width) var(--off-canvas-dropbutton-border-color);
  119. border-radius: 0 var(--off-canvas-dropbutton-border-radius) var(--off-canvas-dropbutton-border-radius) 0;
  120. }
  121. }
  122. & a {
  123. display: flex;
  124. align-items: center;
  125. min-height: var(--off-canvas-dropbutton-height);
  126. margin-bottom: -2px;
  127. padding: 0 9px;
  128. text-decoration: none;
  129. color: var(--off-canvas-dropbutton-text-color);
  130. font-weight: 600;
  131. &:hover {
  132. color: var(--off-canvas-dropbutton-text-color);
  133. }
  134. &:focus {
  135. outline: solid 2px var(--off-canvas-dropbutton-focus-outline-color);
  136. outline-offset: -1px; /* Overlap parent container by 1px. */
  137. }
  138. }
  139. }
  140. /* These are the
  141. elements other than the first. */
  142. & .secondary-action {
  143. visibility: hidden;
  144. width: calc(100% + var(--off-canvas-dropbutton-height));
  145. margin-top: var(--off-canvas-dropbutton-border-width);
  146. border-right: var(--off-canvas-dropbutton-border-width) solid var(--off-canvas-dropbutton-border-color);
  147. border-left: var(--off-canvas-dropbutton-border-width) solid var(--off-canvas-dropbutton-border-color);
  148. background-color: var(--off-canvas-dropbutton-primary-background-color);
  149. &:last-child {
  150. border-bottom: var(--off-canvas-dropbutton-border-width) solid var(--off-canvas-dropbutton-border-color);
  151. }
  152. & a:hover {
  153. color: var(--off-canvas-dropbutton-text-color-hover);
  154. background-color: var(--off-canvas-dropbutton-secondary-background-color);
  155. }
  156. }
  157. }

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.