Skip to main content

A responsive table component for displaying structured data with full RTL support. Uses semantic HTML with proper text alignment for bidirectional content.

Preview

A list of recent users
NameEmailStatusRole
Ahmed Aliahmed@example.comActiveAdmin
Fatima Hassanfatima@example.comActiveUser
Mohammed Youssefmohammed@example.comInactiveUser
Sarah Abdullahsarah@example.comActiveEditor

Installation

Terminalbash

Usage

Reacttsx

Composition Pattern

The Table component follows a composition pattern with seven sub-components:

  • Table - Main wrapper with overflow handling
  • TableHeader - thead element for column headers
  • TableBody - tbody element for data rows
  • TableFooter - tfoot element for summary rows
  • TableRow - tr element with hover effects
  • TableHead - th element with text-start for RTL
  • TableCell - td element for data cells
  • TableCaption - caption element for table description

Examples

With Caption

A list of your recent transactions
InvoiceStatusMethodAmount
INV-001PaidCredit Card$250.00
INV-002PendingPayPal$150.00
INV-003PaidBank Transfer$350.00
tsx

Interactive Table with Checkboxes

NameEmailRole
Ahmed Aliahmed@example.comAdmin
Fatima Hassanfatima@example.comUser
Mohammed Youssefmohammed@example.comUser
Sarah Abdullahsarah@example.comEditor
tsx

Mobile Responsive Table

This table adapts to mobile screens by showing a 2-column layout (label + value) instead of horizontal scrolling. Resize your browser to see it in action.

Name
Ahmed Ali
Email
ahmed@example.com
Status
Active
Role
Admin
Name
Fatima Hassan
Email
fatima@example.com
Status
Active
Role
User
Name
Mohammed Youssef
Email
mohammed@example.com
Status
Inactive
Role
User
Name
Sarah Abdullah
Email
sarah@example.com
Status
Active
Role
Editor
tsx

Props

Table

NameTypeDefaultDescription
className
stringundefinedAdditional CSS classes to apply

TableHeader

NameTypeDefaultDescription
className
stringundefinedAdditional CSS classes to apply to thead

TableBody

NameTypeDefaultDescription
className
stringundefinedAdditional CSS classes to apply to tbody

TableRow

NameTypeDefaultDescription
className
stringundefinedAdditional CSS classes to apply to tr

TableHead

NameTypeDefaultDescription
className
stringundefinedAdditional CSS classes to apply to th (uses text-start for RTL support)

TableCell

NameTypeDefaultDescription
className
stringundefinedAdditional CSS classes to apply to td

TableCaption

NameTypeDefaultDescription
className
stringundefinedAdditional CSS classes to apply to caption

Accessibility

Semantic HTML

Uses proper semantic table elements (table, thead, tbody, tfoot, th, td) for screen reader compatibility and accessibility.

Table Caption

Always include a TableCaption to describe the table's purpose for screen reader users. The caption can be visually hidden if needed while remaining accessible.

Column Headers

TableHead components render as th elements, which are automatically associated with their column's cells by assistive technologies.

Keyboard Navigation

For interactive tables, ensure all interactive elements (buttons, checkboxes) are keyboard accessible with proper tab order and focus indicators.

RTL Considerations

Tables automatically support RTL layout. All text alignment uses text-start which adapts to the text direction automatically.

LTR (English)

NameStatusEmail
Ahmed AliActiveahmed@example.com

RTL (العربية)

الاسمالحالةالبريد الإلكتروني
أحمد علينشطahmed@example.com

Use Cases

Data listings and records

Comparison tables

Settings and configuration grids

Pricing and feature comparison

Best Practices

Do

  • Use sticky headers for long scrollable tables
  • Right-align numeric columns for easy scanning
  • Provide responsive behavior (horizontal scroll or card view)

Don't

  • Don't use for layout purposes — use CSS Grid/Flex
  • Don't hide important columns on mobile without indication
  • Don't use tables for fewer than 3 rows of data

Related Components