dropbutton.pcss.css

Same filename in this branch
  1. 10 core/misc/dialog/off-canvas/css/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

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. @nest .dropbutton-single
  27. @nest .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. &::before {
  57. display: block;
  58. width: var(--sp0-5);
  59. height: var(--sp0-5);
  60. content: "";
  61. transform: translateY(-25%) rotate(45deg);
  62. border-right: solid 2px var(--dropbutton--outline-color);
  63. border-bottom: solid 2px var(--dropbutton--outline-color);
  64. @nest .dropbutton-wrapper.open
  65. }
  66. &:dir(rtl) {
  67. border-radius: var(--dropbutton--border-radius) 0 0 var(--dropbutton--border-radius);
  68. }
  69. }
  70. /* This is the first
  71. element in the list of actions. */
  72. .dropbutton-action {
  73. &:first-child {
  74. margin-inline-end: 2px;
  75. border: solid 1px transparent;
  76. border-radius: var(--dropbutton--border-radius) 0 0 var(--dropbutton--border-radius); /* LTR */
  77. background: var(--dropbutton--active-bg-color);
  78. &:dir(rtl) {
  79. border: solid 1px transparent;
  80. border-radius: 0 var(--dropbutton--border-radius) var(--dropbutton--border-radius) 0;
  81. }
  82. }
  83. & a {
  84. display: flex;
  85. align-items: center;
  86. margin-bottom: -2px; /* Account for borders. */
  87. padding: 0 9px;
  88. text-decoration: none;
  89. color: var(--dropbutton--text-color);
  90. font-weight: 600;
  91. &:hover {
  92. color: inherit;
  93. }
  94. &:focus {
  95. outline: solid 2px var(--dropbutton--outline-color);
  96. outline-offset: -1px; /* Overlap parent container by 1px. */
  97. }
  98. }
  99. /* Special rules if there is only one action. */
  100. @nest .dropbutton-single
  101. }
  102. & a {
  103. justify-content: center;
  104. }
  105. }
  106. }
  107. /* These are the
  108. elements other than the first. */
  109. .secondary-action {
  110. visibility: hidden;
  111. width: calc(100% + var(--dropbutton--height));
  112. border-right: 1px solid var(--dropbutton--active-bg-color);
  113. border-left: 1px solid var(--dropbutton--active-bg-color);
  114. background: var(--dropbutton--secondary-bg-color);
  115. &:last-child {
  116. border-bottom: 1px solid var(--dropbutton--active-bg-color);
  117. }
  118. & a:hover {
  119. color: var(--dropbutton--text-hover-color);
  120. }
  121. @nest .dropbutton-wrapper.open
  122. }

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