-
Notifications
You must be signed in to change notification settings - Fork 0
Using patterns in a view
Stephen Mustgrave edited this page Aug 2, 2024
·
1 revision
In this example we are going to use views to create a USWDS accordion group. See https://designsystem.digital.gov/components/accordion/ for options available.
Starting with a default view page, preconfigured to filter by "Articles"

- For this example we want to use fields vs content display. So change the "Show" setting under Format from "Content" to "Fields"
- Add "Title" and "body" fields
- Change the format from "Unformatted List" to "Component (UI Patterns)"
- Here we need to select "Accordion". Since this determines what the wrapper around the rows are we need the accordion and rows will be "Accordion item". Should see the follow page.
- "Content" is the slot available to the "Accordion" pattern, see accordion.component.yml. For this example add "Content: View rows" under the Content slot.
- Now we need to pass the rows into the "Accordion item" pattern. Under Format change "Show" from "Fields" to "Component (UI Patterns)".
- Select "(Accordion item)". Now there will be 2 slots for this pattern "Title" and "Content". Under each slot select "View field" and select title/body for the respective slot. See
- Save everything!
- Preview is still a work in progress so go to the page URL https://drupal-govcon-2024-ui-patterns.ddev.site/ui-pattern-view-example
Congratulations! Just made an accordion without having to write any code!.
In the same view
- Create a new page
- Instead of accordions make a USWDS Process List