AkiTable

Akitable is a feature-rich table component for displaying, editing, and interacting with tabular data.

It supports pagination, row selection, bulk actions, editable cells, and custom headers/footers.

Installation

pnpm add @akinon/akitable

Basic Usage

import { Akitable, type AkitableColumn, type AkitableData } from '@akinon/akitable';
import { useAkilocale } from '@akinon/akilocale';

interface Product {
  id: number;
  name: string;
  price: number;
  status: string;
}

export const ProductTable = () => {
  const { locale } = useAkilocale();

  const columns: AkitableColumn[] = [
    {
      title: 'Name',
      dataIndex: 'name',
      key: 'name'
    },
    {
      title: 'Price',
      dataIndex: 'price',
      key: 'price',
      render: (value: number) => 
        new Intl.NumberFormat(locale.lng, { style: 'currency', currency: 'USD' }).format(value)
    },
  {
    title: 'Status',
    dataIndex: 'status',
    key: 'status'
  }
];

  const data: Product[] = [
    { id: 1, name: 'Product A', price: 29.99, status: 'Active' },
    { id: 2, name: 'Product B', price: 49.99, status: 'Inactive' },
    { id: 3, name: 'Product C', price: 19.99, status: 'Active' }
  ];

  return (
    <Akitable
      columns={columns}
      data={data}
      rowKey="id"
    />
  );
};

Props

Prop
Type
Description

columns

AkitableColumn[]

Column definitions for the table

data

AkitableData[] | AkitablePaginatedData

Data source (array or paginated response)

rowKey

string

Unique key field for each row

actions

AkitableAction[]

Bulk actions for selected rows

header

AkitableHeaderProps

Header configuration

footer

AkitableFooterProps

Footer configuration

isLoading

boolean

Loading state

maxColumnContent

boolean

Set max-content for horizontal scroll (default: true)

pagination

AkitablePaginationProps

Pagination configuration

onPaginationChanged

(page: number, size: number) => void

Pagination change callback

onRowClick

(record, event?, rowIndex?) => void

Row click callback

onRowEdit

(modifiedRecord, payload) => void | Promise<void>

Row edit callback

onChangeSorter

(sorter) => void

Sorter change callback

Pagination

Akitable supports server-side pagination with a standardized paginated response format:

Paginated Data Format

Page Sizes

Available page sizes: 20, 50, 100, 250

Column Configuration

Columns extend Ant Design's TableColumnType with additional properties:

Basic Columns

Sortable Columns

Editable Columns

Bulk Actions

Add bulk actions for selected rows:

When actions are provided, row selection checkboxes appear automatically.

Header Configuration

Customize the table header with title, extra content, and download actions:

Header Props

Prop
Type
Description

title

string

Table title (displays with total count)

extra

ReactNode

Additional content (buttons, filters, etc.)

downloadActions

ReactNode

Download/export action buttons

downloadActionsSlotWidth

number

Reserved width for download actions slot

reserveDownloadActionsSpace

boolean

Keep slot width when empty (default: true)

Add custom content to the table footer:

Row Events

Row Click

Row Status

Rows can have visual status indicators:

Available statuses:

  • AkitableRowStatus.PENDING - Shows pending/loading state

  • AkitableRowStatus.ERROR - Shows error state

Loading State

Complete Example

Internationalization

Akitable uses @akinon/akilocale for built-in translations. Default labels (pagination, actions, etc.) are provided in English and Turkish.

Best Practices

  1. Always provide rowKey - Use a unique identifier field for proper row tracking

  2. Use server-side pagination - For large datasets, implement pagination with AkitablePaginatedData

  3. Handle loading states - Show loading indicator during data fetches

  4. Define column widths - Prevent layout shifts with fixed column widths

  5. Use bulk actions wisely - Provide clear, actionable labels for bulk operations

Last updated

Was this helpful?