Skip to Content
BlocksSearchableTableBlock

SearchableTableBlock

A full-featured table with search input, filters, and sortable columns.

Import

import { SearchableTableBlock } from "@raydenui/ui/blocks";

Usage

<SearchableTableBlock title="Products" searchPlaceholder="Search products..." columns={[ { key: "name", label: "Name", sortable: true }, { key: "category", label: "Category" }, { key: "price", label: "Price", sortable: true }, { key: "stock", label: "Stock" }, ]} data={products} onSearch={(query) => searchProducts(query)} onSort={(key, direction) => sortProducts(key, direction)} />

With Filters

<SearchableTableBlock title="Orders" columns={[ { key: "id", label: "Order ID" }, { key: "customer", label: "Customer", sortable: true }, { key: "status", label: "Status" }, { key: "total", label: "Total", sortable: true }, ]} data={orders} onSearch={(query) => searchOrders(query)} filters={[ { key: "status", label: "Status", options: ["Pending", "Processing", "Shipped", "Delivered"], }, { key: "date", label: "Date Range", options: ["Today", "This Week", "This Month", "All Time"], }, ]} onFilterChange={(filters) => applyFilters(filters)} />

With Row Actions

<SearchableTableBlock title="Users" columns={[ { key: "name", label: "Name", sortable: true }, { key: "email", label: "Email" }, { key: "role", label: "Role" }, { key: "actions", label: "Actions", render: (row) => ( <div className="flex gap-2"> <Button size="sm" variant="text">Edit</Button> <Button size="sm" variant="text" destructive>Delete</Button> </div> ), }, ]} data={users} onSearch={(query) => searchUsers(query)} />

With Pagination

const [page, setPage] = useState(1); <SearchableTableBlock title="Inventory" columns={columns} data={paginatedData} onSearch={(query) => searchInventory(query)} pagination={{ currentPage: page, totalPages: totalPages, onPageChange: setPage, }} />

Props

PropTypeDefaultDescription
titlestring—Header title
searchPlaceholderstring"Search..."Search input placeholder
columnsSearchableTableColumn[]—Column config (required)
dataany[]—Table data (required)
onSearch(query: string) => void—Search handler
onSort(key, direction) => void—Sort handler
filtersFilterConfig[]—Filter options
onFilterChange(filters) => void—Filter change handler
paginationPaginationProps—Pagination config
classNamestring—Additional CSS classes

SearchableTableColumn

PropTypeRequiredDescription
keystringYesData key
labelstringYesColumn header label
sortablebooleanNoEnable sorting
render(row: any) => ReactNodeNoCustom cell renderer

FilterConfig

PropTypeRequiredDescription
keystringYesFilter key
labelstringYesFilter label
optionsstring[]YesAvailable options

Accessibility

  • Search input has proper label
  • Sortable columns have ARIA sort attributes
  • Filters are keyboard navigable
  • Table uses semantic HTML elements
Last updated on