Skip to content

Data Display - AvTable

✨ Introduction

The AvTable is a generic tabular data display component for typed data. It is headless on the logic side via TanStack Table, while maintaining full control over HTML/CSS rendering using the design system tokens.

🏗️ Structure

The AvTable consists of:

  • A div wrapper with horizontal scroll and overflow hidden.
  • A semantic table element with caption, thead and tbody.
  • Dynamic slots cell(key) and header(key) per column.
  • Customizable loading and empty states.

🏷️ Props

NameTypeDefaultMandatoryDescription
columnsAvTableColumn<T>[]Column definitions
rowsT[]Data to display
rowKeykeyof T & stringUnique key for each row
loadingbooleanfalseDisplays the loading state
captionstringAccessible table caption
textAlign'start' | 'center' | 'end''start'Horizontal text alignment in all cells

🔊 Events

None.

🎨 Slots

NameExposed PropsDescription
cell(${key}){ row, value, rowIndex }Custom content for a cell
header(${key}){ column, header }Custom content for a header
emptyDisplayed when rows is empty
loadingDisplayed when loading is true

🚀 Storybook demos

You can find examples of use and demo of the component on its dedicated Storybook page.

💡 Examples of use

vue
<AvTable
  :columns="columns"
  :rows="users"
  row-key="id"
  caption="User list"
>
  <template #cell(status)="{ value }">
    <AvBadge :label="value" />
  </template>

  <template #empty>
    <span>No results found.</span>
  </template>
</AvTable>
ts
const columns: AvTableColumn<User>[] = [
  { key: 'lastName', label: 'Last name' },
  { key: 'firstName', label: 'First name' },
  { key: 'status', label: 'Status' },
]