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. 10 core/misc/dialog/off-canvas/css/form.pcss.css
  4. 10 core/themes/olivero/css/components/form.pcss.css
  5. 10 core/themes/claro/css/components/form.pcss.css
  6. 11.x core/misc/dialog/off-canvas/css/form.pcss.css
  7. 11.x core/themes/olivero/css/components/form.pcss.css
  8. 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. @import "../base/variables.pcss.css";
  6. ::placeholder {
  7. color: var(--input-fg-color--placeholder);
  8. }
  9. /* IE 10 and 11 needs this set as important. */
  10. :-ms-input-placeholder {
  11. color: var(--input-fg-color--placeholder) !important;
  12. }
  13. /**
  14. * General form item.
  15. */
  16. .form-item {
  17. margin-top: var(--space-l);
  18. margin-bottom: var(--space-l);
  19. }
  20. /**
  21. * When a table row or a container-inline has a single form item, prevent it
  22. * from adding unnecessary extra spacing.
  23. * If it has multiple form items, allow spacing between them, overriding Classy.
  24. */
  25. tr .form-item,
  26. .container-inline .form-item {
  27. margin-top: var(--space-s);
  28. margin-bottom: var(--space-s);
  29. }
  30. /**
  31. * Form element label.
  32. */
  33. .form-item__label {
  34. display: table;
  35. margin-top: calc(var(--space-xs) / 2); /* 4px */
  36. margin-bottom: calc(var(--space-xs) / 2); /* 4px */
  37. font-size: var(--font-size-s); /* ~14px */
  38. font-weight: bold;
  39. line-height: calc(18rem / 16); /* 18px */
  40. }
  41. .form-item__label--multiple-value-form {
  42. margin-top: 0;
  43. margin-bottom: 0;
  44. font-size: inherit;
  45. font-weight: inherit;
  46. line-height: inherit;
  47. }
  48. .form-item__label[for] {
  49. cursor: pointer;
  50. }
  51. .form-item__label.option {
  52. display: inline;
  53. font-weight: normal;
  54. }
  55. /* Label states. */
  56. .form-item__label.has-error {
  57. color: var(--input--error-color);
  58. }
  59. .form-item__label.option.has-error {
  60. color: inherit;
  61. }
  62. .form-item__label.is-disabled {
  63. cursor: default; /* @todo ...or auto? */
  64. color: var(--input--disabled-fg-color);
  65. }
  66. .form-item__label.form-required::after,
  67. .fieldset__label.form-required::after {
  68. display: inline-block;
  69. margin-right: 0.15em;
  70. margin-left: 0.15em;
  71. content: "*";
  72. color: var(--color-maximumred);
  73. font-size: 0.875rem;
  74. }
  75. /**
  76. * Form item description.
  77. */
  78. .form-item__description {
  79. margin-top: calc(6rem / 16); /* 6px */
  80. margin-bottom: calc(6rem / 16); /* 6px */
  81. color: var(--input-fg-color--description);
  82. font-size: var(--font-size-xs); /* ~13px */
  83. line-height: calc(17rem / 16); /* 17px */
  84. }
  85. /* Description states. */
  86. .form-item__description.is-disabled {
  87. color: var(--input--disabled-fg-color);
  88. }
  89. /**
  90. * Error message (Inline form errors).
  91. */
  92. .form-item__error-message {
  93. margin-top: calc(6rem / 16); /* 6px */
  94. margin-bottom: calc(6rem / 16); /* 6px */
  95. color: var(--input--error-color);
  96. font-size: var(--font-size-xs); /* ~13px */
  97. font-weight: normal;
  98. line-height: calc(17rem / 16); /* 17px */
  99. }
  100. .form-item__prefix.is-disabled,
  101. .form-item__suffix.is-disabled {
  102. color: var(--input--disabled-fg-color);
  103. }
  104. /* Add some spacing so that the focus ring and suffix don't overlap. */
  105. @media screen and (min-width: 601px) {
  106. .form-item__suffix {
  107. margin-left: var(--space-xs); /* LTR */
  108. }
  109. [dir="rtl"] .form-item__suffix {
  110. margin-right: var(--space-xs);
  111. margin-left: 0;
  112. }
  113. }
  114. /**
  115. * Form actions.
  116. */
  117. .form-actions {
  118. display: flex;
  119. flex-wrap: wrap;
  120. align-items: flex-start;
  121. margin-top: var(--space-m);
  122. margin-bottom: var(--space-m);
  123. }
  124. .form-actions .button,
  125. .form-actions .action-link {
  126. margin-top: var(--space-m);
  127. margin-bottom: var(--space-m);
  128. }
  129. .form-actions .ajax-progress--throbber {
  130. align-self: center;
  131. }
  132. /**
  133. * Password module.
  134. *
  135. * @legacy
  136. * @todo These should be in a standalone component file.
  137. */
  138. .confirm-parent,
  139. .password-parent {
  140. overflow: visible;
  141. width: auto;
  142. }
  143. .form-item-options-group-info-identifier,
  144. .form-item-pass .description {
  145. clear: both;
  146. }
  147. /**
  148. * Custom label placement for editor filter format select.
  149. */
  150. .form-item--editor-format {
  151. display: flex;
  152. flex-wrap: wrap;
  153. align-items: center;
  154. max-width: 100%;
  155. }
  156. .form-item--editor-format .form-item__label,
  157. .form-item--editor-format .form-item__prefix,
  158. .form-item--editor-format .form-item__suffix,
  159. .form-item--editor-format .form-element--editor-format {
  160. min-width: 1px;
  161. }
  162. .form-item--editor-format .form-item__label,
  163. .form-item--editor-format .form-item__prefix,
  164. .form-item--editor-format .form-item__suffix {
  165. margin-right: var(--space-xs); /* LTR */
  166. }
  167. [dir="rtl"] .form-item--editor-format .form-item__label,
  168. [dir="rtl"] .form-item--editor-format .form-item__prefix,
  169. [dir="rtl"] .form-item--editor-format .form-item__suffix {
  170. margin-right: 0;
  171. margin-left: var(--space-xs);
  172. }
  173. .form-item--editor-format .form-item__description,
  174. .form-item--editor-format .form-item__error-message {
  175. flex: 0 1 100%;
  176. min-width: 1px;
  177. }
  178. /**
  179. * Improve form element usability on narrow devices.
  180. *
  181. * @legacy
  182. */
  183. @media screen and (max-width: 600px) {
  184. .password-strength {
  185. width: 100%;
  186. }
  187. div.form-item div.password-suggestions {
  188. float: none;
  189. }
  190. }

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