Skip to content

Table

Tables display structured data in rows and columns for easy scanning and comparison.

Usage

Use tables to display collections of structured data. Keep tables simple and ensure they're accessible.

Basic Table

NameEmailRoleStatus
John Doejohn@example.comAdminActive
Jane Smithjane@example.comEditorActive
Bob Wilsonbob@example.comViewerInactive
html
<table class="df-table">
  <thead>
    <tr>
      <th>Name</th>
      <th>Email</th>
      <th>Role</th>
      <th>Status</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>John Doe</td>
      <td>john@example.com</td>
      <td>Admin</td>
      <td><span class="df-badge df-badge--success">Active</span></td>
    </tr>
  </tbody>
</table>

Striped Rows

ProductCategoryPriceStock
Widget ProElectronics$99.00150
Gadget PlusElectronics$149.0075
Tool SetHardware$45.00200
Safety GearHardware$29.00500
html
<table class="df-table df-table--striped">...</table>

Hoverable Rows

DateDescriptionAmount
Dec 15, 2025Payment received+$500.00
Dec 14, 2025Service fee-$25.00
Dec 12, 2025Refund issued-$150.00
html
<table class="df-table df-table--hoverable">...</table>

Bordered Table

FeatureBasicProEnterprise
Users110Unlimited
Storage5 GB100 GB1 TB
SupportEmailPriority24/7
html
<table class="df-table df-table--bordered">...</table>

Compact Table

IDNameValue
001Alpha100
002Beta200
003Gamma150
004Delta300
html
<table class="df-table df-table--compact">...</table>

With Selection

NameEmailDepartment
Alice Johnsonalice@example.comEngineering
Bob Smithbob@example.comDesign
Carol Whitecarol@example.comMarketing
html
<tr class="df-table__row--selected">
  <td><input type="checkbox" checked></td>
  <td>Bob Smith</td>
  ...
</tr>

With Actions

ProjectStatusProgressActions
Website RedesignIn Progress
Mobile AppCompleted

Sortable Headers

Name Date Amount
AliceDec 15$150.00
BobDec 14$200.00
CarolDec 13$175.00

Responsive Table

Wrap tables in a .df-table-container for horizontal scrolling on small screens:

html
<div class="df-table-container">
  <table class="df-table">...</table>
</div>

Accessibility

  • Use proper <thead>, <tbody>, and <th> elements
  • Add scope="col" or scope="row" to headers
  • Use aria-sort for sortable columns
  • Ensure sufficient color contrast
  • Provide accessible names for action buttons

Best Practices

  • Keep tables simple and scannable
  • Right-align numeric data
  • Use consistent formatting
  • Consider cards for mobile views
  • Provide sorting and filtering for large datasets

API Reference

Classes

ClassDescription
df-tableBase table class
df-table--stripedStriped rows
df-table--hoverableHighlight on hover
df-table--borderedAll borders
df-table--compactReduced padding
df-table--sortableSortable headers
df-table__row--selectedSelected row
df-table__th--sortableSortable header
df-table__th--sorted-ascAscending sort
df-table__th--sorted-descDescending sort
df-table-containerResponsive wrapper

Built with care by Everforth