Skip to main content
Version: Current (v7.0.0-beta.3)

A custom FieldTemplate keeps core's label and description markers to line up

Detect​

  • A custom FieldTemplate in your code that renders its own label or description without the rjsf-field-label class or the rjsf-field-description class or id.
  • The rendered page: inside an array item or an additional property, the item buttons or the key input and remove button sit above or below the field's control.

Change​

An array item's buttons, and an additional property's key input and remove button, sit level with the field's control. rjsf.css lays the field's label, description and control out on the row's grid rows. It finds the label by core's rjsf-field-label class and the description by its rjsf-field-description class or id.

Keep those markers on your template's parts:

-<label htmlFor={id}>{label}</label>
+<label htmlFor={id} className='rjsf-field-label'>{label}</label>

Core's label component is now exported as FieldLabel, see FieldLabel. See Lining up a custom FieldTemplate for the full layout.

Verify​

  • With rjsf.css loaded (see core layout stylesheet), array item buttons and additional-property controls sit level with the field's control in your template.

Also read: