Data view toggle buttons enable users to switch between data views depending on their individual preferences or needs. Data views may include card view (displaying data in cards that form a grid), table view (displaying data in a data table), or list view (displaying data in full-width cards that form a list).

The ability to toggle between data views is beneficial to users for a number of reasons:

Contributors

Jennifer Gregory Gabriel Weinberg

Slack channel

If one exists, paste a link to the working Slack channel...

Paragon Jira ticket

Insert a link to the Paragon ticket or epic for this component...

Other Jira tickets

Insert links to related work...

Design resources

Insert links to Figma or Miro design specs or explorations...

Technical docs

Insert a link to the tech docs when they are created...

Similar components:

Content views

Toggle button


Design

https://www.figma.com/file/rfZHEJrPGe0oEg94Lofs7D/Catalog-exploration?node-id=509%3A361https://www.figma.com/file/xwUFqCJfistYaqvuAAhpgr/Search-enhancements?node-id=861%3A8978https://www.figma.com/file/qVBB0zuI9tcolyB9ylIrOF/Content-Library-Editing-Low-Fi?node-id=639%3A12130

(blue star) Variants

Depending on the use case, the toggle button might switch between card view and list view, card view and table view, or (to discuss) between all three views. We expect most scenarios would only require toggle buttons between table view and card view, or list view and card view, as list view and table view serve similar user needs in different ways. Note: Design for all three views as well as hifi iterations are forthcoming.

Future Variant Considerations


(blue star) Best Practices

Do

Don't

(blue star) Related Components


(blue star) Specification

Existing Paragon resources as listed above in Related Components can be leveraged.

This proposal would create a new UI toggle button component that will allow the user to switch between existing table and card views. Additionally, list view would provide a new data view option, taking advantage of the existing card component displayed at a full-width horizontal orientation.

(blue star) Behaviors

Toggle buttons

  • Icon-based toggle buttons group related view options together, similar to a Button Group.

    • A default view can be designated on a case by case basis depending on the primary use case for the data displayed. The default view’s button should be displayed in an active state prior to user interaction.

    • User is able to select an alternate view by selecting an inactive button, which automatically refreshes the data displayed on the page to correspond to the selected view.

    • User can exclusively select one button at a time; selecting one option deselects any other.

Responsive behavior

  • The default view should be overridden when the parent page is loaded on a mobile device or other small viewport (width TBD) to card view to optimize readability and reduce horizontal scrolling.

(blue star) Accessibility

Accessibility considerations

  • Include appropriate ALT text for each button

  • Pressed state should not use color alone as indicator (or the difference in colors must be >=3:1 contrast - confer with Jeff to confirm)

  • Any text needs to have >=4.5:1 luminance contrast vs. background


Notes

05.27.2021

88df93d9-45a5-4b05-aa0a-2a357144f8cc36c711c2-c564-41ea-9803-80646a4e8e23DECIDEDListViewItem: return to this group after more design work is done864a69ea-3509-4481-bfbd-3127472a8e01DECIDEDWe agree the Toggle should live inside DataTable7582c769-d0e4-45b6-bc62-a60c98a50ca8DECIDEDYes, we want pattern in Paragon