Package Exports
- vue3-flexi-data-table
- vue3-flexi-data-table/components/DynamicTable.vue
- vue3-flexi-data-table/components/FlexiTable.vue
- vue3-flexi-data-table/components/PopupEditLabel.vue
- vue3-flexi-data-table/components/TableEditor.vue
- vue3-flexi-data-table/dist/components/DynamicTable.vue.d.ts
- vue3-flexi-data-table/dist/components/FlexiTable.vue.d.ts
- vue3-flexi-data-table/dist/components/PopupEditLabel.vue.d.ts
- vue3-flexi-data-table/dist/components/TableEditor.vue.d.ts
- vue3-flexi-data-table/dist/constants/VfType.d.ts
- vue3-flexi-data-table/dist/constants/symbols.d.ts
- vue3-flexi-data-table/dist/enums/table.enum.d.ts
- vue3-flexi-data-table/dist/icons/bookmark.png
- vue3-flexi-data-table/dist/icons/envelope.png
- vue3-flexi-data-table/dist/icons/home.png
- vue3-flexi-data-table/dist/icons/marker.png
- vue3-flexi-data-table/dist/icons/paper-plane.png
- vue3-flexi-data-table/dist/icons/phone-call.png
- vue3-flexi-data-table/dist/icons/settings.png
- vue3-flexi-data-table/dist/icons/star.png
- vue3-flexi-data-table/dist/icons/user.png
- vue3-flexi-data-table/dist/icons/users-alt.png
- vue3-flexi-data-table/dist/index.d.ts
- vue3-flexi-data-table/dist/interfaces/table.d.ts
- vue3-flexi-data-table/dist/interfaces/vfield.d.ts
- vue3-flexi-data-table/dist/style.css
- vue3-flexi-data-table/dist/types/index.d.ts
- vue3-flexi-data-table/dist/utils/parse.d.ts
- vue3-flexi-data-table/dist/vite.svg
- vue3-flexi-data-table/dist/vue3-flexi-data-table.js
- vue3-flexi-data-table/dist/vue3-flexi-data-table.js.map
- vue3-flexi-data-table/dist/vue3-flexi-data-table.umd.cjs
- vue3-flexi-data-table/dist/vue3-flexi-data-table.umd.cjs.map
- vue3-flexi-data-table/style.css
Readme
Vue3 Flexi Data Table
A flexible data table component for Vue 3 with rich features.
Features
- 🔄 Dynamic column configuration
- 📱 Responsive design
- ✨ Rich data display options
- 🎯 Custom field rendering
- 🔍 Column sorting
- Configure sortable fields in column editor
- Click header to cycle through sort states (ascending → descending → no sort)
- Only one column can be sorted at a time
- ✅ Row selection
- Single/Multiple row selection
- Select all/Deselect all
- Get/Set selected rows programmatically
- 🎨 Flexible styling
- Column alignment (horizontal & vertical)
- Custom width settings (fixed, min, max)
- Custom CSS for header and cells
- 🏷️ Label system
- Create and manage custom labels
- Style labels with colors and sizes
- 🛠️ Rich customization options
- Column reordering via drag & drop
- Column type support (data/select)
- Symbol and icon integration
Screenshot

