››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
| Part | File | Does |
|---|---|---|
| Table | Table.vue | Groups all parts of the table, which shows data in rows and columns. |
| TableBody | TableBody.vue | Holds the data rows of the table. |
| TableCaption | TableCaption.vue | Describes in a short line what the table shows. |
| TableCell | TableCell.vue | Holds one value in a row of the table. |
| TableEmpty | TableEmpty.vue | Shows a message in place of rows when the table has no data. |
| TableFooter | TableFooter.vue | Holds the summary rows at the bottom of the table, such as totals. |
| TableHead | TableHead.vue | Labels one column of the table. |
| TableHeader | TableHeader.vue | Holds the row of column labels at the top of the table. |
| TableRow | TableRow.vue | Groups 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
Groups all parts of the table, which shows data in rows and columns. Renders a <table>.
Props 1
| Prop | Type | Default | |
|---|---|---|---|
| class | ClassValue | — | |
| |||
Recipe table 1 group
typography typography.small400 0.875rem/1.43 'Inter Variable', Inter, sans-serif
width full
Recipe focus-ring 1 group
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 {5Table,6TableBody,7TableCaption,8TableEmpty,9TableHead,10TableHeader,11TableRow,12} from '@/components/ui/table'1314const columns = ['Order', 'Status', 'Total']15</script>1617<template>18<Table>19<TableCaption>Your recent orders.</TableCaption>20<TableHeader>21<TableRow>22<TableHead23v-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>