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/claro/css/components/button.pcss.css
Same filename in other branches
  1. 9 core/themes/olivero/css/components/button.pcss.css
  2. 9 core/themes/claro/css/components/button.pcss.css
  3. 8.9.x core/themes/claro/css/components/button.pcss.css
  4. 10 core/misc/dialog/off-canvas/css/button.pcss.css
  5. 10 core/themes/olivero/css/components/button.pcss.css
  6. 10 core/themes/claro/css/components/button.pcss.css

Buttons.

File

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

View source
  1. /**
  2. * @file
  3. * Buttons.
  4. */
  5. @import "../base/media-queries.pcss.css";
  6. .button {
  7. display: inline-block;
  8. height: var(--sp3);
  9. margin-block: var(--sp1);
  10. margin-inline-start: 0;
  11. margin-inline-end: var(--sp1);
  12. padding-block: calc((var(--sp3) - var(--line-height-s)) / 2);
  13. padding-inline: var(--sp1-5);
  14. cursor: pointer;
  15. text-align: center;
  16. text-decoration: none;
  17. color: var(--color-text-primary-medium);
  18. border: solid 2px currentColor;
  19. border-radius: var(--border-radius);
  20. background-color: var(--color--white);
  21. font-family: var(--font-sans);
  22. font-size: var(--font-size-l);
  23. font-weight: 700;
  24. appearance: none;
  25. -webkit-font-smoothing: antialiased;
  26. &:hover,
  27. &:focus {
  28. text-decoration: none;
  29. color: var(--color-text-primary-loud);
  30. border: solid 2px currentColor;
  31. background: none;
  32. font-weight: 700;
  33. }
  34. &:focus {
  35. outline: 2px solid var(--color--primary-60);
  36. outline-offset: 2px;
  37. }
  38. &:active {
  39. color: var(--color-text-primary-medium);
  40. border-color: currentColor;
  41. }
  42. &:disabled,
  43. &.is-disabled {
  44. cursor: default;
  45. color: var(--color--gray-90);
  46. border-color: var(--color--gray-90);
  47. }
  48. /*
  49. IE11 doesn't work properly on button elements so we only do
  50. inline-flex on modern browsers.
  51. */
  52. @supports (display: inline-flex) {
  53. display: inline-flex;
  54. align-items: center;
  55. /* Top padding accounts for font not being vertically centered within line-height. */
  56. padding-block: 1px 0;
  57. padding-inline: var(--sp1-5);
  58. line-height: var(--line-height-s);
  59. }
  60. }
  61. /* No margin if is part of a menu. */
  62. .menu .button {
  63. margin-block: 0;
  64. margin-inline-start: 0;
  65. margin-inline-end: 0;
  66. }
  67. .button--small {
  68. height: var(--sp2-5);
  69. padding-block: calc((var(--sp2-5) - var(--line-height-s)) / 2);
  70. padding-inline: var(--sp);
  71. font-size: var(--font-size-base);
  72. line-height: normal;
  73. }
  74. .button--primary {
  75. color: var(--color--white);
  76. border-color: var(--color--primary-40);
  77. background-color: var(--color--primary-40);
  78. &:hover,
  79. &:focus {
  80. color: var(--color--white);
  81. border-color: var(--color--primary-30);
  82. background-color: var(--color--primary-30);
  83. }
  84. &:active {
  85. color: var(--color--white);
  86. background-color: var(--color--primary-40);
  87. }
  88. &:disabled,
  89. &.is-disabled {
  90. color: var(--color--white);
  91. background-color: var(--color--gray-90);
  92. }
  93. }
  94. .button--icon-back {
  95. display: inline-flex;
  96. align-items: center;
  97. &::before {
  98. display: block;
  99. width: 0.5em;
  100. height: 0.5em;
  101. margin-inline-end: 0.5em;
  102. content: "";
  103. transform: rotate(45deg); /* LTR */
  104. border-block-end: solid 2px currentColor;
  105. border-inline-start: solid 2px currentColor;
  106. }
  107. }
  108. [dir="rtl"] .button--icon-back::before {
  109. transform: rotate(-45deg);
  110. }

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