Examples › Handling cell clicks
If you need to know not only which row, but also which column was clicked, pass an onCellClick handler to the DataTable. The handler receives an object with the following properties:
record→ the clicked record;index→ the index of the clicked record in therecordsarray;column→ the clicked column’s definition;columnIndex→ the index of the clicked column in display order (which can differ from its position in yourcolumnsarray when columns are reordered, pinned or grouped);event→ the original React mouse event.
Click on a cell to see it in action:
No records
Here is the code:
Double-clicks
The onCellDoubleClick handler receives the same arguments. Double-click on a cell to see it in action:
No records
Here is the code:
Right-clicks
Similarly, you can use the onCellContextMenu handler to react when the user right-clicks on a cell; call event.preventDefault() if you don’t want the browser’s own context menu to show up. See how you can use it to display a cell context menu with Mantine ContextMenu.
Heads up
Head over to the next example to discover more features.














