form--checkbox-radio.pcss.css

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