GitHub

Data Table

Server-driven data table with sortable columns, filterable headers, pagination, and htmx integration.

<rhx-data-table>

Examples

Basic Table

Product inventory
NameCategoryPriceStock
Wireless MouseElectronics¤29.99150
Mechanical KeyboardElectronics¤89.9975
USB-C HubElectronics¤45.00200
Standing DeskFurniture¤499.9930
Monitor ArmFurniture¤119.0060
Desk LampFurniture¤35.50120
NotebookStationery¤4.99500
Gel Pens (10 pack)Stationery¤12.99300
Webcam HDElectronics¤69.9990
Ergonomic ChairFurniture¤349.0025
Sticky NotesStationery¤3.49800
HeadsetElectronics¤59.99110

Bordered & Compact

NameCategoryPrice
Wireless MouseElectronics¤29.99
Mechanical KeyboardElectronics¤89.99
USB-C HubElectronics¤45.00
Standing DeskFurniture¤499.99
Monitor ArmFurniture¤119.00

With Pagination

NameCategoryPriceStock
Wireless MouseElectronics¤29.99150
Mechanical KeyboardElectronics¤89.9975
USB-C HubElectronics¤45.00200
Standing DeskFurniture¤499.9930
Monitor ArmFurniture¤119.0060
Desk LampFurniture¤35.50120
NotebookStationery¤4.99500
Gel Pens (10 pack)Stationery¤12.99300
Webcam HDElectronics¤69.9990
Ergonomic ChairFurniture¤349.0025
Showing 1–10 of 12

htmx Integration (Sort + Pagination)

Stock
Wireless Mouse¤29.99150
Mechanical Keyboard¤89.9975
USB-C Hub¤45.00200
Standing Desk¤499.9930
Monitor Arm¤119.0060
Desk Lamp¤35.50120
Notebook¤4.99500
Gel Pens (10 pack)¤12.99300
Webcam HD¤69.9990
Ergonomic Chair¤349.0025
Showing 1–10 of 12

Click column headers to sort. Pagination buttons load new pages via htmx.

Properties

Property Type Default Description
rhx-striped bool false Alternating row backgrounds
rhx-hoverable bool false Row hover highlight
rhx-bordered bool false Cell borders
rhx-compact bool false Reduced padding
rhx-sticky-header bool false Sticky header on scroll
rhx-loading bool false Show loading overlay
rhx-empty-message string "No data" Message when table body is empty
rhx-sort-url string - Base URL for sort/filter htmx requests
rhx-caption string - Accessible caption text
rhx-label string - aria-label for the table

Column Properties

Properties for <rhx-column> elements.

Properties

Property Type Default Description
rhx-field string - Property name for sort/filter query params
rhx-header string - Display header text
rhx-sortable bool false Enable sorting on this column
rhx-sort-direction string? null Current sort: asc, desc, or null
rhx-filterable bool false Enable filter input in header
rhx-filter-value string? null Current filter value
rhx-width string? null CSS width (e.g., 200px, 30%)
rhx-align string start Text alignment: start, center, end

Pagination Properties

Properties for <rhx-data-table-pagination> elements.

Properties

Property Type Default Description
rhx-page int 1 Current page number (1-based)
rhx-page-size int 10 Rows per page
rhx-total-items int 0 Total row count
rhx-url string - Base URL for page requests
rhx-target string? - htmx target for page requests

Accessibility

  • The table uses role="grid" with aria-label for assistive technology recognition.
  • Sort buttons render as native <button> elements with aria-sort reflecting the current state.
  • Filter inputs have aria-label describing which column they filter.
  • Pagination buttons have aria-label for each action (first, previous, next, last page).
  • Loading state sets aria-busy="true" on the container.
  • The <caption> element provides an accessible description of the table's purpose.