dropbutton.css

Same filename in this branch
  1. 10 core/profiles/demo_umami/themes/umami/css/classy/components/dropbutton.css
  2. 10 core/misc/dialog/off-canvas/css/dropbutton.css
  3. 10 core/misc/dropbutton/dropbutton.css
  4. 10 core/themes/olivero/css/components/dropbutton.css
  5. 10 core/themes/stable9/css/core/dropbutton/dropbutton.css
  6. 10 core/themes/starterkit_theme/css/components/dropbutton.css
Same filename in other branches
  1. 9 core/profiles/demo_umami/themes/umami/css/classy/components/dropbutton.css
  2. 9 core/misc/dropbutton/dropbutton.css
  3. 9 core/themes/olivero/css/components/dropbutton.css
  4. 9 core/themes/stable9/css/core/dropbutton/dropbutton.css
  5. 9 core/themes/seven/css/classy/components/dropbutton.css
  6. 9 core/themes/claro/css/components/dropbutton.css
  7. 9 core/themes/bartik/css/classy/components/dropbutton.css
  8. 9 core/themes/stable/css/core/dropbutton/dropbutton.css
  9. 9 core/themes/starterkit_theme/css/components/dropbutton.css
  10. 9 core/themes/classy/css/components/dropbutton.css
  11. 8.9.x core/profiles/demo_umami/themes/umami/css/classy/components/dropbutton.css
  12. 8.9.x core/misc/dropbutton/dropbutton.css
  13. 8.9.x core/themes/seven/css/classy/components/dropbutton.css
  14. 8.9.x core/themes/claro/css/components/dropbutton.css
  15. 8.9.x core/themes/bartik/css/classy/components/dropbutton.css
  16. 8.9.x core/themes/stable/css/core/dropbutton/dropbutton.css
  17. 8.9.x core/themes/classy/css/components/dropbutton.css
  18. 11.x core/profiles/demo_umami/themes/umami/css/classy/components/dropbutton.css
  19. 11.x core/misc/dialog/off-canvas/css/dropbutton.css
  20. 11.x core/misc/dropbutton/dropbutton.css
  21. 11.x core/themes/olivero/css/components/dropbutton.css
  22. 11.x core/themes/stable9/css/core/dropbutton/dropbutton.css
  23. 11.x core/themes/claro/css/components/dropbutton.css
  24. 11.x core/themes/starterkit_theme/css/components/dropbutton.css

Dropbutton styles.

1. Transparent border is needed for high contrast mode. The border-width has to be set with !important to render borders with the defined width in high contrast mode Firefox.

File

core/themes/claro/css/components/dropbutton.css

