Skip to content

Data Table

Display records with sorting, filtering, selection, and pagination.

Demos

Size
IPEX
In progress
Igris Labs
Active
2 results

Usage

vue
<script setup lang="ts">
import { Accordion } from '~/components/ui/accordion'

const items = [
  { value: 'source', label: 'Do I own the source?', content: 'Yes. Copy and adapt the files.' },
]
</script>

<template>
  <Accordion :items="items" />
</template>

Sorting and selection

Click a column heading to sort. Add a selection column and bind selection to stable row keys. Selection remains independent of sorting and pagination.

IPEX
In progress
Atlas
Planning
Lynx
Active
Orbit
Archived
Project manager
Active
5 results

0 selected

vue
<AppLayout :viewport="false" scroll="page">
  <template #header>Workspace</template>
  <template #left><ProjectNavigation /></template>
  <ProjectList />
  <template #footer>2 projects</template>
</AppLayout>

Filtering and pagination

Bind globalFilter to your search input. Enable paginate and bind the one-based page and page size. For server data, use the manual filtering and pagination props instead.

IPEX
In progress
Atlas
Planning
5 results
vue
<AppLayout :layout="{ header: 'full', footer: 'content' }">
  <template #left><ProjectNavigation /></template>
  <ProjectList />
  <template #right><ProjectDetails /></template>
</AppLayout>

Expanded details

Add an expander column and isRowExpandable for rows with detail content. Use the expanded slot to render those details.

expand
IPEX
In progress
Atlas
Planning
Lynx
Active
Orbit
Archived
Project manager
Active
5 results
vue
@layer akaza-reset;
@import '@fontsource/inter/latin-400.css';
@import '@fontsource/inter/latin-500.css';
@import '@fontsource/inter/latin-600.css';
@import '@fontsource/jetbrains-mono/latin-400.css';
@import 'tailwindcss';
@import 'akaza-ui/dist/akaza-ui.css';

Empty, loading, and error states

Use the state picker to inspect each result. Supply an actionable error message when loading fails; distinguish it from an empty result.

No results.
0 results
vue
<DataTable :data="projects" :columns="columns" row-key="id" :loading="pending" :error="error" />

Installation

Complete the shared installation. Copy DataTable.vue and index.ts into app/components/ui/data-table/. Also copy the required components: Pagination.

API

Variants and defaults

PropValuesDefault
sizexs, sm, md, lg, xlmd

Models

ModelTypeDefaultDescription
v-model:selectionrowKey | rowKey[] | nullnullSelected stable row keys.
v-model:sortingDataTableSorting[][]Ordered sort descriptors.
v-model:filtersRecord<string, unknown>{}Per-column filter values.
v-model:globalFilterstring""Global search text.
v-model:pagination{ page, pageSize }{ page: 1, pageSize: 10 }One-based page state.
v-model:expandedrowKey[][]Expanded row keys.
v-model:columnVisibilityRecord<string, boolean>{}Column visibility overrides.
v-model:columnOrderstring[][]Leaf column order.
v-model:columnSizingRecord<string, number>{}Column widths in pixels.
v-model:columnPinning{ start: string[], end: string[] }empty sidesPinned leaf columns.
v-model:rowOrderrowKey[][]User-controlled row order.

Props

