Skip to content
Star

PxDataTable

A responsive data table component built on native HTML <table>. Supports single/multiple row selection, expandable rows, skeleton loading states, striped rows, elegant empty states, and custom cell rendering via named slots.

Basic Usage

Demo
Name
Role
Status
Joined
Alice JohnsonDesignerActive2023-01-15
Bob SmithEngineerActive2022-07-20
Carol WilliamsProductAway2023-03-08
David BrownEngineerActive2021-11-30
Eva MartinezDesignerInactive2024-01-01
Showing 1 to 5 of 5 items
1 / 1

Multiple Selection

Multiple Selection
Name
Role
Status
Joined
Alice JohnsonDesignerActive2023-01-15
Bob SmithEngineerActive2022-07-20
Carol WilliamsProductAway2023-03-08
David BrownEngineerActive2021-11-30
Eva MartinezDesignerInactive2024-01-01
Showing 1 to 5 of 5 items
1 / 1

Selected: None

Striped Rows & Skeleton Loading

Skeleton Loaders
Name
Role
Status
Joined
Showing 1 to 5 of 5 items
1 / 1

Empty States (Icons)

Empty States
Name
Role
Status
Joined

No data found in your inbox

Name
Role
Status
Joined

No results match your search

Custom Cell Rendering

Use slotName on a column to render custom content in that cell:

vue
<PxDataTable :items="items" :columns="columns">
  <template #status="{ data }">
    <span
      class="badge"
      :class="data.status === 'Active' ? 'badge-green' : 'badge-gray'"
    >
      {{ data.status }}
    </span>
  </template>
</PxDataTable>

Define slotName on the column definition:

ts
const columns = [
  { field: 'name', header: 'Name' },
  { field: 'status', header: 'Status', slotName: 'status' },
]

Export to Excel & CSV

Exportable Table

Team Directory

5
Name
Role
Status
Joined
Alice JohnsonDesignerActive2023-01-15
Bob SmithEngineerActive2022-07-20
Carol WilliamsProductAway2023-03-08
David BrownEngineerActive2021-11-30
Eva MartinezDesignerInactive2024-01-01
Showing 1 to 5 of 5 items
1 / 1

API Reference

PropTypeDefaultDescription
items
Record[]() => []
loading
booleanfalse
columns
ColumnDef[]() => []
rows
number10
rowsPerPageOptions
number[]() => [10, 20, 50]
enableRowDblClick
booleanfalse
selectionMode
"single" | "multiple"undefined
selectedItems
Record[]() => []
stripedRows
booleanfalse
emptyMessage
string"No data available"
searchEmptyMessage
string"No results found"
isSearching
booleanfalse
rowGroupMode
"subheader" | "rowspan"undefined
groupRowsBy
string | string[]undefined
sortMode
"single" | "multiple""single"
sortField
stringundefined
sortOrder
number1
expanderCondition
TSFunctionTypeundefined
paginated
booleantrue
exportable
booleanfalse
exportFileName
string"table-export"
exportFormats
TSParenthesizedType[]() => ["csv", "excel"]
title
stringundefined

ColumnDef Interface

ts
interface ColumnDef {
  field: string          // Property name from the row object
  header: string         // Column header text
  slotName?: string      // Named slot for custom cell rendering
  style?: string | Record<string, string>  // CSS styles for the column
  sortable?: boolean     // When true, enables column sorting on click
  frozen?: boolean       // Reserved (not implemented)
}

Exposed Methods

Access these methods via template ref:

ts
const tableRef = ref<InstanceType<typeof PxDataTable> | null>(null)

// Export programmatically
tableRef.value?.exportCSV({ filename: 'custom-export', selectedOnly: false })
tableRef.value?.exportExcel({ filename: 'custom-export', selectedOnly: false })

Built with VitePress