API Reference
Cell Instance APIs
All the cell instance methods and objects that can be accessed from a cell in Shadcn Table
Every cell provides a cell object that can be used in many props or column definitions that let's you have access to a cell's information and methods.
You can access and use a cell object in quite a few places, but here are some of the most common:
const columns = [
{
accessorKey: 'username',
header: 'Username',
//you can access a cell in many callback column definition options like this
stTableBodyCellProps: ({ cell }) => ({
onClick: () => {
console.log(cell.getValue(), cell.id);
},
}),
//or in the component override callbacks like this
Cell: ({ cell }) => {
return <div>{cell.getValue()}</div>;
},
},
];
const table = useShadcnTable({
columns,
data,
//or in callback props like this
stEditTextFieldProps: ({ cell }) => ({
disabled: cell.getValue() === 'admin',
}),
});NOTE: These are NOT props or column options for Shadcn Table. These are just static methods on a cell instance that you can use.
Wanna see the source code for this table? Check it out down below!