Skip to content

Table ​

Data table with sorting, pagination, selection, loading, and error states.

Open in Storybook

Interactive Demo ​

Name
Email
Status
John Doe
john@example.com
Active
Jane Smith
jane@example.com
Pending
Alex Brown
alex@example.com
Active
Sarah Wilson
sarah@example.com
Inactive

Usage ​

vue
<script setup>
import { Table } from '@yellowcard/b2b-design-system';

const columns = [
  { key: 'name', label: 'Name', sortable: true },
  { key: 'email', label: 'Email' },
  { key: 'status', label: 'Status' },
];

const rows = [
  { name: 'John Doe', email: 'john@example.com', status: 'Active' },
  { name: 'Jane Smith', email: 'jane@example.com', status: 'Pending' },
];
</script>

<template>
  <Table :columns="columns" :rows="rows" hoverable />
</template>

API Reference ​

Props ​

PropTypeDefaultDescription
columns*Column[]—Column definitions with key, label, sortable
rows*object[]—Row data array
showHeaderbooleantrueShow table header
hoverablebooleanfalseHighlight rows on hover
selectablebooleanfalseEnable row selection
selectedRowsarray—Currently selected rows
paginationbooleanfalseEnable pagination
currentPagenumber—Current page number
rowsPerPagenumber—Rows per page
totalItemsnumber—Total item count for server pagination
localSortbooleantrueSort locally vs emit events
sortBystring—Current sort column key
sortOrder'asc' | 'desc'—Sort direction
loadingbooleanfalseLoading state
errorbooleanfalseError state
emptyStateMessagestring—Message when no rows
compactbooleanfalseCompact row spacing

Events ​

EventPayloadDescription
update:currentPagenumberPage changed
update:selectedRowsobject[]Selection changed
sort{ key: string, order: string }Sort requested
row-clickobjectRow clicked