Table

A complete table component system for displaying structured data with proper semantics, styling, and accessibility features.

Basic Table

A list of recent transactions
DateDescriptionAmount
2025-01-28Office Supplies$45.00
2025-01-27Software License$299.00
2025-01-26Team Lunch$120.00

With Status Badges

TaskStatusPriority
Implement authenticationCompleteHigh
Write documentationIn ProgressMedium
Code reviewPendingLow

Components

NameTypeDefaultDescription
TableComponent-Root table wrapper with overflow handling
TableHeaderComponent-Table header section (thead)
TableBodyComponent-Table body section (tbody)
TableRowComponent-Table row with hover states
TableHeadComponent-Table header cell (th)
TableCellComponent-Table data cell (td)
TableCaptionComponent-Table caption for accessibility

Usage Guidelines

When to use

  • For displaying structured, tabular data
  • For comparison of items across multiple attributes
  • For data that benefits from sorting or filtering
  • When rows and columns have semantic meaning

Best practices

  • Always include TableCaption for accessibility
  • Use TableHead in TableHeader for column labels
  • Keep tables simple - avoid nested tables
  • Consider alternative layouts (cards) for mobile
  • Use proper semantic HTML structure
  • Add hover states to help users scan rows

Accessibility

  • TableCaption provides context for screen readers
  • Proper thead/tbody structure aids navigation
  • Table headers (th) are programmatically associated with data cells
  • Keyboard users can navigate cell by cell
  • Consider aria-label or aria-describedby for complex tables

Do's and Don'ts

Do

  • Always include a caption for accessibility
  • Use semantic table structure (thead, tbody)
  • Keep table data scannable with clear headers
User list
NameEmail
John Doejohn@example.com

Don't

  • Don't omit table captions
  • Don't use tables for layout purposes
  • Don't nest tables within table cells
No headersHard to understand

Related Components

Resources