Skip to content

zk-table ​

A table with a caption, sortable columns (links) and an empty state, rendered by the server.

Props ​

PropTypeDefaultDescription
columnsarray[]Items with key, label and, optionally, sortable and align
rowsiterable[]Arrays or objects, read with data_get($row, $column['key'])
captionstring|nullnullCaption
sortstring|nullnullCurrent column; by default ?sort=
directionstring|nullnullasc or desc; by default ?dir=
sortParameterstring'sort'Name of the query parameter
directionParameterstring'dir'Name of the query parameter
emptyTextstring'Nothing to show'Text of the empty row
perPageint|nullnullRows per page: cuts a list and shows the pagination under the table
pageParameterstring'page'Name of the query parameter of the page
paginationLabelstring'Pagination'Accessible name of the pagination
classstring|nullnullCSS class(es) merged onto the root element

Undeclared attributes forward to the root element.

The headers of the sortable columns are links to the same page with ?sort=…&dir=… (and page removed), and the sorted one has aria-sort. Sorting, searching and paging are done by your query: the component only shows the result. The pages: give a Laravel paginator as rows (paginate(), simplePaginate()) and its page is shown with zk-pagination under the table, or give a list and perPage and the table cuts it by ?page=. With one page there is no pagination. The search, filters and selection of the Vue table are not ported. No script.

Examples ​

With a paginator ​

blade
<x-zk-table :columns="$columns" :rows="$users->withQueryString()" />

A list cut in pages ​

blade
<x-zk-table :columns="$columns" :rows="$countries" :per-page="15" />

Users ​

blade
<x-zk-table
    caption="Users"
    :columns="[
        ['key' => 'name', 'label' => 'Name', 'sortable' => true],
        ['key' => 'email', 'label' => 'Email'],
    ]"
    :rows="$users"
/>

Documentation of 3.2.0 , built from c93e21f on 3.2.0 by pipeline #2919741884 on 2026-10-06.