Skip to content

Table

A table component for displaying rows of data.

Basic Usage

NameAgeAddress
John Brown32New York No. 1 Lake Park
Jim Green42London No. 1 Lake Park
Joe Black32Sidney No. 1 Lake Park
With Stripe and Border
NameAgeAddress
John Brown32New York No. 1 Lake Park
Jim Green42London No. 1 Lake Park
Joe Black32Sidney No. 1 Lake Park
vue
<template>
  <Column :gap="20">
    <Table :columns="columns" :dataSource="data" />
    <Text>With Stripe and Border</Text>
    <Table :columns="columns" :dataSource="data" stripe border />
  </Column>
</template>

<script setup lang="ts">
import { Table, Column, Text } from "fluekit";

const columns = [
  { title: "Name", key: "name", width: 150 },
  { title: "Age", key: "age", width: 100, align: "center" },
  { title: "Address", key: "address" },
];

const data = [
  { name: "John Brown", age: 32, address: "New York No. 1 Lake Park" },
  { name: "Jim Green", age: 42, address: "London No. 1 Lake Park" },
  { name: "Joe Black", age: 32, address: "Sidney No. 1 Lake Park" },
];
</script>

API

Table Props

PropertyTypeDefaultDescription
columnsTableColumn[][]Columns configuration
dataSourceany[][]Data array
rowKeystring | ((row: any) => string | number)-Row key
borderbooleantrueWhether to show border
stripebooleanfalseWhether to show stripe
fixedbooleanfalseWhether to use fixed table layout
showHeaderbooleantrueWhether to show header
widthnumber | string-Container width
heightnumber | string-Container height
marginEdgeInsets-Container margin
paddingEdgeInsets-Container padding
decorationBoxDecoration-Container decoration

TableColumn

PropertyTypeDescription
titlestringColumn title
keystringColumn key
widthnumber | stringColumn width
align'left' | 'center' | 'right'Column alignment

Slots

NameDescription
headerCustom header cell content. Scope: { column }
[key]Custom cell content. Scope: { record, index }
emptyCustom empty content

Events

NameDescription
rowClickTriggers when a row is clicked. Callback: (row: any, index: number)