Skip to content

Table

Neo-brutalist data table with 8 composable sub-components for structured tabular data display. Built on native HTML table elements, supporting header variants, footer variants, and accessibility labels.

Demo

Preview
名称状态金额
发票 #001已支付$250.00
发票 #002待处理$150.00

自定义 aria-label

名称金额
发票 #001$250.00
发票 #002$150.00

Installation

pnpm dlx brutx-vue@latest add table

Usage

vue
<script setup>
import { Table, TableHeader, TableBody, TableHead, TableRow, TableCell, TableCaption, TableFooter } from 'brutx-ui-vue'
</script>

<template>
    <Table>
        <TableCaption>A list of your recent invoices.</TableCaption>
        <TableHeader>
            <TableRow>
                <TableHead class="w-[100px]">Invoice</TableHead>
                <TableHead>Status</TableHead>
                <TableHead class="text-right">Amount</TableHead>
            </TableRow>
        </TableHeader>
        <TableBody>
            <TableRow>
                <TableCell class="font-medium">INV001</TableCell>
                <TableCell>Paid</TableCell>
                <TableCell class="text-right">$250.00</TableCell>
            </TableRow>
            <TableRow>
                <TableCell class="font-medium">INV002</TableCell>
                <TableCell>Pending</TableCell>
                <TableCell class="text-right">$150.00</TableCell>
            </TableRow>
        </TableBody>
        <TableFooter>
            <TableRow>
                <TableCell colspan="2">Total</TableCell>
                <TableCell class="text-right">$400.00</TableCell>
            </TableRow>
        </TableFooter>
    </Table>
</template>

Sub-components

ComponentDescription
TableRoot table container with border and shadow
TableHeaderHeader area (<thead>)
TableBodyBody area (<tbody>)
TableFooterFooter area (<tfoot>)
TableRowTable row (<tr>) with bottom border
TableHeadHeader cell (<th>) with bold text
TableCellData cell (<td>)
TableCaptionTable caption (<caption>)

Props

Common Props

All sub-components accept:

PropTypeDefaultDescription
classstringCustom CSS class

Table

PropTypeDefaultDescription
ariaLabelstringAccessible name for the table, used by screen readers
classstringCustom CSS class

TableHeader / TableHead

PropTypeDefaultDescription
variant'default' | 'primary' | 'secondary''default'Header color variant
classstringCustom CSS class

TableFooter

PropTypeDefaultDescription
variant'default' | 'primary' | 'accent''default'Footer color variant
classstringCustom CSS class

Accessibility

  • ARIA Attributes: Use ariaLabel to provide a readable name for the table, helping screen readers identify the table's purpose. This is especially important for tables without a visible caption (TableCaption). ariaLabel only applies to the Table root component.
vue
<script setup>
import { Table, TableHeader, TableBody, TableRow, TableHead, TableCell } from 'brutx-ui-vue'
</script>

<template>
    <Table ariaLabel="Recent invoices list">
        <TableHeader>
            <TableRow>
                <TableHead>Name</TableHead>
                <TableHead>Amount</TableHead>
            </TableRow>
        </TableHeader>
        <TableBody>
            <TableRow>
                <TableCell>Invoice #001</TableCell>
                <TableCell>$250.00</TableCell>
            </TableRow>
        </TableBody>
    </Table>
</template>
  • Semantic Markup: Uses native <table>, <thead>, <tbody>, <tfoot>, <th>, <td>, <caption> elements to ensure assistive technologies correctly parse the table structure.

Brute force builds.