📄 Multiple Export Types
Support for exporting all data, selected data, current page data, and filtered data
A powerful data export component designed for modern Vue 3 applications. Provides multiple export types, flexible data transformation, and complete user experience control. Seamlessly integrates with HiTable component to meet enterprise-level data export requirements.
View Live Demo
📄 Multiple Export Types
Support for exporting all data, selected data, current page data, and filtered data
📊 CSV Format Support
Complete CSV export functionality with custom delimiters and encoding support
🔄 Data Transformation
Powerful data transformation features including formatting, calculated fields, and nested object handling
🔗 Seamless Integration
Perfect integration with HiTable component, automatically retrieves table state and data
🛡️ TypeScript Support
Complete TypeScript type definitions for excellent development experience
✨ User Experience
Loading states, progress indicators, error handling and complete user interaction experience
The simplest way to integrate the export component:
<template><div class="space-y-4"> <!-- HiTable and HiExport Integration --> <HiTable :data="users" :columns="tableColumns" :config="tableConfig" > <template #toolbar-actions="{ table }"> <HiExport :table="table" :original-data="users" :columns="exportColumns" filename="users-export" button-text="Export User Data" /> </template> </HiTable></div></template>
<script setup lang="ts">import { ref } from 'vue'import { HiTable } from '@/components/HiTable'import { HiExport } from '@/components/HiExport'import type { ExportColumn } from '@/components/HiExport/types'
// Sample user dataconst users = ref([])
// Table column configurationconst tableColumns = [{ accessorKey: 'name', header: 'Name' },{ accessorKey: 'email', header: 'Email' },{ accessorKey: 'role', header: 'Role' },]
// Export column configuration (can be different from table columns)const exportColumns: ExportColumn[] = [{ key: 'id', header: 'User ID' },{ key: 'name', header: 'Name' },{ key: 'email', header: 'Email Address' },{ key: 'role', header: 'User Role' },{ key: 'createdAt', header: 'Created At' },]
// Basic table configurationconst tableConfig = {rowSelection: { enabled: true }, // Enable row selection for "export selected" functionalitypagination: { pageSize: 10 },}</script>
Property | Type | Default | Description |
---|---|---|---|
table | Table<any> | - | HiTable component instance |
originalData | any[] | - | Original data array |
columns | ExportColumn[] | - | Export column configuration array |
filename | string | ’export’ | Base name for the exported file |
config | ExportConfig | See below | Export configuration object |
disabled | boolean | false | Whether to disable export functionality |
buttonText | string | ’Export’ | Display text for export button |
buttonVariant | 'default' | 'outline' | 'ghost' | 'secondary' | ’outline’ | Button style variant |
buttonSize | 'default' | 'sm' | 'lg' | ’sm’ | Button size |
interface ExportColumn {// Property key in the data objectkey: string// Column header in the exported fileheader: string// Optional: Data transformation functionaccessor?: (row: any) => any}
// Usage exampleconst exportColumns: ExportColumn[] = [// Simple field mapping{ key: 'name', header: 'Name' },
// Nested object access{ key: 'address', header: 'City', accessor: (user) => user.address.city},
// Data formatting{ key: 'salary', header: 'Salary', accessor: (user) => `$${user.salary.toLocaleString()}`}]
interface ExportConfig {// Basic configurationfilename?: string // Filename (without extension)includeHeaders?: boolean // Whether to include headers, default truedelimiter?: string // CSV delimiter, default ','encoding?: string // File encoding, default 'utf-8'dateFormat?: string // Date format, default 'YYYY-MM-DD'
// Advanced configurationtransform?: (data: any[]) => any[] // Data preprocessing function}
// Complete configuration exampleconst exportConfig: ExportConfig = {filename: 'user-report',includeHeaders: true,delimiter: ',',encoding: 'utf-8',dateFormat: 'YYYY-MM-DD HH:mm:ss',transform: (data) => { return data.map(item => ({ ...item, displayName: `${item.firstName} ${item.lastName}`, formattedAmount: `$${item.amount.toFixed(2)}` }))}}
Suitable for data export scenarios such as user lists and role management.
Supports export analysis of business data such as order lists and sales reports.
Handles export of complex data structures such as product catalogs and inventory reports.