How to pass props to th and td element in react table 8? #4793
Unanswered
Mizan-Rifat
asked this question in
Q&A
Replies: 1 comment
-
Column Meta would be your best bet! https://tanstack.com/table/v8/docs/api/core/column-def#meta Then accessing it like this {row.getVisibleCells().map((cell) => {
const cellProps = cell.column.columnDef.meta?.cellProps;
return (
<TableCell
{...cellProps}
width={cell.column.getSize()}
key={cell.id}
>
{flexRender(cell.column.columnDef.cell, cell.getContext())}
</TableCell>
);
})} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Can we pass props to th and td elements from the column definition? I'm using "@tanstack/react-table": "^8.8.5"
Beta Was this translation helpful? Give feedback.
All reactions