Skip to content

[Discussion] Expandable component and variations #2482

@natalia-fitzgerald

Description

@natalia-fitzgerald

Discussion: Expandable component, variations, usage guidelines, and use cases.

Background

I have started a review of the expandable component as a part of the CFPB Design System in React component verification process. In reviewing the expandable component, I audited the implementations of the "padded expandable" variation. I also reviewed the expandable component more broadly. The purpose of this issue is to both capture details of and discuss the current usage of the expandable component on the website with a focus on the "padded expandable" variation.

Padded expandable

The "padded expandable" variation increases:

  • The size of the expandable label from 18px to 26px
  • The top and bottom padding from 10px to 25px
Expandable Padded expandable
Image Image

Expandable options in Wagtail

The following options are offered in Wagtail for both single expandable or expandable group:

  • Is bordered: Adds a border (o-expandable--border)
  • Is midtone: Adds a gray 5 background color (o-expandable--background)
  • Is expanded: Sets the expandable to be open on load (o-expandable--onload-open)

  • Is expanded padding: Changes the expandable label from 18px (equivalent to H4 in size) to 26 px (equivalent to H2 in size) (o-expandable--padded)
  • Add icon to the left of the expandable label

Expandable (group):

The following options are only available for expandable groups:

  • Heading for the group
  • Body text
  • Is accordion (o-expandable-group--accordion)
  • Has a top rule line
  • Uses FAQ schema
Expandable (single) Expandable (group)
Image Image

For the padded expandable, if a Wagtail user populates the fields as presented, will they end up with an Heading 3 for the group and Expandable labels that are 26px. On the "Learn more" page a workaround is being used where the heading for the expandable group was placed in the body field and styled as an H2.

Expandable group visual results

The following reflects the visual result at desktop if the fields in Wagtail are populated as presented.

  • For the standard expandable group the group heading is an H3 (22px) and the expandable label is 18px.
  • For the expanded padding expandable group the heading is an H3 (22px) and the expandable labels are 26px. So, the heading for the group is smaller than the expandable labels.
"Is expanded padding" not selected "Is expanded padding" is selected
Image Image

Expandable labels and our type hierarchy

In reviewing the styling for expandable labels, I noticed that the expandable labels do not pull in headings from our type hierarchy. At this point in time, the padded expandable label does not align in weight with the CFPB Design System type styles.

Type styles

Expandable

  • Desktop: 18px, Medium (500)
  • Mobile: 16px, Medium (500)

Padded expandable:

  • Desktop: 26px, Medium (500)
  • Mobile: 22px, Medium (500)

CFPB Design System:

  • Heading 2: 26px, Semibold (600)
  • Heading 3: 22px, Regular (400)
  • Heading 4: 18px, Medium (500)
  • Heading 4 (mobile): 16px, Medium (500)

For discussion and exploration

Padded expandable

  • Should we continue to offer the padded expandable? If yes, then continue.
  • For consideration: Change the styling of the expandable to 22px at desktop and 18px mobile
  • Should Wagtail users have the option to use the padded expandable for a single expandable or should this option only be offered for expandable groups that sit under a group heading?
  • Should a Wagtail user of the expandable group module be able to select H2 or H3 for the group heading?
  • Write usage guidelines for the padded expandable
  • Update the name of this variation to be more descriptive. The size/prominence seems to be the defining feature rather than the increase in padding.
  • Should selecting "is padding expanded" apply to individual expandable group items or should it apply to the entire group? Currently a user can apply this on an individual expandable group item which would mean that some expandable labels in the same group could be 26px and others could be 18px.

Expandables (overall)

  • Should the expandable labels correspond to our type hierarchy in both size AND weight?
  • Should it be required to populate the heading field when using an expandable group?
  • What should the defaults styling options be set to in Wagtail?

@jenn-franklin @ajbush @keelerr @itsmedavep @anselmbradford @gogogabby007

Metadata

Metadata

Labels

Needs content writtenUse when page is missing key information, like use casesNeeds discussioncontent enhancementUse when page needs small content fixes: e.g., confusing or redundant content, small additionsdocumentation

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions