Component: Table

Summary

Tables are essential components for organizing and displaying structured data.

They allow users to scan, compare, and analyze information efficiently. Well-designed tables improve readability, usability, and accessibility, ensuring users can quickly find the data they need without confusion or frustration.

What's a Table?

A table organizes data into rows and columns, making it easier for users to compare and scan information. Unlike lists, which present information sequentially, tables allow users to see relationships between different sets of data at a glance.

Examples of Tables

Tables are commonly used for:

  • Data comparison (e.g., feature comparisons)
  • Forms and schedules (e.g., court hearing schedules, availability tables)
  • Reports and statistics (e.g., case summaries, financial reports)

Horizontal Header Table Example

Header Here  Header Here Header Here
Text Title Link Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 
Text Title Link Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 
Text Title Text Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Vertical Header Table Example

Header Here Lorem ipsum dolor Link
Header Here Lorem ipsum dolor Link
Header Here Lorem ipsum dolor Link

Benefits of Tables

  • Structured Data Presentation: Helps users quickly scan and compare related information.
  • Improved Readability: When designed correctly, tables make complex data easier to digest.
  • Better User Experience: Tables provide an intuitive way to organize content, reducing cognitive load.
  • Accessibility: Proper table markup ensures that assistive technologies can read and navigate tables effectively.

Usability Concerns to Consider

While tables are effective for organizing data, improper use can lead to poor user experiences. Consider the following:

  • Complexity: Avoid overly complex tables with too many rows or columns, which can be hard to scan.
  • Readability: Use clear headings, proper spacing, and avoid unnecessary borders or shading.

When to Use & When to Avoid

When to Use

  • When users need to compare multiple pieces of information at once.
  • When data follows a structured format (e.g., schedules, metrics, financial data).
  • When organizing content that is easier to interpret in a grid format.
  • When users need to export data (e.g., CSV, Excel).

When to Avoid

  • When content is better suited for a bulleted or numbered list.
  • When displaying long-form text (tables should not be used for paragraphs).
  • When the table is overly complex, making it difficult to scan on small screens.

Best Practices

  • Use Clear Headers: Table headers should be descriptive and concise.
  • Keep Columns Logical: Group related information together to help users make quick comparisons.
  • Column Alignment: Use left-aligned text for readability, right-aligned numbers for easy comparison, and center-aligned headings.

Resources

Learn More

To learn more in depth about best practices for tables, visit the NNg website for UX guidelines.

For Developers

You can visit Storybook for Inherited CSS Variables and Twig Variables for the accordion component.