License
MIT
Author
Tanmv
- GitHub: tanmv
Contact for work
- Email: tanmv@mpos.vn
- Telegram: @tanmac
- Skype: trai_12a1
Installation
npm install vue3-flexi-data-tableComponents
FlexiTable
The main table component that displays data with configured columns.
<template>
<FlexiTable
ref="flexiTableRef"
v-model="layoutId"
:layouts="layouts"
:templates="vfFields"
:actions="actions"
:icons="icons"
:data="dataTable"
:label-presets="labelPresets"
@onCta="onCta"
@error="onErrorHandle"
@save="onSaveHandle"
@remove="onRemoveHandle"
@setDefault="onSetDefaultHandle"
@selectChange="onSelectChange"
@sortChange="onSortChange"
>
<template #actions>
<!-- Custom actions slot -->
</template>
</FlexiTable>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { FlexiTable, VfType } from 'vue3-flexi-data-table';
const flexiTableRef = ref();
const layoutId = ref('default');
// Define layouts
const layouts = ref([
{
id: 'default',
name: 'Default Layout',
isDefault: true,
columns: [
{
title: 'ID',
fieldCodes: ['id'],
sortField: 'id'
},
{
title: 'Name',
fieldCodes: ['name'],
sortField: 'name'
},
{
title: 'Status',
fieldCodes: ['status'],
sortField: 'status'
},
{
title: 'Actions',
fieldCodes: ['view', 'edit', 'delete']
}
]
}
]);
// Define templates
const vfFields = ref([
{
vfCode: 'status',
vfType: VfType.LABEL,
vfTitle: 'Status',
vfAcutalField: 'status'
}
]);
// Define actions
const actions = ref([
{
vfCode: 'view',
vfType: VfType.ACTION,
vfTitle: 'View'
},
{
vfCode: 'edit',
vfType: VfType.ACTION,
vfTitle: 'Edit'
},
{
vfCode: 'delete',
vfType: VfType.ACTION,
vfTitle: 'Delete'
}
]);
// Sample data
const dataTable = ref([
{
id: 1,
name: 'John Doe',
status: 'active'
},
{
id: 2,
name: 'Jane Smith',
status: 'inactive'
}
]);
// Event handlers
const onCta = (action: string, row: any) => {
console.log('Action clicked:', action, row);
};
const onErrorHandle = (error: Error) => {
console.error('Error:', error);
};
const onSaveHandle = (layout: any) => {
console.log('Layout saved:', layout);
};
const onRemoveHandle = (layoutId: string) => {
console.log('Layout removed:', layoutId);
};
const onSetDefaultHandle = (layoutId: string) => {
console.log('Set default layout:', layoutId);
};
const onSelectChange = (selectedRows: any[]) => {
console.log('Selected rows:', selectedRows);
};
const onSortChange = (sort: { field: string; direction: string }) => {
console.log('Sort changed:', sort);
};
</script>Props
FlexiTable Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
| modelValue | string |
Yes | - | Layout ID (v-model) |
| layouts | Layout[] |
Yes | - | Array of table layouts |
| templates | VfField[] |
Yes | - | Field templates configuration |
| actions | VfField[] |
No | [] |
Action buttons configuration |
| icons | VfField[] |
No | [] |
Icon configuration |
| data | any[] |
Yes | - | Table data |
| labelPresets | LabelPreset[] |
No | [] |
Predefined label styles |
| height | number |
No | 400 |
Table height in pixels |
| fixed | boolean |
No | false |
Enable fixed header |
Layout Interface
interface Layout {
id: string;
name: string;
isDefault?: boolean;
columns: Column[];
}Column Interface
interface Column {
title: string;
fieldCodes: string[];
sortField?: string;
width?: string;
align?: 'left' | 'center' | 'right';
verticalAlign?: 'top' | 'middle' | 'bottom';
}VfField Interface
interface VfField {
vfCode: string;
vfType: VfType;
vfTitle?: string;
vfAcutalField?: string;
vfRenderFunc?: (row: any, field: VfField, index: number) => string;
}Events
| Event | Parameters | Description |
|---|---|---|
| onCta | (action: string, row: any) |
Triggered when an action button is clicked |
| error | (error: Error) |
Triggered when an error occurs |
| save | (layout: Layout) |
Triggered when a layout is saved |
| remove | (layoutId: string) |
Triggered when a layout is removed |
| setDefault | (layoutId: string) |
Triggered when a layout is set as default |
| selectChange | (selectedRows: any[]) |
Triggered when row selection changes |
| sortChange | (sort: { field: string; direction: string }) |
Triggered when sorting changes |
Methods
You can access these methods using a template ref:
const flexiTableRef = ref();
// Get selected rows
const selectedRows = flexiTableRef.value.getSelected();
// Set selected rows
flexiTableRef.value.setSelect([0, 1, 2]);
// Clear selection
flexiTableRef.value.clearSelect();
// Get current layout
const currentLayout = flexiTableRef.value.getCurrentLayout();
// Set layout
flexiTableRef.value.setLayout('layoutId');Styling
The component uses CSS variables for easy customization:
:root {
--vft-primary-color: #1890ff;
--vft-border-color: #f0f0f0;
--vft-header-bg: #fafafa;
--vft-row-hover-bg: #f5f5f5;
--vft-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto;
}Contributing
- Fork it!
- Create your feature branch:
git checkout -b feature/my-new-feature - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin feature/my-new-feature - Submit a pull request
Support
If you have any questions or need help, please:
- Check the documentation
- Open an issue on GitHub
- Contact the author