Skip to main content

DataTableCellComponent

DataTableCellComponent

This type is used to define re-usable components that can render a table cell in a DataTable.

Example

import { DataTableCellComponent } from '@vendure/dashboard';

type CustomerCellData = {
customer: {
id: string;
firstName: string;
lastName: string;
} | null;
};

export const CustomerCell: DataTableCellComponent<CustomerCellData> = ({ row }) => {
const value = row.original.customer;
if (!value) {
return null;
}
return (
<Button asChild variant="ghost">
<Link to={`/customers/${value.id}`}>
{value.firstName} {value.lastName}
</Link>
</Button>
);
};
Signature
type DataTableCellComponent<T> = <Data extends T>(context: CellContext<Data, any>) => any