Skip to content

Table

Desktop-grade data table for structured data display, with sorting, stripes, and custom cell rendering.

Basic Usage

Define columns with columns and pass data with data.

NameAgeCity
Alice28New York
Bob32London
Charlie24Tokyo
Diana35Berlin
vue
<script setup>
const columns = [
  { label: 'Name', key: 'name', sortable: true },
  { label: 'Age', key: 'age', align: 'right' },
  { label: 'City', key: 'city' }
]

const data = [
  { id: 1, name: 'Alice', age: 28, city: 'New York' },
  { id: 2, name: 'Bob', age: 32, city: 'London' }
]
</script>

<ATable :columns="columns" :data="data" />

Striped

Set stripe for alternating row backgrounds.

NameAgeCity
Alice28New York
Bob32London
Charlie24Tokyo
Diana35Berlin
vue
<ATable :columns="columns" :data="data" stripe />

Compact

Set size="sm" for compact mode with smaller row height.

NameAgeCity
Alice28New York
Bob32London
Charlie24Tokyo
Diana35Berlin
vue
<ATable :columns="columns" :data="data" size="sm" />

Bordered

Set bordered to show column borders.

NameAgeCity
Alice28New York
Bob32London
Charlie24Tokyo
Diana35Berlin
vue
<ATable :columns="columns" :data="data" bordered />

Custom Cells

Use named slots for custom cell rendering.

NameAgeCity
Alice28 yoNew York
Bob32 yoLondon
Charlie24 yoTokyo
Diana35 yoBerlin
vue
<ATable :columns="columns" :data="data">
  <template #name="{ row }">
    <strong>{{ row.name }}</strong>
  </template>
  <template #age="{ value }">
    <span style="color: var(--color-accent);">{{ value }} yo</span>
  </template>
</ATable>

Loading

Set loading to show a loading overlay.

NameAgeCity
Alice28New York
Bob32London
Charlie24Tokyo
Diana35Berlin
vue
<ATable :columns="columns" :data="data" loading />

API

Props

NameTypeDefaultDescription
columnsTableColumn[]Column definitions
dataRecord<string, any>[]Data source
stripebooleanfalseStriped rows
borderedbooleanfalseColumn borders
size'sm' | 'md''md'Size
loadingbooleanfalseLoading state
rowKeystring'id'Row unique key field

Column Definition

PropertyTypeDescription
labelstringColumn header
keystringField name, also used for named slot
sortablebooleanSortable
widthstringColumn width
align'left' | 'center' | 'right'Text alignment

Slots

Named slots by column.key with { row, value } scope.

Events

NameParametersDescription
sortChange{ key, order }Sort changed

Interaction

  • Click header to sort, three-state cycle (asc → desc → none)
  • Sort indicator icon changes color with state
  • Row hover highlight
  • Loading overlay on loading state
  • Empty data friendly message
  • Compact mode for dense desktop scenarios

MIT License