Skip to content

Table

Shows data in rows and columns, with sortable headers.

ProjectOwner
Studio NorthMaya Chen
AtlasSam Rivera
Field NotesJo Park
table-basic-demo.tsx

Installation

The CLI adds the files, packages, theme variables, and Tailwind plugin that this component uses. Before you run it, set up your project.

Composition

  • TableContainerOptional

    Scrolls the table and keeps the header in view. Column resizing needs it.

    • Table

      Owns selection, sorting, expanded rows, and drag and drop.

      • TableHeader

        Adds the select-all and drag columns when the table needs them.

        • ColumnRepeats

          Set isRowHeader on the column that names each row.

          • ColumnResizerOptional
      • TableBody
        • RowRepeats

          Adds the checkbox and drag handle cells. Put child rows after the cells to make the row expandable.

          • CellRepeats

            Its text stays on one line. Add whitespace-normal to let it wrap.

        • TableLoadMoreItemOptional
      • TableFooterOptional
        • RowRepeats

TableDropIndicator Return it from renderDropIndicator in useDragAndDrop.

Multiple selection

selectionMode="multiple" adds a checkbox column. A disabled row cannot be selected. Also install Checkbox and Badge.

ProjectOwnerStatus
Studio NorthMaya ChenIn progress
AtlasSam RiveraReview
Field NotesJo ParkPublished
SignalMaya ChenIn progress
MorrowAlex KimReview
OrbitSam RiveraPublished
1 selected
table-demo.tsx

Sortable columns

Table does not sort the rows. Sort them in onSortChange.

ProjectOwnerOpen tasks
AtlasSam Rivera8
Field NotesJo Park3
GrainJo Park0
HorizonAlex Kim14
MorrowAlex Kim5
OrbitSam Rivera21
SignalMaya Chen18
Studio NorthMaya Chen12
table-sorting-demo.tsx

Filter invoices

renderEmptyState shows a message when no rows match.

Status
8 of 8 invoices
InvoiceCustomerAmountStatus
INV-1048Acme Studio$2,400Paid
INV-1049Northstar Labs$1,180Overdue
INV-1050Fieldwork Co.$3,750Pending
INV-1051Meridian Health$890Paid
INV-1052Paperplane$1,560Pending
INV-1053Atlas Works$4,200Overdue
INV-1054Goodside$640Paid
INV-1055Morrow Design$2,100Pending
table-filter-demo.tsx

Resizable columns

Put the table in TableContainer. Drag a column edge, or focus it and use the arrow keys.

NameOwnerNoteSize
Brand brief.pdfMaya ChenFinal copy for the spring campaign2.4 MB
Accessibility audit.xlsxJo ParkContrast and focus findings from the last review860 KB
Roadmap Q3.keySam RiveraDraft. Needs dates from the platform team14.1 MB
Invoice 2041.pdfAlex KimPaid on 4 June120 KB
table-resizable-demo.tsx

Expandable rows

Put child rows after the cells of a row, and set treeColumn to the column that shows the expand button.

TaskOwnerEstimate
Website launchMaya Chen46 h
BuildSam Rivera22 h
Quality checkAlex Kim6 h
table-expandable-demo.tsx

Reorder rows

Pass dragAndDropHooks to add a drag handle column. To move a row with the keyboard, press Right Arrow to go to the handle, press Enter, then use the arrow keys. Also install Checkbox.

Reorder
TaskOwner
Write the release notesMaya Chen
Update the pricing pageSam Rivera
Record the demo videoJo Park
Send the newsletterAlex Kim
table-reorder-demo.tsx

Load more

TableLoadMoreItem calls onLoadMore when it scrolls into view. The header stays at the top. Also install Spinner.

OrderCustomerTotal
table-load-more-demo.tsx

API reference

vip/ui adds or changes the props below. For all other props, see React Aria Table (opens in a new tab).

Column

allowsResizing: boolean = false
Adds a resize handle at the end of the column. The table must be in TableContainer.