form--checkbox-radio.pcss.css

Same filename in other branches
  1. 8.9.x core/themes/claro/css/components/form--checkbox-radio.pcss.css
  2. 10 core/themes/claro/css/components/form--checkbox-radio.pcss.css
  3. 11.x core/themes/claro/css/components/form--checkbox-radio.pcss.css

Checkbox and radio input elements.

File

core/themes/claro/css/components/form--checkbox-radio.pcss.css

View source
  1. /**
  2. * @file
  3. * Checkbox and radio input elements.
  4. */
  5. @import "../base/variables.pcss.css";
  6. /**
  7. * Form item modifiers.
  8. */
  9. .form-type--boolean {
  10. margin-left: var(--input--label-spacing); /* LTR */
  11. line-height: var(--space-l);
  12. }
  13. [dir="rtl"] .form-type--boolean {
  14. margin-right: var(--input--label-spacing);
  15. margin-left: 0;
  16. }
  17. /**
  18. * Radio and checkbox items that are the child of a form item.
  19. */
  20. .form-type--boolean .form-boolean {
  21. position: relative;
  22. top: calc(var(--space-l) / 2);
  23. float: left; /* LTR */
  24. margin-left: calc(var(--input--label-spacing) * -1); /* LTR */
  25. transform: translateY(-50%);
  26. }
  27. [dir="rtl"] .form-type--boolean .form-boolean {
  28. float: right;
  29. margin-right: calc(var(--input--label-spacing) * -1);
  30. margin-left: 0;
  31. }
  32. .form-type--boolean.form-item--no-label {
  33. margin-left: 0;
  34. }
  35. [dir="rtl"] .form-type--boolean.form-item--no-label {
  36. margin-right: 0;
  37. }
  38. .form-type--boolean.form-item--no-label .form-boolean,
  39. [dir="rtl"] .form-type--boolean.form-item--no-label .form-boolean {
  40. position: static;
  41. float: none;
  42. margin-right: 0;
  43. margin-left: 0;
  44. transform: none;
  45. }
  46. /**
  47. * When form items are nested in radios or checkboxes group, reduce the default
  48. * space between them.
  49. */
  50. .form-boolean-group .form-type--boolean {
  51. margin-top: 0.4em;
  52. margin-bottom: 0.4em;
  53. }
  54. /**
  55. * Input appearance.
  56. */
  57. .form-boolean {
  58. display: inline-block;
  59. box-sizing: border-box;
  60. width: 18px;
  61. height: 18px;
  62. vertical-align: text-bottom;
  63. border: 1px solid var(--input-border-color);
  64. border-radius: 2px;
  65. background: var(--input-bg-color) no-repeat 50% 50%;
  66. background-size: 100% 100%;
  67. box-shadow: 0 0 0 4px transparent;
  68. appearance: none;
  69. }
  70. @media (-ms-high-contrast: active), (forced-colors: active) {
  71. .form-boolean {
  72. appearance: auto;
  73. }
  74. }
  75. .form-boolean--type-radio {
  76. width: 19px;
  77. height: 19px;
  78. border-radius: 19px;
  79. }
  80. .form-boolean:active,
  81. .form-boolean:hover {
  82. border-color: var(--input-fg-color);
  83. box-shadow: inset 0 0 0 1px var(--input-fg-color);
  84. }
  85. .form-boolean:focus:active,
  86. .form-boolean:focus:hover {
  87. box-shadow: 0 0 0 2px var(--color-white), 0 0 0 5px var(--color-focus), inset 0 0 0 1px var(--input-fg-color);
  88. }
  89. .form-boolean--type-checkbox:checked {
  90. border-color: var(--input--focus-border-color);
  91. background-color: var(--input--focus-border-color);
  92. background-image: url(../../images/icons/ffffff/checkmark-sm.svg);
  93. }
  94. .form-boolean--type-checkbox:checked:active,
  95. .form-boolean--type-checkbox:checked:hover {
  96. border-color: var(--input-fg-color);
  97. background-color: var(--input-fg-color);
  98. }
  99. .form-boolean--type-radio:checked {
  100. border-color: var(--input--focus-border-color);
  101. background-image: url(../../images/icons/003ecc/circle.svg);
  102. box-shadow: inset 0 0 0 1px var(--input--focus-border-color);
  103. }
  104. .form-boolean--type-radio:checked:focus {
  105. box-shadow: 0 0 0 2px var(--color-white), 0 0 0 5px var(--color-focus), inset 0 0 0 1px var(--input--focus-border-color);
  106. }
  107. .form-boolean--type-radio:checked:active,
  108. .form-boolean--type-radio:checked:hover {
  109. border-color: var(--input-fg-color);
  110. background-image: url(../../images/icons/000f33/circle.svg);
  111. box-shadow: inset 0 0 0 1px var(--input-fg-color);
  112. }
  113. .form-boolean--type-radio:checked:focus:active,
  114. .form-boolean--type-radio:checked:focus:hover {
  115. box-shadow: 0 0 0 2px var(--color-white), 0 0 0 5px var(--color-focus), inset 0 0 0 1px var(--input-fg-color);
  116. }
  117. /**
  118. * Error states.
  119. */
  120. .form-boolean.error {
  121. border-color: var(--input--error-border-color);
  122. background-color: var(--input-bg-color);
  123. box-shadow: inset 0 0 0 1px var(--input--error-border-color);
  124. }
  125. .form-boolean.error:active,
  126. .form-boolean.error:hover {
  127. box-shadow: inset 0 0 0 1px var(--input--error-border-color);
  128. }
  129. .form-boolean.error:focus,
  130. .form-boolean.error:focus:active,
  131. .form-boolean.error:focus:hover {
  132. box-shadow: 0 0 0 2px var(--color-white), 0 0 0 5px var(--color-focus), inset 0 0 0 1px var(--input--error-border-color);
  133. }
  134. .form-boolean.error:checked:active,
  135. .form-boolean.error:checked:hover {
  136. border-color: var(--input--error-border-color);
  137. background-color: var(--input-bg-color);
  138. }
  139. .form-boolean--type-checkbox.error:checked,
  140. .form-boolean--type-checkbox.error:checked:active,
  141. .form-boolean--type-checkbox.error:checked:hover {
  142. background-color: var(--input--error-border-color);
  143. }
  144. .form-boolean--type-radio.error:checked,
  145. .form-boolean--type-radio.error:checked:active,
  146. .form-boolean--type-radio.error:checked:hover {
  147. background-image: url(../../images/icons/d72222/circle.svg);
  148. }
  149. .form-boolean--type-radio.error:checked:focus {
  150. box-shadow: 0 0 0 2px var(--color-white), 0 0 0 5px var(--color-focus), inset 0 0 0 1px var(--input--error-border-color);
  151. }
  152. /**
  153. * Disabled states.
  154. */
  155. .form-boolean[disabled],
  156. .form-boolean[disabled]:hover,
  157. .form-boolean[disabled].error,
  158. .form-boolean[disabled].error:hover,
  159. .form-boolean--type-radio[disabled]:focus:active,
  160. .form-boolean--type-radio[disabled]:active:hover,
  161. .form-boolean--type-radio[disabled].error:active:hover {
  162. border-color: var(--input--disabled-border-color);
  163. background-color: var(--input--disabled-bg-color);
  164. background-image: none;
  165. box-shadow: none;
  166. }
  167. .form-boolean--type-checkbox[disabled]:checked {
  168. background-image: url(../../images/icons/82828c/checkmark.svg);
  169. }
  170. .form-boolean--type-radio[disabled]:checked,
  171. .form-boolean--type-radio[disabled].error:checked {
  172. background-image: url(../../images/icons/82828c/circle.svg);
  173. }

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