Add `form-item` class to the edit-FIELDNAME-wrapper alongside field--widget-readonly-field-widget

Created on 19 August 2025, 4 days ago

Problem/Motivation

Drupal core's admin theme Claro styles field-item to have margin-block: var(--space-l); which is very important for the spacing of forms.

In general i think form-item is expected on items in a form for consistent styling.

Adding the class with a template override is not convenient because it is on the suggestion-less container template (although it is possible Twig Template Suggester β†’ could help with that).

Proposed resolution

Add this class, possibly with an option to add it or not.

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Active

Version

2.1

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mlncn Minneapolis, MN, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @mlncn
  • @mlncn opened merge request.
  • πŸ‡ΊπŸ‡ΈUnited States mlncn Minneapolis, MN, USA

    Seems the best solution, despite adding one more nested div, is to add the form-element template as a wrapper, which should let all themes treat form items as they thing they should be treated.

    Happy to add a configuration option for this, disabled by default, if at most we want an optional change that does not impact existing sites at all.

Production build 0.71.5 2024