Getting started
v-table-system is a data table. It comes in two forms:
- a Vue 3 component,
VTable, covered in this guide - a web component,
<v-table-system>, for React, Next.js, Angular, Astro, Svelte and plain HTML
Both have the same features and the same options.
Install
bash
npm install v-table-systemVue 3.4 or newer is required for the Vue component. The styles are included, there is no CSS file to import.
Your first table
Give the table its columns and its data. With clientSide the table sorts, searches and paginates the array by itself.
vue
<template>
<VTable :columns="columns" :data="products" clientSide :itemsPerPage="5" />
</template>
<script setup lang="ts">
import { VTable, type Column } from "v-table-system";
import { products } from "./data";
const columns: Column[] = [
{ key: "id", label: "ID" },
{ key: "name", label: "Name" },
{ key: "category", label: "Category" },
{ key: "price", label: "Price" },
];
</script>The examples in this guide all use the same list of 48 products:
ts
export interface Product {
id: number;
name: string;
category: string;
price: number;
stock: number;
status: "active" | "draft";
}
const names = ["Keyboard", "Mouse", "Monitor", "Headset", "Webcam", "Laptop stand", "USB hub", "Desk lamp"];
const categories = ["Accessories", "Displays", "Audio", "Office"];
// 48 products, always the same so the examples are easy to follow
export const products: Product[] = Array.from({ length: 48 }, (_, i) => ({
id: i + 1,
name: `${names[i % names.length]} ${Math.floor(i / names.length) + 1}`,
category: categories[(i * 3) % categories.length],
price: 15 + ((i * 37) % 180),
stock: (i * 11) % 60,
status: i % 4 === 0 ? "draft" : "active",
}));Client-side and server-side data
| Client-side | Server-side | |
|---|---|---|
| How | Add the clientSide prop | Leave clientSide out |
data holds | Every row | Only the rows of the current page |
| Search, sort, paging | Done by the table | Done by your API, the table emits events |
| Good for | Data already loaded in the browser | Large or remote data |
Most pages of this guide use clientSide to keep the examples short. Server-side data shows the other way.
Next steps
- Columns to control what each column shows
- Sorting, search and pagination
- The full list of props, events and slots in the API reference