dropbutton.css

Dropbutton styles.

File

core/themes/olivero/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. .dropbutton-wrapper {
  12. --dropbutton--height: var(--sp1-5);
  13. --dropbutton--secondary-bg-color: var(--color--white);
  14. --dropbutton--active-bg-color: var(--color--gray-90);
  15. --dropbutton--outline-color: var(--color--primary-40); /* Minimum 3:1 contrast ratio against --dropbutton--active-bg-color and --dropbutton--secondary-bg-color. */
  16. --dropbutton--border-radius: var(--border-radius);
  17. --dropbutton--font-size: var(--font-size-s);
  18. --dropbutton--text-color: var(--color-text-neutral-medium); /* Minimum 4.5:1 contrast ratio against --dropbutton--active-bg-color and --dropbutton--secondary-bg-color. */
  19. --dropbutton--text-hover-color: var(--color-text-primary-medium); /* Minimum 4.5:1 contrast ratio against --dropbutton--active-bg-color and --dropbutton--secondary-bg-color. */
  20. &.open {
  21. position: relative;
  22. z-index: 100; /* Ensure this appears above all other dropbuttons. */
  23. filter: drop-shadow(0 2px 2px var(--dropbutton--active-bg-color));
  24. }
  25. }
  26. .dropbutton-widget {
  27. position: relative;
  28. width: max-content;
  29. height: var(--dropbutton--height);
  30. padding-inline-end: var(--dropbutton--height);
  31. border-radius: var(--dropbutton--border-radius);
  32. .dropbutton-single
  33. .dropbutton-wrapper.open
  34. }
  35. .dropbutton {
  36. height: var(--dropbutton--height);
  37. margin-block: 0;
  38. margin-inline-start: 0;
  39. padding-inline-start: 0;
  40. list-style: none;
  41. font-size: var(--dropbutton--font-size);
  42. }
  43. /* This is the button that expands/collapses the secondary options. */
  44. .dropbutton-toggle button {
  45. position: absolute;
  46. top: 0;
  47. inset-inline-end: 0;
  48. display: flex;
  49. align-items: center;
  50. justify-content: center;
  51. width: var(--dropbutton--height);
  52. height: var(--dropbutton--height);
  53. padding: 0;
  54. cursor: pointer;
  55. border-color: transparent;
  56. border-radius: 0 var(--border-radius) var(--border-radius) 0; /* LTR */
  57. background: var(--dropbutton--active-bg-color);
  58. &:focus {
  59. outline: solid 2px var(--dropbutton--outline-color);
  60. outline-offset: -2px;
  61. }
  62. &:dir(rtl) {
  63. border-radius: var(--dropbutton--border-radius) 0 0 var(--dropbutton--border-radius);
  64. }
  65. &::before {
  66. display: block;
  67. width: var(--sp0-5);
  68. height: var(--sp0-5);
  69. content: "";
  70. transform: translateY(-25%) rotate(45deg);
  71. border-right: solid 2px var(--dropbutton--outline-color);
  72. border-bottom: solid 2px var(--dropbutton--outline-color);
  73. }
  74. .dropbutton-wrapper.open
  75. }
  76. }
  77. /* This is the first
  78. element in the list of actions. */
  79. .dropbutton-action {
  80. &:first-child {
  81. margin-inline-end: 2px;
  82. border: solid 1px transparent;
  83. border-radius: var(--dropbutton--border-radius) 0 0 var(--dropbutton--border-radius); /* LTR */
  84. background: var(--dropbutton--active-bg-color);
  85. &:dir(rtl) {
  86. border: solid 1px transparent;
  87. border-radius: 0 var(--dropbutton--border-radius) var(--dropbutton--border-radius) 0;
  88. }
  89. }
  90. & a {
  91. display: flex;
  92. align-items: center;
  93. margin-bottom: -2px; /* Account for borders. */
  94. padding: 0 0.5625rem;
  95. -webkit-text-decoration: none;
  96. text-decoration: none;
  97. color: var(--dropbutton--text-color);
  98. font-weight: 600;
  99. &:hover {
  100. color: inherit;
  101. }
  102. &:focus {
  103. outline: solid 2px var(--dropbutton--outline-color);
  104. outline-offset: -1px; /* Overlap parent container by 1px. */
  105. }
  106. }
  107. /* Special rules if there is only one action. */
  108. .dropbutton-single
  109. }
  110. & a {
  111. justify-content: center;
  112. }
  113. }
  114. }
  115. /* These are the
  116. elements other than the first. */
  117. .secondary-action {
  118. visibility: hidden;
  119. width: calc(100% + var(--dropbutton--height));
  120. border-right: 1px solid var(--dropbutton--active-bg-color);
  121. border-left: 1px solid var(--dropbutton--active-bg-color);
  122. background: var(--dropbutton--secondary-bg-color);
  123. &:last-child {
  124. border-bottom: 1px solid var(--dropbutton--active-bg-color);
  125. }
  126. & a:hover {
  127. color: var(--dropbutton--text-hover-color);
  128. }
  129. .dropbutton-wrapper.open
  130. }

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