form.pcss.css

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

Main form and form item styles.

File

core/themes/olivero/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(--color--gray-30);
  8. }
  9. /* IE 10 and 11 needs this set as important. */
  10. :-ms-input-placeholder {
  11. color: var(--color--gray-30) !important;
  12. }
  13. /**
  14. * General form item.
  15. */
  16. .form-item {
  17. margin-block: var(--sp1);
  18. }
  19. .form-item__label--multiple-value-form {
  20. margin-block: 0;
  21. font-size: inherit;
  22. font-weight: inherit;
  23. line-height: inherit;
  24. }
  25. /**
  26. * When a table row or a container-inline has a single form item, prevent it
  27. * from adding unnecessary extra spacing.
  28. * If it has multiple form items, allow spacing between them, overriding Classy.
  29. */
  30. tr .form-item,
  31. .container-inline .form-item {
  32. margin-block: var(--sp0-5);
  33. }
  34. /**
  35. * Form element label.
  36. */
  37. .form-item__label {
  38. display: block;
  39. margin-block: var(--sp0-5);
  40. }
  41. .container-inline .form-item__label {
  42. margin-inline-end: 1em;
  43. }
  44. .form-item__label--multiple-value-form {
  45. margin-block: 0;
  46. font-size: inherit;
  47. font-weight: inherit;
  48. line-height: inherit;
  49. }
  50. .form-item__label[for] {
  51. cursor: pointer;
  52. }
  53. .form-item__label.option {
  54. display: inline;
  55. font-weight: normal;
  56. }
  57. /* Label states. */
  58. .form-item__label.is-disabled {
  59. cursor: default;
  60. color: var(--color--gray-45);
  61. }
  62. /* Form required star icon */
  63. .form-item__label.form-required::after,
  64. .fieldset__label.form-required::after,
  65. .required-mark::after {
  66. display: inline-block;
  67. width: 0.5rem;
  68. height: 0.5rem;
  69. margin-inline: 0.3em;
  70. content: "";
  71. vertical-align: text-top;
  72. /* Use a background image to prevent screen readers from announcing the text. */
  73. background-image: url("data:image/svg+xml,%3Csvg height='16' width='16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m0 7.562 1.114-3.438c2.565.906 4.43 1.688 5.59 2.35-.306-2.921-.467-4.93-.484-6.027h3.511c-.05 1.597-.234 3.6-.558 6.003 1.664-.838 3.566-1.613 5.714-2.325l1.113 3.437c-2.05.678-4.06 1.131-6.028 1.356.984.856 2.372 2.381 4.166 4.575l-2.906 2.059c-.935-1.274-2.041-3.009-3.316-5.206-1.194 2.275-2.244 4.013-3.147 5.206l-2.856-2.059c1.872-2.307 3.211-3.832 4.017-4.575-2.081-.402-4.058-.856-5.93-1.356' fill='%232494DB'/%3E%3C/svg%3E%0A");
  74. background-repeat: no-repeat;
  75. background-size: 0.5rem 0.5rem;
  76. @media screen and (-ms-high-contrast: active) {
  77. background-image: url("data:image/svg+xml,%3Csvg height='16' width='16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m0 7.562 1.114-3.438c2.565.906 4.43 1.688 5.59 2.35-.306-2.921-.467-4.93-.484-6.027h3.511c-.05 1.597-.234 3.6-.558 6.003 1.664-.838 3.566-1.613 5.714-2.325l1.113 3.437c-2.05.678-4.06 1.131-6.028 1.356.984.856 2.372 2.381 4.166 4.575l-2.906 2.059c-.935-1.274-2.041-3.009-3.316-5.206-1.194 2.275-2.244 4.013-3.147 5.206l-2.856-2.059c1.872-2.307 3.211-3.832 4.017-4.575-2.081-.402-4.058-.856-5.93-1.356' fill='%23ffffff'/%3E%3C/svg%3E%0A");
  78. }
  79. }
  80. /**
  81. * Form item description.
  82. */
  83. .form-item__description {
  84. margin-block: var(--sp0-5);
  85. max-width: 60ch;
  86. font-size: var(--font-size-s);
  87. line-height: var(--line-height-s);
  88. }
  89. .field-multiple-table + .form-item__description {
  90. margin-block-start: 0;
  91. }
  92. /**
  93. * Error message (Inline form errors).
  94. */
  95. .form-item--error-message {
  96. margin-block: var(--sp0-5);
  97. padding-inline-start: var(--sp1-5);
  98. color: var(--color--red);
  99. background-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%23E33F1E' d='M9 0C4.03125 0 0 4.03125 0 9C0 13.9688 4.03125 18 9 18C13.9687 18 18 13.9688 18 9C18 4.03125 13.9687 0 9 0ZM10.5 14.6133C10.5 14.8242 10.3359 15 10.1367 15H7.88672C7.67578 15 7.5 14.8242 7.5 14.6133V12.3867C7.5 12.1758 7.67578 12 7.88672 12H10.1367C10.3359 12 10.5 12.1758 10.5 12.3867V14.6133ZM10.4766 10.582C10.4648 10.7461 10.2891 10.875 10.0781 10.875H7.91016C7.6875 10.875 7.51172 10.7461 7.51172 10.582L7.3125 3.30469C7.3125 3.22266 7.34766 3.14063 7.42969 3.09375C7.5 3.03516 7.60547 3 7.71094 3H10.2891C10.3945 3 10.5 3.03516 10.5703 3.09375C10.6523 3.14063 10.6875 3.22266 10.6875 3.30469L10.4766 10.582Z'/%3E%3C/svg%3E");
  100. background-repeat: no-repeat;
  101. background-position: left top; /* LTR */
  102. background-size: var(--sp1) var(--sp1);
  103. font-size: var(--font-size-s);
  104. line-height: var(--line-height-s);
  105. @media screen and (-ms-high-contrast: active) {
  106. background-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%23ffffff' d='M9 0C4.03125 0 0 4.03125 0 9C0 13.9688 4.03125 18 9 18C13.9687 18 18 13.9688 18 9C18 4.03125 13.9687 0 9 0ZM10.5 14.6133C10.5 14.8242 10.3359 15 10.1367 15H7.88672C7.67578 15 7.5 14.8242 7.5 14.6133V12.3867C7.5 12.1758 7.67578 12 7.88672 12H10.1367C10.3359 12 10.5 12.1758 10.5 12.3867V14.6133ZM10.4766 10.582C10.4648 10.7461 10.2891 10.875 10.0781 10.875H7.91016C7.6875 10.875 7.51172 10.7461 7.51172 10.582L7.3125 3.30469C7.3125 3.22266 7.34766 3.14063 7.42969 3.09375C7.5 3.03516 7.60547 3 7.71094 3H10.2891C10.3945 3 10.5 3.03516 10.5703 3.09375C10.6523 3.14063 10.6875 3.22266 10.6875 3.30469L10.4766 10.582Z'/%3E%3C/svg%3E");
  107. }
  108. }
  109. [dir="rtl"] .form-item--error-message {
  110. background-position: right top;
  111. }
  112. /**
  113. * Form actions.
  114. */
  115. .form-actions {
  116. display: flex;
  117. flex-wrap: wrap;
  118. align-items: flex-start;
  119. margin-block: var(--sp0-5);
  120. }
  121. .form-actions .button,
  122. .form-actions .action-link {
  123. margin-block: var(--sp0-5);
  124. }
  125. .form-actions .ajax-progress--throbber {
  126. align-self: center;
  127. }
  128. /**
  129. * Custom label placement for editor filter format select.
  130. */
  131. .form-item--editor-format {
  132. display: flex;
  133. flex-wrap: wrap;
  134. align-items: center;
  135. max-width: 100%;
  136. }
  137. .form-item--editor-format .form-item__label,
  138. .form-item--editor-format .form-item__prefix,
  139. .form-item--editor-format .form-item__suffix,
  140. .form-item--editor-format .form-element--editor-format {
  141. min-width: 1px;
  142. }
  143. .form-item--editor-format .form-item__label,
  144. .form-item--editor-format .form-item__prefix,
  145. .form-item--editor-format .form-item__suffix {
  146. margin-inline-end: var(--sp0-5);
  147. }
  148. .form-item--editor-format .form-item__description,
  149. .form-item--editor-format .form-item--error-message {
  150. flex: 0 1 100%;
  151. min-width: 1px;
  152. }
  153. /**
  154. * Inline forms.
  155. */
  156. .form--inline {
  157. & > * {
  158. display: inline-block;
  159. margin-top: var(--sp0-5);
  160. margin-bottom: 0;
  161. vertical-align: top; /* Ensure proper alignment if description is present. */
  162. }
  163. & .form-item__label {
  164. margin: 0;
  165. }
  166. & .form-actions {
  167. margin-top: var(--sp1-5);
  168. }
  169. }

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