Table

A table displays data in rows and columns and enables a user to navigate and select its contents.

Name
Type
Date Modified
GamesFile folder6/7/2020
Program FilesFile folder4/7/2021
bootmgrSystem file11/20/2010
<Table aria-label="Files">
  <TableHeader>
    <TableColumn isRowHeader>Name</TableColumn>
    <TableColumn>Type</TableColumn>
    <TableColumn>Date Modified</TableColumn>
  </TableHeader>
  <TableBody>
    <TableRow>
      <TableCell>Games</TableCell>
      <TableCell>File folder</TableCell>
      <TableCell>6/7/2020</TableCell>
    </TableRow>
    <TableRow>
      <TableCell>Program Files</TableCell>
      <TableCell>File folder</TableCell>
      <TableCell>4/7/2021</TableCell>
    </TableRow>
    <TableRow>
      <TableCell>bootmgr</TableCell>
      <TableCell>System file</TableCell>
      <TableCell>11/20/2010</TableCell>
    </TableRow>
  </TableBody>
</Table>

Installation

npx shadcn@latest add @dotui/table

Usage

Use tables to display data in rows and columns with support for selection, sorting, and more.

import {
  Table,
  TableBody,
  TableCell,
  TableColumn,
  TableHeader,
  TableRow,
} from "@/components/ui/table";
<Table aria-label="Files">
  <TableHeader>
    <TableColumn isRowHeader>Name</TableColumn>
    <TableColumn>Type</TableColumn>
    <TableColumn>Date Modified</TableColumn>
  </TableHeader>
  <TableBody>
    <TableRow>
      <TableCell>Games</TableCell>
      <TableCell>File folder</TableCell>
      <TableCell>6/7/2020</TableCell>
    </TableRow>
  </TableBody>
</Table>

Playground

Use the controls below to experiment with different table props and see the live preview and code update.

Name
Type
Date Modified
GamesFile folder6/7/2020
Program FilesFile folder4/7/2021
bootmgrSystem file11/20/2010
selectionMode
<Table aria-label="Files" selectionMode="none">
  <TableHeader>
    <TableColumn isRowHeader>Name</TableColumn>
    <TableColumn>Type</TableColumn>
    <TableColumn>Date Modified</TableColumn>
  </TableHeader>
  <TableBody>
    <TableRow>
      <TableCell>Games</TableCell>
      <TableCell>File folder</TableCell>
      <TableCell>6/7/2020</TableCell>
    </TableRow>
    <TableRow>
      <TableCell>Program Files</TableCell>
      <TableCell>File folder</TableCell>
      <TableCell>4/7/2021</TableCell>
    </TableRow>
    <TableRow>
      <TableCell>bootmgr</TableCell>
      <TableCell>System file</TableCell>
      <TableCell>11/20/2010</TableCell>
    </TableRow>
  </TableBody>
</Table>

API Reference

Table

A table displays data in rows and columns and enables a user to navigate its contents via directional navigation keys, and optionally supports row selection and sorting.

PropType
boolean
ReactNode
DragAndDropHooks<object>
SortDescriptor
SelectionMode
SelectionBehavior
Iterable<Key> | "all"
Iterable<Key> | "all"
function
Iterable<Key>
DisabledBehavior
boolean
boolean
"none" | "clearSelection"

TableHeader

A header within a Table, containing the table columns.

PropType
union
Iterable<T>
readonly any[]

TableColumn

A column within a Table.

PropType
boolean
Key
boolean
boolean
string
ColumnSize | null
ColumnSize | null
ColumnStaticSize | null
ColumnStaticSize | null
ReactNode | function

TableBody

The body of a Table, containing the table rows.

PropType
boolean
ReactNode | function
Iterable<T>
function
ReactNode | function
readonly any[]

TableRow

A row within a Table.

PropType
string
T
boolean
Key
union
Iterable<T>
readonly any[]

TableCell

A cell within a table row.

PropType
Key
string
number
ReactNode | function

Last updated on 1/13/2026

Built with passion by @mehdibha.