Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x

vertical-tabs.pcss.css

Same filename in this branch
  1. 11.1.x core/themes/olivero/css/components/vertical-tabs.pcss.css

Vertical tabs module.

Replaces /core/misc/vertical-tabs.css.

File

core/themes/claro/css/components/vertical-tabs.pcss.css

View source
  1. /**
  2. * @file
  3. * Vertical tabs module.
  4. *
  5. * Replaces /core/misc/vertical-tabs.css.
  6. */
  7. /**
  8. * Main wrapper of vertical tabs.
  9. * This wrapper div is added by JavaScript.
  10. */
  11. .vertical-tabs {
  12. margin-block: var(--vertical-tabs-margin-vertical);
  13. border-block-start: 1px solid transparent; /* Need to hide the pane wrapper clearfix's height */
  14. }
  15. /**
  16. * Vertical tabs menu.
  17. */
  18. .vertical-tabs__menu {
  19. position: relative;
  20. display: block;
  21. float: left; /* LTR */
  22. width: var(--vertical-tabs-menu-width);
  23. margin: 0;
  24. padding-block-start: var(--vertical-tabs-menu-item-shadow-extraspace);
  25. list-style: none;
  26. color: var(--color-text);
  27. @nest [dir="rtl"]
  28. }
  29. /**
  30. * Vertical tabs menu item.
  31. */
  32. .vertical-tabs__menu-item {
  33. overflow: hidden;
  34. margin-block: var(--vertical-tabs-menu-item--top-margin);
  35. margin-inline: var(--vertical-tabs-menu-item--left-margin) var(--vertical-tabs-menu-item--right-margin);
  36. padding-block: var(--vertical-tabs-menu-item-shadow-extraspace);
  37. padding-inline: var(--vertical-tabs-menu-item-shadow-extraspace) 0;
  38. }
  39. /**
  40. * These are the (gray) lines that are visually separating the vertical tab menu
  41. * items.
  42. */
  43. .vertical-tabs__menu-item::before,
  44. .vertical-tabs__menu-item::after {
  45. position: absolute;
  46. z-index: 1; /* The line should be kept above the vertical tabs menu link to keep it visible even if the link is hovered and gets the 'hover' background color. */
  47. display: block;
  48. width: 100%;
  49. margin-block-start: calc(var(--vertical-tabs-menu-separator-size) * -1);
  50. border-block-start: var(--vertical-tabs-menu-separator-size) solid var(--vertical-tabs-menu-separator-color);
  51. }
  52. /**
  53. * This pseudo element covers the gray separator line of the vertical tab menu
  54. * item that follows the active one.
  55. *
  56. * Without this, we would have a lightgray line at the bottom-left (LTR) corner
  57. * of the active vertical tab menu item.
  58. *
  59. * Let's call this 'masking' line.
  60. */
  61. .vertical-tabs__menu-item::after {
  62. z-index: 2;
  63. border-color: var(--color-white);
  64. }
  65. /**
  66. * Making the separator line visible only if it follows an unhidden menu item.
  67. */
  68. .vertical-tabs__menu-item:not(.vertical-tab--hidden) ~ .vertical-tabs__menu-item::before {
  69. content: "";
  70. }
  71. /* Menu item states. */
  72. .vertical-tabs__menu-item:focus {
  73. outline: 0;
  74. box-shadow: none;
  75. }
  76. .vertical-tabs__menu-item.is-selected::before,
  77. .vertical-tabs__menu-item:not(.vertical-tab--hidden) ~ .vertical-tabs__menu-item.is-selected::before {
  78. content: normal;
  79. }
  80. /* Make the white masking line displayed for the selected menu item. */
  81. .vertical-tabs__menu-item.is-selected::after {
  82. content: "";
  83. }
  84. /**
  85. * Anchor link inside the vertical tabs menu item.
  86. */
  87. .vertical-tabs__menu-link {
  88. position: relative;
  89. display: block;
  90. margin-block-start: calc(var(--vertical-tabs-border-size) * -1);
  91. padding: var(--space-s) var(--space-s) var(--space-s) calc(var(--space-l) - var(--vertical-tabs-menu-link--active-border-size));
  92. text-decoration: none;
  93. color: var(--color-text);
  94. border: var(--vertical-tabs-border-size) solid transparent;
  95. border-block-width: var(--vertical-tabs-border-size);
  96. border-inline-width: var(--vertical-tabs-menu-link--active-border-size) 0;
  97. border-start-start-radius: var(--vertical-tabs-border-radius);
  98. border-start-end-radius: 0;
  99. border-end-end-radius: 0;
  100. border-end-start-radius: var(--vertical-tabs-border-radius);
  101. &:focus {
  102. z-index: 4; /* Focus state should be on the highest level to make the focus effect be fully visible. This also means that it should have bigger z-index than the selected link. */
  103. text-decoration: none;
  104. box-shadow: none;
  105. &::after {
  106. position: absolute;
  107. inset: 0;
  108. margin: calc(var(--vertical-tabs-border-size) * -1) calc(var(--vertical-tabs-menu-link--active-border-size) * -1);
  109. content: "";
  110. pointer-events: none;
  111. border: var(--vertical-tabs-menu-link-focus-border-size) solid var(--color-focus);
  112. border-radius: var(--vertical-tabs-border-radius);
  113. }
  114. }
  115. &:hover {
  116. text-decoration: none;
  117. color: var(--color-absolutezero);
  118. &::before {
  119. background: var(--color-bgblue-hover);
  120. }
  121. }
  122. &::before {
  123. position: absolute;
  124. z-index: 0; /* This should be on a lower level than the menu-item separator lines. */
  125. inset-block: calc(var(--vertical-tabs-border-size) * -1);
  126. inset-inline: calc(var(--vertical-tabs-menu-link--active-border-size) * -1) 0;
  127. content: "";
  128. pointer-events: none;
  129. background-clip: padding-box;
  130. }
  131. }
  132. .vertical-tabs__menu-item.is-selected .vertical-tabs__menu-link {
  133. z-index: 3; /* The selected menu link should be on a higher level than the white masking line that hides the gray separator. */
  134. color: var(--color-absolutezero);
  135. border-color: var(--vertical-tabs-border-color) transparent;
  136. background-color: var(--color-white);
  137. box-shadow: var(--vertical-tabs-shadow);
  138. }
  139. .vertical-tabs__menu-item.is-selected .vertical-tabs__menu-link:hover {
  140. color: var(--color-absolutezero-hover);
  141. background-color: var(--color-bgblue-hover);
  142. }
  143. .vertical-tabs__menu-item.is-selected .vertical-tabs__menu-link::before {
  144. z-index: 1; /* The blue active-tab indication should be on a higher level than the green focus border. */
  145. border-inline-start: var(--vertical-tabs-menu-link--active-border-size) solid var(--vertical-tabs-menu-link--active-border-color);
  146. border-radius: var(--base-border-radius) 0 0 var(--base-border-radius);
  147. border-start-start-radius: var(--base-border-radius);
  148. border-start-end-radius: 0;
  149. border-end-end-radius: 0;
  150. border-end-start-radius: var(--base-border-radius);
  151. @media (forced-colors: active) {
  152. border-inline-start: var(--vertical-tabs-menu-link--active-border-size) solid canvastext;
  153. }
  154. }
  155. .vertical-tabs__menu-item.is-selected .vertical-tabs__menu-link:hover::before {
  156. background: none;
  157. }
  158. .vertical-tabs__menu-link-content {
  159. position: relative;
  160. z-index: 1; /* We are using a pseudo element for displaying the hover state's background, and we have to keep the link content above that pseudo element. Without this, the text would be covered by the background. */
  161. }
  162. /**
  163. * Details summary in vertical tabs menu link and in the summary of the details.
  164. */
  165. .vertical-tabs__menu-link-summary {
  166. display: block;
  167. color: var(--color-gray-800);
  168. font-size: var(--font-size-s);
  169. font-weight: normal;
  170. }
  171. /**
  172. * Wrapper of vertical tabs panes.
  173. */
  174. .vertical-tabs__items {
  175. box-sizing: border-box;
  176. margin-block: var(--vertical-tabs-margin-vertical);
  177. color: var(--color-text);
  178. border: var(--vertical-tabs-border);
  179. border-radius: var(--vertical-tabs-border-radius);
  180. background-color: var(--color-white);
  181. box-shadow: var(--vertical-tabs-shadow);
  182. }
  183. /* This modifier is added by JavaScript (this is inherited from Drupal core). */
  184. .vertical-tabs__panes {
  185. position: relative;
  186. z-index: 1; /* The wrapper of the details of the vertical tabs should be on a higher level than the vertical tabs menu */
  187. inset-block-start: -1px;
  188. margin-block: 0;
  189. &::after {
  190. display: block; /* This clearfix makes the pane wrapper at least as tall as the menu. */
  191. clear: both;
  192. content: "";
  193. }
  194. }
  195. .vertical-tabs .vertical-tabs__panes {
  196. margin-inline-start: var(--vertical-tabs-menu-width);
  197. border-top-left-radius: 0;
  198. @nest [dir="rtl"]
  199. }
  200. /**
  201. * The actual vertical tabs pane.
  202. *
  203. * This is a claro-details element which in this case is also
  204. * vertical-tabs__item.
  205. */
  206. .vertical-tabs__item {
  207. /* Render on top of the border of vertical-tabs__items. */
  208. margin: calc(var(--vertical-tabs-border-size) * -1) calc(var(--vertical-tabs-border-size) * -1) 0;
  209. border-radius: 0;
  210. &.first {
  211. border-top-left-radius: var(--details-accordion-border-size-radius);
  212. border-top-right-radius: var(--details-accordion-border-size-radius);
  213. }
  214. &.last {
  215. margin-bottom: calc(var(--vertical-tabs-border-size) * -1);
  216. border-bottom-right-radius: var(--details-accordion-border-size-radius);
  217. border-bottom-left-radius: var(--details-accordion-border-size-radius);
  218. }
  219. }
  220. .js .vertical-tabs .vertical-tabs__item {
  221. overflow: hidden;
  222. margin: 0;
  223. border: 0;
  224. &.first,
  225. &.last {
  226. border-radius: 0;
  227. }
  228. & > summary {
  229. display: none;
  230. }
  231. }

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal