admin-toolbar.pcss.css

Same filename in other branches
  1. 10 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. max-width: var(--admin-toolbar-space-40);
  187. }
  188. }
  189. /**
  190. * Scroll wrapper for Mobile.
  191. */
  192. .admin-toolbar__scroll-wrapper {
  193. display: flex;
  194. overflow-y: auto;
  195. flex-direction: column;
  196. height: 100%;
  197. 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));
  198. background-color: var(--admin-toolbar-color-white);
  199. background-repeat: no-repeat;
  200. background-attachment: local, scroll;
  201. background-position-y: 48px;
  202. background-size:
  203. 100% 40px,
  204. 100% 16px;
  205. @media (--admin-toolbar-desktop) {
  206. display: contents;
  207. overflow-y: unset;
  208. background: none;
  209. }
  210. }
  211. /**
  212. * Content region.
  213. * Region where most of the content will be printed.
  214. */
  215. .admin-toolbar__content {
  216. display: grid;
  217. gap: var(--admin-toolbar-space-12);
  218. padding-block: var(--admin-toolbar-sidebar-header) var(--admin-toolbar-space-16);
  219. padding-inline: var(--admin-toolbar-space-16);
  220. border-inline-end: 1px solid var(--admin-toolbar-color-gray-100);
  221. @media (--admin-toolbar-desktop) {
  222. display: flex;
  223. overflow-x: hidden;
  224. overflow-y: auto;
  225. flex-direction: column;
  226. flex-grow: 1;
  227. padding-block-start: var(--admin-toolbar-space-16);
  228. background:
  229. linear-gradient(var(--admin-toolbar-color-white) 30%, var(--admin-toolbar-color-white)),
  230. linear-gradient(var(--admin-toolbar-color-white), var(--admin-toolbar-color-white) 80%) 0 100%,
  231. radial-gradient(farthest-side at 50% 0, var(--admin-toolbar-color-shadow-15), var(--admin-toolbar-color-shadow-0)),
  232. radial-gradient(farthest-side at 50% 100%, var(--admin-toolbar-color-shadow-15), var(--admin-toolbar-color-shadow-0)) 0 100%;
  233. background-color: var(--admin-toolbar-color-white);
  234. background-repeat: no-repeat;
  235. background-attachment: local, local, scroll, scroll;
  236. background-size:
  237. 100% 40px,
  238. 100% 40px,
  239. 100% 16px,
  240. 100% 16px;
  241. }
  242. }
  243. /**
  244. * Sticky bottom region.
  245. * Region with less used items and button for collapse.
  246. */
  247. .admin-toolbar__footer {
  248. z-index: var(--admin-toolbar-z-index-footer);
  249. display: grid;
  250. gap: var(--admin-toolbar-space-4);
  251. margin-block-start: auto;
  252. padding: var(--admin-toolbar-space-16);
  253. border-block-start: 1px solid var(--admin-toolbar-color-gray-200);
  254. border-inline-end: 1px solid var(--admin-toolbar-color-gray-100);
  255. & > .toolbar-block {
  256. &:last-of-type {
  257. margin-block-end: var(--admin-toolbar-space-12);
  258. }
  259. }
  260. @media (--admin-toolbar-desktop) {
  261. --admin-toolbar-z-index-footer: -1;
  262. position: sticky;
  263. bottom: 0;
  264. background-color: var(--admin-toolbar-color-white);
  265. }
  266. }
  267. /**
  268. * Sidebar toggle.
  269. */
  270. .admin-toolbar__toggle {
  271. display: none;
  272. @media (--admin-toolbar-desktop) {
  273. display: flex;
  274. }
  275. }
  276. [data-drupal-tooltip]:hover + .admin-toolbar__tooltip,
  277. [data-drupal-tooltip]:focus + .admin-toolbar__tooltip {
  278. [data-admin-toolbar="expanded"]
  279. }
  280. /**
  281. * Element is used to overlay the content when Toolbar is expanded in smaller devices.
  282. * It is created in the template templates/navigation.html.twig.
  283. */
  284. .admin-toolbar-overlay {
  285. position: fixed;
  286. z-index: var(--admin-toolbar-z-index-overlay);
  287. inset-block-start: 0;
  288. inset-inline-start: 0;
  289. display: none;
  290. width: 100vw;
  291. height: 100vh;
  292. background-color: rgba(0, 0, 0, 0.14);
  293. :where([data-admin-toolbar="expanded"])
  294. @media (--admin-toolbar-desktop) {
  295. display: none;
  296. }
  297. }

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