PropTypeDefaultDescription
datareadonly T[]requiredRows supplied to the table.
columnsreadonly DataTableColumn<T>[]requiredTyped column definitions.
rowKeykeyof T | (row, index) => string | numberrequiredStable row identity.
captionstring—Native table caption text.
ariaLabelstring—Accessible table label when no caption is used.
ariaLabelledbystring—ID of an external table label.
ariaDescribedbystring—IDs describing the table.
loadingbooleanfalseRenders loading state and aria-busy.
errorboolean | string | ErrorfalseRenders error state.
emptyLabelstring"No results."Default empty-state text.
errorLabelstring"Unable to load results."Default non-Error message.
sortingMode"single" | "multiple""single"Number of retained sort descriptors.
manualSortingbooleanfalseDisables client sorting.
manualFilteringbooleanfalseDisables client filtering.
paginatebooleanfalseEnables client pagination.
manualPaginationbooleanfalseTreats supplied data as an API page.
rowCountnumber—Total server row count for manual pagination.
showPaginationbooleantrueShows built-in or slotted pagination.
selectionMode"none" | "single" | "multiple""none"Selection behavior.
selectionBehavior"control" | "row""control"Whether non-interactive row clicks select.
selectAllScope"page" | "filtered""page"Rows affected by select all.
isRowSelectable(row) => booleanall rowsDisables selection per row.
isRowExpandable(row) => booleanrows with childrenEnables detail expansion per row.
getSubRows(row) => readonly T[]—Returns hierarchical child rows.
columnResizeboolean | DataTableColumnResizeOptionsfalseEnables pointer/touch/keyboard resizing.
columnReorderbooleanfalseEnables pointer/touch/keyboard column reorder handles.
rowReorderbooleanfalseEnables pointer/touch/keyboard row reorder handles.
stickyHeaderbooleanfalseKeeps headers at the viewport top.
dir"ltr" | "rtl""ltr"Logical direction for sizing and pinning.
labelsDataTableLabelsEnglish labelsAccessible control and state labels.
rowAttrsHTMLAttributes | (row) => HTMLAttributes—Native attributes/classes for every row.
uiDataTableUi—Classes for structural parts.

Slots

SlotPropsDescription
toolbartableControls above the viewport.
caption—Native caption content.
[column.id]-headerheader contextSpecific header renderer.
headerheader contextGeneric header renderer.
sort-indicatorcolumn, sortedSort direction content.
[column.id]-cellcell contextSpecific cell renderer.
cellcell contextGeneric cell renderer.
expandedrow, tableDetail row content.
[column.id]-footercolumn, tableSpecific footer content.
footercolumn, tableGeneric footer content.
paginationtable, page, pageSize, pageCount, setPage, setPageSizeReplaces default paginator.
loadingtableLoading row content.
errorerror, tableError row content.
emptytableEmpty row content.
expansion-triggerrowExpand/collapse control content.
reorder-handlerowRow drag handle content.
column-reorder-handlecolumnColumn drag handle content.
resize-handlecolumnResize handle content.

Events

Every model emits its update:* event after an accepted change. The paired *-change event fires first with (value, details); details.cancel() prevents the model update.

EventDescription
selection-changeSelection changed.
sorting-changeSort descriptors changed.
filters-changeColumn filters changed.
global-filter-changeGlobal filter changed.
pagination-changePage or page size changed.
expanded-changeExpanded row keys changed.
column-visibility-changeVisibility map changed.
column-order-changeLeaf column order changed.
column-sizing-changeWidth map changed.
column-pinning-changePin sides changed.
row-order-changeRow order changed.
reset-changeAtomic reset requested. Canceling it preserves every model.
row-clickNative row click with row and cancelable details.
row-contextmenuNative row context-menu event with row details.
cell-clickNative cell click with cell context and details.

Keyboard

ControlKeyBehavior
sort headerEnter / SpaceCycles sort direction through its native button.
selection controlSpaceSelects a row or the configured select-all scope.
expansion controlEnter / SpaceOpens or closes row details/children.
resize separatorArrowLeft / ArrowRightChanges width by keyboardStep, respecting RTL.
resize separatorHomeRestores the definition width or 150px.
column reorder handleArrowLeft / ArrowRightMoves the column one visible position.
row reorder handleArrowUp / ArrowDownMoves the row one visible position.
paginationTab, Enter, SpaceUses native Pagination button/link behavior.

Pointer dragging and touch Pointer Events use the same resize and reorder actions. The table does not add spreadsheet-style arrow navigation to ordinary data cells; native table reading and normal document tab order remain intact.