Skip to main content

Custom buttons

The DataGrid toolbar supports custom buttons (text or icon) and handles loading automatically.

Example Usage

const customToolbarButtons: CustomToolbarButtonConfig[] = [
{
key: 'addAsyncBtn',
type: 'text',
text: 'Add (async)',
onClick: (selectedRowIds, selectedRows) => new Promise(/* ... */)
},
//...
{
key: 'attachmentBtn',
type: 'icon',
icon: <PjIcon size="20" />,
onClick: (selectedRowIds, selectedRows) => new Promise(/* ... */),
color: 'secondary'
}
];

return (
<DataGridDS
columns={columns}
rows={rows}
checkboxSelection
slotProps={{
toolbar: {
customButtons: customToolbarButtons
}
}}
/>
);