dropbutton.pcss.css

Same filename in this branch
  1. 11.x core/misc/dialog/off-canvas/css/dropbutton.pcss.css
  2. 11.x core/themes/claro/css/components/dropbutton.pcss.css
Same filename and directory 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. 10 core/misc/dialog/off-canvas/css/dropbutton.pcss.css
  5. 10 core/themes/olivero/css/components/dropbutton.pcss.css
  6. 10 core/themes/claro/css/components/dropbutton.pcss.css

Dropbutton styles.

File

core/themes/olivero/css/components/dropbutton.pcss.css

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

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