TablePropsProvider
sidebar_position: 8 title: Table Props Provider
Table Props Provider
Use TablePropsProvider to set global defaults for all DataTable components in your application.
The provider values map to DataTable props/config. Type definitions live in Props.
Quick start
import { TablePropsProvider, DataTable } from "@kousta-ui/table";
import "@kousta-ui/table/esm/index.css";
import "@kousta-ui/components/esm/index.css";
function App() {
return (
<TablePropsProvider
props={{
table: { className: "app-table" },
th: { className: "app-header" },
td: { className: "app-cell" },
}}
actions={{
edit: {
title: "Edit",
buttonProps: { variant: "primary", size: "sm" },
},
delete: {
title: "Delete",
buttonProps: { variant: "danger", size: "sm" },
},
}}
toggleRows={true}
disableContextMenu={false}
icons={{
toggleRows: "S/H",
extraViewsTogle: "...",
refresh: "Refresh",
paginationPrev: "Prev",
paginationNext: "Next",
paginationDots: "…",
}}
>
<DataTable
data={[]}
headers={{ name: { value: "name" } }}
loading={false}
title="Users"
keyExtractor={(row: any) => row.id}
/>
</TablePropsProvider>
);
}
How merging works
- Provider fills missing props: if a
DataTabledoesn’t pass a value locally, it can inherit it from the provider. - Local config wins: if a
DataTablepasses a local value, it takes precedence. iconsare merged: providericonsare merged with localconfig.icons.
Note For toggleRows, the provider value is applied only when the table does not set config.toggleRows locally.
Provider props (reference)
See:
Common fields:
props: forwarded to table elements (table/thead/tbody/tr/th/td)actions: default action config (edit/delete)toggleRows:booleandisableContextMenu:booleannoHead:booleanicons: same shape asconfig.iconsviewComp: view component defaultsemptyTable/emptyRowIcon