admin-toolbar.pcss.css

Same filename in other branches
  1. 11.x core/modules/navigation/css/components/admin-toolbar.pcss.css

Admin Toolbar styles.

File

core/modules/navigation/css/components/admin-toolbar.pcss.css

View source
  1. /* cspell:ignore csvg cpath */
  2. /**
  3. * @file
  4. * Admin Toolbar styles.
  5. */
  6. @import "../base/media-queries.pcss.css";
  7. /**
  8. * Sidebar width is attached to the element because it's used as a
  9. * fallback value to the margin-inline-start property of the layout container.
  10. */
  11. body {
  12. --admin-toolbar-sidebar-width: calc(4.5 * var(--admin-toolbar-rem));
  13. --admin-toolbar-sidebar-header: calc(3.5 * var(--admin-toolbar-rem));
  14. [data-admin-toolbar="expanded"]
  15. }
  16. }
  17. /* We apply transitions after page load to avoid shifts. */
  18. [data-admin-toolbar-transitions] {
  19. .admin-toolbar {
  20. transition: transform var(--admin-toolbar-transition);
  21. @media (--admin-toolbar-desktop) {
  22. transition: width var(--admin-toolbar-transition);
  23. ~ .dialog-off-canvas-main-canvas {
  24. transition: margin-inline-start var(--admin-toolbar-transition);
  25. }
  26. }
  27. }
  28. }
  29. /**
  30. * This zero height div has the [data-offset-left] attribute for
  31. * Drupal.displace() to measure. It purposefully does not have any transitions
  32. * because we want Drupal.displace() to measure the width immediately
  33. */
  34. .admin-toolbar__displace-placeholder {
  35. position: absolute;
  36. inset-block-start: 0;
  37. inset-inline-start: 0;
  38. @media (--admin-toolbar-desktop) {
  39. width: var(--admin-toolbar-sidebar-width);
  40. }
  41. }
  42. /**
  43. * The Admin toolbar component.
  44. */
  45. .admin-toolbar {
  46. position: fixed;
  47. inset-block-start: 0;
  48. inset-inline-start: 0;
  49. z-index: var(--admin-toolbar-z-index);
  50. display: flex;
  51. flex-direction: column;
  52. height: 100vh;
  53. transform: translateX(-100%);
  54. background-color: var(--admin-toolbar-color-white);
  55. font-family: var(--admin-toolbar-font-family);
  56. inline-size: calc(var(--admin-toolbar-sidebar-width) + 1px);
  57. [dir="rtl"]
  58. }
  59. & ~ .dialog-off-canvas-main-canvas {
  60. @media (--admin-toolbar-desktop) {
  61. margin-inline-start: var(--drupal-displace-offset-left, var(--admin-toolbar-sidebar-width));
  62. [dir="rtl"]
  63. }
  64. }
  65. [data-admin-toolbar="expanded"]
  66. @media (--admin-toolbar-desktop) {
  67. transform: none;
  68. }
  69. @media only screen and (max-height: 300px) {
  70. min-height: 20rem;
  71. }
  72. }
  73. .admin-toolbar__back-button {
  74. display: none;
  75. flex-grow: 0;
  76. }
  77. .admin-toolbar:has([data-toolbar-popover-control][aria-expanded="true"]) {
  78. .admin-toolbar__back-button {
  79. display: flex;
  80. @media (--admin-toolbar-desktop) {
  81. display: none;
  82. }
  83. }
  84. .admin-toolbar__logo {
  85. display: none;
  86. @media (--admin-toolbar-desktop) {
  87. display: inline-flex;
  88. }
  89. }
  90. }
  91. .admin-toolbar__close-button {
  92. flex-grow: 0;
  93. justify-self: end;
  94. margin-inline-start: auto;
  95. @media (--admin-toolbar-desktop) {
  96. display: none;
  97. }
  98. }
  99. .admin-toolbar__expand-button {
  100. display: none;
  101. align-items: center;
  102. justify-content: center;
  103. width: calc(2.25 * var(--admin-toolbar-rem));
  104. height: calc(2.25 * var(--admin-toolbar-rem));
  105. margin-inline-start: calc(0.125 * var(--admin-toolbar-rem));
  106. cursor: pointer;
  107. color: var(--admin-toolbar-color-gray-500);
  108. border: 1px solid var(--admin-toolbar-color-gray-300);
  109. border-radius: 50%;
  110. background-color: transparent;
  111. &:hover {
  112. color: var(--admin-toolbar-color-blue-700);
  113. }
  114. &::before {
  115. display: block;
  116. flex-shrink: 0;
  117. width: calc(1 * var(--admin-toolbar-rem));
  118. height: calc(1 * var(--admin-toolbar-rem));
  119. content: "";
  120. transition:
  121. opacity var(--admin-toolbar-transition),
  122. transform var(--admin-toolbar-transition);
  123. opacity: 0;
  124. background-color: currentColor;
  125. mask-repeat: no-repeat;
  126. mask-position: center center;
  127. mask-size: 100% auto;
  128. mask-image: url(../../assets/icons/chevron.svg);
  129. [data-admin-toolbar-transitions]
  130. [dir="rtl"]
  131. @media (--forced-colors) {
  132. background: canvastext;
  133. }
  134. }
  135. &[aria-expanded="true"] {
  136. &::before {
  137. transform: rotate(180deg);
  138. [dir="rtl"]
  139. }
  140. }
  141. @media (--admin-toolbar-desktop) {
  142. display: flex;
  143. }
  144. }
  145. .admin-toolbar__header {
  146. position: sticky;
  147. z-index: var(--admin-toolbar-z-index-header);
  148. inset-block-start: 0;
  149. display: flex;
  150. align-items: center;
  151. justify-content: space-between;
  152. margin-block-start: calc(var(--admin-toolbar-sidebar-header) * -1);
  153. padding-block-start: var(--admin-toolbar-space-16);
  154. background-color: var(--admin-toolbar-color-white);
  155. & + .toolbar-block {
  156. margin-block-start: calc(var(--admin-toolbar-space-10) * -1);
  157. @media (--admin-toolbar-desktop) {
  158. margin-block-start: 0;
  159. }
  160. }
  161. &:not(:has(.admin-toolbar__logo)) {
  162. @media (--admin-toolbar-desktop) {
  163. display: none;
  164. }
  165. }
  166. @media (--admin-toolbar-desktop) {
  167. position: static;
  168. align-items: start;
  169. margin-block-start: revert;
  170. padding-block-start: revert;
  171. padding-block-end: 0;
  172. }
  173. }
  174. .admin-toolbar__item {
  175. flex: 1 0 100%;
  176. }
  177. .admin-toolbar__logo {
  178. display: inline-flex;
  179. overflow: hidden;
  180. border-radius: var(--admin-toolbar-space-8);
  181. &:hover {
  182. background-color: transparent;
  183. }
  184. & img {
  185. display: block;
  186. }
  187. }
  188. /**
  189. * Scroll wrapper for Mobile.
  190. */
  191. .admin-toolbar__scroll-wrapper {
  192. display: flex;
  193. overflow-y: auto;
  194. flex-direction: column;
  195. height: 100%;
  196. background: linear-gradient(var(--admin-toolbar-color-white) 30%, var(--admin-toolbar-color-white)), radial-gradient(farthest-side at 50% 0, var(--admin-toolbar-color-shadow-15), var(--admin-toolbar-color-shadow-0));
  197. background-color: var(--admin-toolbar-color-white);
  198. background-repeat: no-repeat;
  199. background-attachment: local, scroll;
  200. background-position-y: 48px;
  201. background-size:
  202. 100% 40px,
  203. 100% 16px;
  204. @media (--admin-toolbar-desktop) {
  205. display: contents;
  206. overflow-y: unset;
  207. background: none;
  208. }
  209. }
  210. /**
  211. * Content region.
  212. * Region where most of the content will be printed.
  213. */
  214. .admin-toolbar__content {
  215. display: grid;
  216. gap: var(--admin-toolbar-space-12);
  217. padding-block: var(--admin-toolbar-sidebar-header) var(--admin-toolbar-space-16);
  218. padding-inline: var(--admin-toolbar-space-16);
  219. border-inline-end: 1px solid var(--admin-toolbar-color-gray-100);
  220. @media (--admin-toolbar-desktop) {
  221. display: flex;
  222. overflow-x: hidden;
  223. overflow-y: auto;
  224. flex-direction: column;
  225. flex-grow: 1;
  226. padding-block-start: var(--admin-toolbar-space-16);
  227. background:
  228. linear-gradient(var(--admin-toolbar-color-white) 30%, var(--admin-toolbar-color-white)),
  229. linear-gradient(var(--admin-toolbar-color-white), var(--admin-toolbar-color-white) 80%) 0 100%,
  230. radial-gradient(farthest-side at 50% 0, var(--admin-toolbar-color-shadow-15), var(--admin-toolbar-color-shadow-0)),
  231. radial-gradient(farthest-side at 50% 100%, var(--admin-toolbar-color-shadow-15), var(--admin-toolbar-color-shadow-0)) 0 100%;
  232. background-color: var(--admin-toolbar-color-white);
  233. background-repeat: no-repeat;
  234. background-attachment: local, local, scroll, scroll;
  235. background-size:
  236. 100% 40px,
  237. 100% 40px,
  238. 100% 16px,
  239. 100% 16px;
  240. }
  241. }
  242. /**
  243. * Sticky bottom region.
  244. * Region with less used items and button for collapse.
  245. */
  246. .admin-toolbar__footer {
  247. z-index: var(--admin-toolbar-z-index-footer);
  248. display: grid;
  249. gap: var(--admin-toolbar-space-16);
  250. margin-block-start: auto;
  251. padding: var(--admin-toolbar-space-16);
  252. border-block-start: 1px solid var(--admin-toolbar-color-gray-200);
  253. border-inline-end: 1px solid var(--admin-toolbar-color-gray-100);
  254. @media (--admin-toolbar-desktop) {
  255. --admin-toolbar-z-index-footer: -1;
  256. position: sticky;
  257. bottom: 0;
  258. background-color: var(--admin-toolbar-color-white);
  259. }
  260. }
  261. /**
  262. * Sidebar toggle.
  263. */
  264. .admin-toolbar__toggle {
  265. display: none;
  266. @media (--admin-toolbar-desktop) {
  267. display: flex;
  268. }
  269. }
  270. [data-drupal-tooltip]:hover + .admin-toolbar__tooltip,
  271. [data-drupal-tooltip]:focus + .admin-toolbar__tooltip {
  272. [data-admin-toolbar="expanded"]
  273. }
  274. /**
  275. * Element is used to overlay the content when Toolbar is expanded in smaller devices.
  276. * It is created in the template templates/navigation.html.twig.
  277. */
  278. .admin-toolbar-overlay {
  279. position: fixed;
  280. z-index: var(--admin-toolbar-z-index-overlay);
  281. inset-block-start: 0;
  282. inset-inline-start: 0;
  283. display: none;
  284. width: 100vw;
  285. height: 100vh;
  286. background-color: rgba(0, 0, 0, 0.14);
  287. :where([data-admin-toolbar="expanded"])
  288. @media (--admin-toolbar-desktop) {
  289. display: none;
  290. }
  291. }

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