button.pcss.css

Same filename in this branch
  1. 11.x core/misc/dialog/off-canvas/css/button.pcss.css
  2. 11.x core/themes/olivero/css/components/button.pcss.css
  3. 11.x core/themes/claro/css/components/button.pcss.css
Same filename and directory in other branches
  1. 10 core/misc/dialog/off-canvas/css/button.pcss.css
  2. 10 core/themes/olivero/css/components/button.pcss.css
  3. 10 core/themes/claro/css/components/button.pcss.css
  4. 9 core/themes/olivero/css/components/button.pcss.css
  5. 9 core/themes/claro/css/components/button.pcss.css
  6. 8.9.x core/themes/claro/css/components/button.pcss.css
  7. main core/misc/dialog/off-canvas/css/button.pcss.css
  8. main core/themes/olivero/css/components/button.pcss.css
  9. main core/themes/claro/css/components/button.pcss.css

Structural styles for Claro's UI buttons

Apply these classes to button elements (<button>, <input type="button" />).

File

core/themes/admin/css/components/button.pcss.css

View source
  1. /**
  2. * @file
  3. * Structural styles for Claro's UI buttons
  4. *
  5. * Apply these classes to button elements (, ).
  6. */
  7. /**
  8. * Buttons.
  9. *
  10. * 1. Padding widths detracted by width of the transparent borders to make
  11. * button size match with design system.
  12. * 2. Prevent fat text in WebKit.
  13. *
  14. * @todo Consider moving box-sizing into base.css under a universal selector.
  15. * See https://www.drupal.org/node/2124251
  16. */
  17. /**
  18. * Base button styles.
  19. *
  20. * These styles have been duplicated to dropbutton.css and action-links.css
  21. * since those components inherits most of these design elements. Whenever
  22. * making changes to this file, remember to check if that needs to be applied to
  23. * dropbutton.css or action-links.css as well.
  24. */
  25. .button {
  26. display: inline-block;
  27. margin-block: var(--space-m);
  28. margin-inline: 0 var(--space-s);
  29. padding-block: var(--space-s);
  30. padding-inline: var(--space-m);
  31. cursor: pointer;
  32. text-align: center;
  33. text-decoration: none;
  34. color: var(--button-fg-color);
  35. border: 1px solid var(--button-border-color);
  36. border-radius: var(--button-border-radius-size);
  37. background-color: var(--button-bg-color);
  38. font-size: var(--button-font-size);
  39. font-weight: var(--button-font-weight);
  40. line-height: 1;
  41. appearance: none;
  42. &:hover {
  43. text-decoration: none;
  44. color: var(--button-fg-color);
  45. border-color: var(--button--hover-border-color);
  46. background-color: var(--button--hover-bg-color);
  47. }
  48. &:focus {
  49. text-decoration: none;
  50. box-shadow: var(--focus-ring);
  51. }
  52. &:active {
  53. border-color: var(--button--active-border-color);
  54. background-color: var(--button--active-bg-color);
  55. }
  56. @media (prefers-reduced-motion: no-preference) {
  57. transition: var(--transition);
  58. }
  59. }
  60. /* Common styles for small buttons. */
  61. .no-touchevents {
  62. & .button--small {
  63. min-height: 2rem;
  64. font-size: var(--font-size-xs);
  65. margin-block: var(--space-s);
  66. margin-inline: 0 var(--space-xs);
  67. padding-block: var(--space-xs);
  68. padding-inline: var(--space-s);
  69. }
  70. /* Common styles for extra small buttons. */
  71. & .button--extrasmall {
  72. min-height: 1.5rem;
  73. font-size: var(--font-size-xxs);
  74. margin-block: var(--space-xs);
  75. margin-inline: 0 var(--space-xs);
  76. padding-block: var(--space-xxs);
  77. padding-inline: var(--space-xs);
  78. }
  79. }
  80. /* Styles for action link buttons. */
  81. .button--action {
  82. margin: 0;
  83. &::before {
  84. margin-inline: -0.25em 0;
  85. padding-inline: 0 0.25em;
  86. content: "+";
  87. font-weight: 900;
  88. }
  89. }
  90. /* Primary button style.s */
  91. .button--primary {
  92. color: var(--button-fg-color--primary);
  93. border-color: transparent;
  94. background-color: var(--button-bg-color--primary);
  95. &:is(:hover, :active) {
  96. color: var(--button-fg-color--primary);
  97. border-color: transparent;
  98. background-color: var(--button--hover-bg-color--primary);
  99. }
  100. }
  101. /* Danger button styles */
  102. .button--danger {
  103. color: var(--button-fg-color--danger);
  104. border-color: transparent;
  105. background-color: var(--button-bg-color--danger);
  106. &:is(:hover, :active) {
  107. color: var(--button-fg-color--danger);
  108. background-color: var(--button--hover-bg-color--danger);
  109. }
  110. }
  111. /**
  112. * Disabled state styles as last.
  113. *
  114. * Overrides every definitions before, including variants.
  115. */
  116. .button {
  117. &:is(:disabled, .is-disabled) {
  118. color: var(--button--disabled-fg-color);
  119. background-color: var(--button--disabled-bg-color);
  120. }
  121. /* Make disabled behave like a [disabled] or . */
  122. &.is-disabled {
  123. user-select: none;
  124. pointer-events: none;
  125. }
  126. }
  127. /**
  128. * Style a clickable/tappable element as a link. Duplicates the base style for
  129. * the tag, plus a reset for padding, borders and background.
  130. */
  131. .link {
  132. display: inline;
  133. padding: 0;
  134. cursor: pointer;
  135. text-decoration: underline;
  136. border: 0;
  137. background: none;
  138. appearance: none;
  139. }