Fieldsets

Last updated on
13 April 2018

Use when

  • There are a lot of form elements which need to be grouped logically
  • There are very different form elements on a page
  • There are very similar form elements, but with a distinctive difference

Recommendations

  • Don't put a fieldset around the main (first) interaction on the page if there is one
  • Keep the label short and concrete
  • Fieldset contents should stay within one page scroll
  • Avoid nested fieldsets, it disorients the user
  • Position default-collapsed fieldsets below expanded ones
  • If a fieldset is collapsible, the default state should be collapsed (if it's that important to show its content initially, don't make it collapsible)

Problem

Pages with a lot of form elements without grouping and hierarchy are confusing and hard to use and get used to. Some form elements are not important enough to see all the time.

Solution

Group related form elements with a fieldset.
A fieldset is placed around these form elements. The fieldset can be made collapsable.

Drupal 8 - When to use Details over Fieldsets

  • When you are looking to visually organize a group of form elements.

API

Drupal 7, Drupal 6, Drupal 8

Help improve this page

Page status: No known problems

You can: