table

Table

Rows and columns of data such as orders, with header, footer, caption and an empty state; a wide table scrolls in its box and takes keyboard focus to do so.

Parts

PartFileDoes
TableTable.vueGroups all parts of the table, which shows data in rows and columns.
TableBodyTableBody.vueHolds the data rows of the table.
TableCaptionTableCaption.vueDescribes in a short line what the table shows.
TableCellTableCell.vueHolds one value in a row of the table.
TableEmptyTableEmpty.vueShows a message in place of rows when the table has no data.
TableFooterTableFooter.vueHolds the summary rows at the bottom of the table, such as totals.
TableHeadTableHead.vueLabels one column of the table.
TableHeaderTableHeader.vueHolds the row of column labels at the top of the table.
TableRowTableRow.vueGroups the cells that belong to one entry of the table.

Anatomy

<Table>
  <TableCaption />
  <TableHeader>
    <TableRow>
      <TableHead />
    </TableRow>
  </TableHeader>
  <TableBody>
    <TableRow>
      <TableCell />
    </TableRow>
  </TableBody>
  <TableFooter>
    <TableRow>
      <TableCell />
    </TableRow>
  </TableFooter>
</Table>

Styling

All of Table’s styles live in table.json. New to styling in Frontic UI? How styling works →

Install

npm packages
@vueuse/core
reka-ui

API reference

Table.vue

Groups all parts of the table, which shows data in rows and columns. Renders a <table>.

Props 1

PropTypeDefault
classClassValue—

Recipe table 1 group

Recipe focus-ring 1 group

TableBody.vue

TableCaption.vue

TableCell.vue

TableEmpty.vue

TableFooter.vue

TableHead.vue

TableHeader.vue

TableRow.vue
Table

Empty

1<!-- SPDX-License-Identifier: FSL-1.1-MIT AND MIT -->2<!-- Frontic UI © Frontic · Portions © 2023 unovue (shadcn-vue, MIT) · ui.frontic.com/license -->3<script setup lang="ts">4import {5  Table,6  TableBody,7  TableCaption,8  TableEmpty,9  TableHead,10  TableHeader,11  TableRow,12} from '@/components/ui/table'13 14const columns = ['Order', 'Status', 'Total']15</script>16 17<template>18  <Table>19    <TableCaption>Your recent orders.</TableCaption>20    <TableHeader>21      <TableRow>22        <TableHead23          v-for="column in columns"24          :key="column"25          :class="{ 'text-end': column === 'Total' }"26          >{{ column }}</TableHead27        >28      </TableRow>29    </TableHeader>30    <TableBody>31      <TableEmpty :colspan="columns.length">No orders yet</TableEmpty>32    </TableBody>33  </Table>34</template>
State