Angular Material. to highlight a table row on mouse over

Vladyslav Plakhuta picture Vladyslav Plakhuta · Apr 9, 2018 · Viewed 36.9k times · Source

we are using Angular Material table for our app:

https://material.angular.io/components/table/overview

<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>

could you please to show how to highlight a row on mouse hover?

Answer

p4r1 picture p4r1 · Apr 9, 2018

Add some CSS with the :hover selector to the mat-row elements:

.mat-row:hover {
  background-color: red;
}

StackBlitz demo