View source
  1. /*
  2. * DO NOT EDIT THIS FILE.
  3. * See the following change record for more information,
  4. * https://www.drupal.org/node/3084859
  5. * @preserve
  6. */
  7. /**
  8. * @file
  9. * Dropbutton styles.
  10. *
  11. * 1. Transparent border is needed for high contrast mode. The border-width has
  12. * to be set with !important to render borders with the defined width in high
  13. * contrast mode Firefox.
  14. */
  15. :root {
  16. /**
  17. * Dropbutton
  18. */
  19. --dropbutton-spacing-size: var(--space-m);
  20. --dropbutton-font-size: var(--font-size-base);
  21. --dropbutton-line-height: var(--space-m);
  22. --dropbutton-toggle-size: 3rem;
  23. --dropbutton-border-size: 1px;
  24. --dropbutton-toggle-size-spacing: var(--dropbutton-border-size);
  25. --dropbutton-border-radius-size: 2px;
  26. --dropbutton-item-max-width: 12.5rem;
  27. /* Variant variables: small. */
  28. --dropbutton-small-spacing-size: 0.625rem;
  29. --dropbutton-small-font-size: var(--font-size-xs);
  30. --dropbutton-small-line-height: 0.75rem;
  31. --dropbutton-small-toggle-size: calc((2 * var(--dropbutton-small-spacing-size)) + var(--dropbutton-small-line-height));
  32. /* Variant variables: extra small. */
  33. --dropbutton-extrasmall-spacing-size: 0.375rem;
  34. --dropbutton-extrasmall-font-size: var(--font-size-xs);
  35. --dropbutton-extrasmall-line-height: 0.75rem;
  36. --dropbutton-extrasmall-toggle-size: calc((2 * var(--dropbutton-extrasmall-spacing-size)) + var(--dropbutton-extrasmall-line-height));
  37. }
  38. .dropbutton-wrapper {
  39. display: inline-flex;
  40. border-radius: var(--button-border-radius-size);
  41. box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  42. }
  43. .form-actions .dropbutton-wrapper,
  44. .field-actions .dropbutton-wrapper {
  45. margin-block: var(--space-xs);
  46. margin-inline: 0 var(--space-m);
  47. }
  48. .dropbutton-widget {
  49. position: relative;
  50. flex: 1 1 auto;
  51. }
  52. .js .dropbutton-wrapper.open .dropbutton-widget {
  53. z-index: var(--dropbutton-widget-z-index);
  54. }
  55. /**
  56. * Dropbutton list.
  57. */
  58. .dropbutton {
  59. display: block;
  60. overflow: visible;
  61. min-width: 6rem; /* Help mitigate long dropbutton text from obscuring other dropbuttons. */
  62. height: var(--dropbutton-toggle-size);
  63. margin: 0;
  64. list-style: none;
  65. }
  66. .dropbutton-widget {
  67. border-radius: var(--button-border-radius-size);
  68. background-color: var(--button-bg-color);
  69. }
  70. /* Variants. */
  71. .dropbutton--small {
  72. height: var(--dropbutton-small-toggle-size);
  73. }
  74. .dropbutton--extrasmall {
  75. height: var(--dropbutton-extrasmall-toggle-size);
  76. }
  77. /**
  78. * First dropbutton list item.
  79. */
  80. .dropbutton--multiple .dropbutton__item:first-of-type {
  81. margin-right: calc(var(--dropbutton-toggle-size) + var(--dropbutton-toggle-size-spacing)); /* LTR */
  82. white-space: nowrap;
  83. }
  84. [dir="rtl"] :is(.dropbutton--multiple .dropbutton__item:first-of-type) {
  85. margin-right: 0;
  86. margin-left: calc(var(--dropbutton-toggle-size) + var(--dropbutton-toggle-size-spacing));
  87. }
  88. /* First dropbutton list item variants */
  89. .no-touchevents .dropbutton--multiple.dropbutton--small .dropbutton__item:first-of-type {
  90. margin-right: calc(var(--dropbutton-small-toggle-size) + var(--dropbutton-toggle-size-spacing)); /* LTR */
  91. white-space: nowrap;
  92. }
  93. [dir="rtl"] :is(.no-touchevents .dropbutton--multiple.dropbutton--small .dropbutton__item:first-of-type) {
  94. margin-right: 0;
  95. margin-left: calc(var(--dropbutton-small-toggle-size) + var(--dropbutton-toggle-size-spacing));
  96. }
  97. .no-touchevents .dropbutton--multiple.dropbutton--extrasmall .dropbutton__item:first-of-type {
  98. margin-right: calc(var(--dropbutton-extrasmall-toggle-size) + var(--dropbutton-toggle-size-spacing)); /* LTR */
  99. white-space: nowrap;
  100. }
  101. [dir="rtl"] :is(.no-touchevents .dropbutton--multiple.dropbutton--extrasmall .dropbutton__item:first-of-type) {
  102. margin-right: 0;
  103. margin-left: calc(var(--dropbutton-extrasmall-toggle-size) + var(--dropbutton-toggle-size-spacing));
  104. }
  105. /**
  106. * Dropbutton toggler.
  107. */
  108. .dropbutton__toggle {
  109. position: absolute;
  110. z-index: 3;
  111. top: 0;
  112. right: 0; /* LTR */
  113. bottom: 0;
  114. width: var(--dropbutton-toggle-size);
  115. height: var(--dropbutton-toggle-size);
  116. border: var(--dropbutton-border-size) solid transparent !important; /* 1 */
  117. border-inline-start: var(--dropbutton-border-size) solid white !important;
  118. border-radius: 0 var(--button-border-radius-size) var(--button-border-radius-size) 0; /* LTR */
  119. background: var(--button-bg-color);
  120. font-size: 1px; /* iOS Safari sets a minimum button-width based on font-size. */
  121. appearance: none;
  122. }
  123. [dir="rtl"] .dropbutton__toggle {
  124. right: auto;
  125. left: 0;
  126. border-radius: var(--button-border-radius-size) 0 0 var(--button-border-radius-size);
  127. }
  128. .dropbutton__toggle::before {
  129. position: absolute;
  130. top: 50%;
  131. right: 50%;
  132. width: 0.875rem;
  133. height: 0.5625rem;
  134. content: "";
  135. transform: translate(50%, -50%) rotate(0);
  136. background: url("data:image/svg+xml,%3csvg width='14' height='9' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M.238 1.938L1.647.517 7 5.819 12.354.517l1.408 1.421L7 8.636z' fill='%23000f33'/%3e%3c/svg%3e") no-repeat center;
  137. background-size: contain;
  138. }
  139. /* Toggler states. */
  140. .dropbutton__toggle:hover {
  141. color: var(--button-fg-color);
  142. background-color: var(--button--hover-bg-color);
  143. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  144. }
  145. .dropbutton__toggle:focus {
  146. z-index: 2;
  147. }
  148. .dropbutton__toggle:active {
  149. color: var(--button-fg-color);
  150. background-color: var(--button--active-bg-color);
  151. }
  152. .dropbutton-wrapper.open .dropbutton__toggle::before {
  153. transform: translate(50%, -50%) rotate(180deg);
  154. }
  155. [dir="rtl"] :is(.dropbutton-wrapper.open .dropbutton__toggle::before) {
  156. transform: translate(50%, -50%) rotate(-180deg);
  157. }
  158. /* Toggler variants */
  159. .no-touchevents .dropbutton--small .dropbutton__toggle {
  160. width: var(--dropbutton-small-toggle-size);
  161. height: var(--dropbutton-small-toggle-size);
  162. }
  163. .no-touchevents .dropbutton--extrasmall .dropbutton__toggle {
  164. width: var(--dropbutton-extrasmall-toggle-size);
  165. height: var(--dropbutton-extrasmall-toggle-size);
  166. }
  167. .no-touchevents .dropbutton--small .dropbutton__toggle::before,
  168. .no-touchevents .dropbutton--extrasmall .dropbutton__toggle::before {
  169. width: 0.75rem; /* 12px */
  170. }
  171. /* High contrast. */
  172. @media (forced-colors: active) {
  173. /* Default. */
  174. .dropbutton__toggle::before {
  175. width: 0.5625rem;
  176. height: 0.5625rem;
  177. margin-top: calc(0.5625rem / (2 * -1.41429));
  178. transform: translate(50%, -50%) rotate(135deg); /* LTR */
  179. border-width: 0.125rem 0.125rem 0 0;
  180. border-style: solid;
  181. background: none;
  182. }
  183. .dropbutton-wrapper.open .dropbutton__toggle::before {
  184. margin-top: calc(0.5625rem / (2 * 1.41429));
  185. transform: translate(50%, -50%) rotate(315deg);
  186. }
  187. [dir="rtl"] .dropbutton-wrapper.open .dropbutton__toggle::before {
  188. transform: translate(50%, -50%) rotate(-45deg);
  189. }
  190. /* Variants */
  191. .no-touchevents .dropbutton--small .dropbutton__toggle::before,
  192. .no-touchevents .dropbutton--extrasmall .dropbutton__toggle::before {
  193. width: 0.4375rem;
  194. height: 0.4375rem;
  195. margin-top: calc(0.4375rem / (2 * -1.41429));
  196. }
  197. .dropbutton-wrapper.open .dropbutton__toggle::before {
  198. margin-top: calc(0.4375rem / (2 * 1.41429));
  199. }
  200. }
  201. /**
  202. * Item in the first dropbutton list item (that looks like a button).
  203. *
  204. * Duplicates base button styles.
  205. */
  206. .dropbutton__item:first-of-type > * {
  207. display: inline-block;
  208. margin: 0;
  209. padding: calc(var(--dropbutton-spacing-size) - var(--dropbutton-border-size)) calc(var(--space-l) - var(--dropbutton-border-size));
  210. cursor: pointer;
  211. text-align: center;
  212. -webkit-text-decoration: none;
  213. text-decoration: none;
  214. color: var(--button-fg-color);
  215. border: var(--dropbutton-border-size) solid transparent !important; /* 1 */
  216. border-radius: var(--button-border-radius-size);
  217. background-color: var(--button-bg-color);
  218. font-size: var(--dropbutton-font-size);
  219. font-weight: 700;
  220. line-height: var(--dropbutton-line-height);
  221. appearance: none;
  222. -webkit-font-smoothing: antialiased;
  223. }
  224. .dropbutton--multiple .dropbutton__item:first-of-type > * {
  225. padding-inline: calc(var(--dropbutton-spacing-size) - var(--dropbutton-border-size));
  226. }
  227. /* Variants */
  228. .no-touchevents .dropbutton--small .dropbutton__item:first-of-type > * {
  229. padding-block: calc(var(--dropbutton-small-spacing-size) - var(--dropbutton-border-size));
  230. font-size: var(--dropbutton-small-font-size);
  231. line-height: var(--dropbutton-small-line-height);
  232. }
  233. .no-touchevents .dropbutton--extrasmall .dropbutton__item:first-of-type > * {
  234. padding-top: calc(var(--dropbutton-extrasmall-spacing-size) - var(--dropbutton-border-size));
  235. padding-bottom: calc(var(--dropbutton-extrasmall-spacing-size) - var(--dropbutton-border-size));
  236. font-size: var(--dropbutton-extrasmall-font-size);
  237. line-height: var(--dropbutton-extrasmall-line-height);
  238. }
  239. .dropbutton__item:first-of-type > *:hover,
  240. .dropbutton__item:first-of-type > .button:hover {
  241. -webkit-text-decoration: none;
  242. text-decoration: none;
  243. color: var(--button-fg-color);
  244. background-color: var(--button--hover-bg-color);
  245. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  246. }
  247. .dropbutton__item:first-of-type > *:focus:hover,
  248. .dropbutton__item:first-of-type > .button:focus:hover {
  249. box-shadow:
  250. 0 0 0 2px var(--color-white),
  251. 0 0 0 5px var(--color-focus);
  252. }
  253. .dropbutton__item:first-of-type > *:focus {
  254. -webkit-text-decoration: none;
  255. text-decoration: none;
  256. }
  257. .dropbutton__item:first-of-type > *:active {
  258. color: var(--button-fg-color);
  259. background-color: var(--button--active-bg-color);
  260. }
  261. .dropbutton--multiple .dropbutton__item:first-of-type > * {
  262. position: relative;
  263. z-index: 3;
  264. }
  265. .dropbutton--multiple .dropbutton__item:first-of-type > *:focus {
  266. z-index: 2;
  267. }
  268. .dropbutton--multiple .dropbutton__item:first-of-type > * {
  269. border-radius: var(--button-border-radius-size) 0 0 var(--button-border-radius-size); /* LTR */
  270. }
  271. [dir="rtl"] .dropbutton--multiple .dropbutton__item:first-of-type > * {
  272. border-radius: 0 var(--button-border-radius-size) var(--button-border-radius-size) 0;
  273. }
  274. .dropbutton > .dropbutton__item > a,
  275. .dropbutton > .dropbutton__item > .button {
  276. display: block;
  277. box-sizing: border-box;
  278. width: 100%;
  279. margin: 0;
  280. text-align: left; /* LTR */
  281. }
  282. [dir="rtl"] .dropbutton > .dropbutton__item > a,
  283. [dir="rtl"] .dropbutton > .dropbutton__item > .button {
  284. text-align: right;
  285. }
  286. .dropbutton-wrapper:not(.open) .dropbutton__item:first-of-type ~ .dropbutton__item {
  287. visibility: hidden;
  288. /**
  289. * By setting a height of 1px, the dropbutton items are hidden
  290. * from view while still occupying minimal space, ensuring the layout remains intact.
  291. */
  292. height: 1px;
  293. }
  294. /**
  295. * Non-first dropbutton list elements.
  296. */
  297. .dropbutton__item:first-of-type ~ .dropbutton__item {
  298. border: var(--dropbutton-border-size) solid var(--color-gray-200);
  299. border-bottom: 0;
  300. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  301. }
  302. :is(.dropbutton__item:first-of-type ~ .dropbutton__item) ~ .dropbutton__item {
  303. border-top: 0;
  304. }
  305. .dropbutton__item ~ .dropbutton__item:last-child {
  306. border-bottom: var(--dropbutton-border-size) solid var(--color-gray-200);
  307. border-radius: 0 0 var(--dropbutton-border-radius-size) var(--dropbutton-border-radius-size);
  308. }
  309. /**
  310. * Dropbutton items of non-first dropbutton list elements.
  311. */
  312. .dropbutton__item:first-of-type ~ .dropbutton__item {
  313. max-width: var(--dropbutton-item-max-width);
  314. }
  315. .dropbutton__item:first-of-type ~ .dropbutton__item > a,
  316. .dropbutton__item:first-of-type ~ .dropbutton__item > .button {
  317. position: relative;
  318. padding: calc(var(--dropbutton-spacing-size) - var(--dropbutton-border-size));
  319. white-space: normal;
  320. -webkit-text-decoration: none;
  321. text-decoration: none;
  322. color: var(--color-gray-800);
  323. border: var(--dropbutton-border-size) solid transparent !important; /* 1 */
  324. border-radius: var(--dropbutton-border-radius-size);
  325. background: var(--color-white);
  326. box-shadow: 0;
  327. font-size: var(--dropbutton-font-size);
  328. font-weight: normal;
  329. line-height: var(--dropbutton-line-height);
  330. -webkit-font-smoothing: antialiased;
  331. }
  332. .dropbutton__item:first-of-type ~ .dropbutton__item > a:not(:focus),
  333. .dropbutton__item:first-of-type ~ .dropbutton__item > .button:not(:focus) {
  334. z-index: 1;
  335. }
  336. /* Variants. */
  337. .no-touchevents .dropbutton--small .dropbutton__item:first-of-type ~ .dropbutton__item > a,
  338. .no-touchevents .dropbutton--small .dropbutton__item:first-of-type ~ .dropbutton__item > .button {
  339. padding-top: var(--dropbutton-small-spacing-size);
  340. padding-bottom: var(--dropbutton-small-spacing-size);
  341. font-size: var(--dropbutton-small-font-size);
  342. line-height: var(--dropbutton-small-line-height);
  343. }
  344. .no-touchevents .dropbutton--extrasmall .dropbutton__item:first-of-type ~ .dropbutton__item > a,
  345. .no-touchevents .dropbutton--extrasmall .dropbutton__item:first-of-type ~ .dropbutton__item > .button {
  346. padding-top: var(--dropbutton-extrasmall-spacing-size);
  347. padding-bottom: var(--dropbutton-extrasmall-spacing-size);
  348. font-size: var(--dropbutton-extrasmall-font-size);
  349. line-height: var(--dropbutton-extrasmall-line-height);
  350. }
  351. /* States. */
  352. .dropbutton__item > *:focus {
  353. position: relative;
  354. z-index: 3;
  355. }
  356. .dropbutton__item:first-of-type ~ .dropbutton__item > *:hover {
  357. color: var(--color-text);
  358. background: var(--color-gray-050);
  359. }
  360. .dropbutton__item > .button:not(:focus) {
  361. box-shadow: none;
  362. }
  363. .dropbutton__item:first-of-type ~ .dropbutton__item > *:focus {
  364. border-color: var(--color-focus) !important; /* 1 */
  365. box-shadow:
  366. inset 0 0 0 1px var(--color-focus),
  367. 0 0 0 1px var(--color-focus);
  368. }

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