form.pcss.css

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

Main form and form item styles.

File

core/themes/claro/css/components/form.pcss.css

View source
  1. /**
  2. * @file
  3. * Main form and form item styles.
  4. */
  5. ::placeholder {
  6. opacity: 1;
  7. color: var(--input-fg-color--placeholder);
  8. }
  9. /**
  10. * General form item.
  11. */
  12. .form-item {
  13. margin-block: var(--space-l);
  14. }
  15. /**
  16. * When a table row or a container-inline has a single form item, prevent it
  17. * from adding unnecessary extra spacing.
  18. * If it has multiple form items, allow spacing between them, overriding core.
  19. */
  20. tr .form-item,
  21. .container-inline .form-item {
  22. margin-block: var(--space-s);
  23. }
  24. /**
  25. * Form element label.
  26. */
  27. .form-item__label {
  28. display: table;
  29. margin-block: calc(var(--space-xs) / 2); /* 4px */
  30. font-size: var(--font-size-s); /* ~14px */
  31. font-weight: bold;
  32. line-height: var(--line-height-form-label);
  33. &[for] {
  34. cursor: pointer;
  35. }
  36. &.option {
  37. display: inline;
  38. font-weight: normal;
  39. }
  40. &.has-error {
  41. color: var(--input--error-color);
  42. }
  43. &.option.has-error {
  44. color: inherit;
  45. }
  46. &.is-disabled {
  47. cursor: default; /* @todo ...or auto? */
  48. color: var(--input--disabled-fg-color);
  49. }
  50. }
  51. /* Multiple selectors used to ensure styling even if modules override markup. */
  52. .form-item__label--multiple-value-form,
  53. .field-multiple-table .field-label h4.label {
  54. display: inline-block;
  55. margin-block: 0;
  56. align-self: center;
  57. font-size: inherit;
  58. font-weight: inherit;
  59. line-height: inherit;
  60. }
  61. .form-item__label.form-required::after,
  62. .fieldset__label.form-required::after {
  63. display: inline-block;
  64. margin-inline: 0.15em;
  65. content: "*";
  66. color: var(--color-maximumred);
  67. font-size: 0.875rem;
  68. }
  69. /**
  70. * Form item description.
  71. */
  72. .form-item__description {
  73. margin-block: calc(6rem / 16); /* 6px */
  74. color: var(--input-fg-color--description);
  75. font-size: var(--font-size-xs); /* ~13px */
  76. line-height: calc(17rem / 16); /* 17px */
  77. &.is-disabled {
  78. color: var(--input--disabled-fg-color);
  79. }
  80. }
  81. /**
  82. * Error message (Inline form errors).
  83. */
  84. .form-item__error-message {
  85. margin-block: calc(6rem / 16); /* 6px */
  86. color: var(--input--error-color);
  87. font-size: var(--font-size-xs); /* ~13px */
  88. font-weight: normal;
  89. line-height: calc(17rem / 16); /* 17px */
  90. }
  91. .form-item__prefix.is-disabled,
  92. .form-item__suffix.is-disabled {
  93. color: var(--input--disabled-fg-color);
  94. }
  95. /* Add some spacing so that the focus ring and suffix don't overlap. */
  96. @media screen and (min-width: 601px) {
  97. .form-item__suffix {
  98. margin-inline-start: var(--space-xs);
  99. white-space: nowrap;
  100. }
  101. }
  102. /**
  103. * Form actions.
  104. */
  105. .form-actions,
  106. .field-actions {
  107. display: flex;
  108. flex-wrap: wrap;
  109. align-items: flex-start;
  110. margin-block: var(--space-xs);
  111. & .form-wrapper {
  112. display: flex;
  113. flex-wrap: wrap;
  114. gap: var(--space-xs) 0;
  115. }
  116. & .button,
  117. & .action-link {
  118. margin-block: var(--space-xs);
  119. }
  120. & .ajax-progress--throbber {
  121. align-self: center;
  122. }
  123. }
  124. .form-actions > .form-wrapper {
  125. margin-inline: 0 var(--space-s);
  126. }
  127. /**
  128. * Password module.
  129. *
  130. * @legacy
  131. * @todo These should be in a standalone component file.
  132. */
  133. .confirm-parent,
  134. .password-parent {
  135. overflow: visible;
  136. width: auto;
  137. }
  138. .form-item-options-group-info-identifier,
  139. .form-item-pass .description {
  140. clear: both;
  141. }
  142. /**
  143. * Custom label placement for editor filter format select.
  144. */
  145. .form-item--editor-format {
  146. display: flex;
  147. flex-wrap: wrap;
  148. align-items: center;
  149. max-width: 100%;
  150. & .form-item__label,
  151. & .form-item__prefix,
  152. & .form-item__suffix,
  153. & .form-element--editor-format {
  154. min-width: 1px;
  155. }
  156. & .form-item__label,
  157. & .form-item__prefix,
  158. & .form-item__suffix,
  159. & .form-element--editor-format {
  160. min-width: 1px;
  161. }
  162. & .form-item__label,
  163. & .form-item__prefix,
  164. & .form-item__suffix {
  165. margin-inline-end: var(--space-xs);
  166. }
  167. & .form-item__description,
  168. & .form-item__error-message {
  169. flex: 0 1 100%;
  170. min-width: 1px;
  171. }
  172. }
  173. /**
  174. * Improve form element usability on narrow devices.
  175. *
  176. * @legacy
  177. */
  178. @media screen and (max-width: 600px) {
  179. .password-strength {
  180. width: 100%;
  181. }
  182. div.form-item div.password-suggestions {
  183. float: none;
  184. }
  185. }
  186. /**
  187. * Prevent regression due to explicit line-heights applied to these elements in
  188. * normalize.css 7.0.0.
  189. */
  190. button {
  191. line-height: 1.125rem;
  192. }
  193. input,
  194. optgroup {
  195. line-height: 1.5rem;
  196. }
  197. /**
  198. * Prevent regression due to -webkit-appearance being set to button in
  199. * normalize.css 4.1.0.
  200. */
  201. ::-webkit-file-upload-button {
  202. -webkit-appearance: push-button;
  203. }

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