I am looking to create a toggle effect on ion-card, where clicking on the card will highlight it until either unclicked or another card is clicked. Similar to this -
https://i.sstatic.net/MH5WA.png
How can I achieve this effect on ion-card?
Here is my HTML code -
<ion-grid>
<ion-row>
<ion-col>
<ion-card (click)="showDetails()">
<ion-card-content>
<ion-label class="header">Aluminium</ion-label>
<ion-label class="month">June 300MT</ion-label>
<ion-label class="month">May 250MT</ion-label>
<ion-label class="month">April 300MT</ion-label>
</ion-card-content>
</ion-card>
</ion-col>
<ion-col>
<ion-card>
<ion-card-content>
<ion-label class="header">Nickle</ion-label>
<ion-label class="month">June 300MT</ion-label>
<ion-label class="month">May 250MT</ion-label>
<ion-label class="month">April 300MT</ion-label>
</ion-card-content>
</ion-card>
</ion-col>
</ion-row>
<ion-row>
<ion-col>
<ion-card>
<ion-card-content>
<ion-label class="header">Copper</ion-label>
<ion-label class="month">June 300MT</ion-label>
<ion-label class="month">May 250MT</ion-label>
<ion-label class="month">April 300MT</ion-label>
</ion-card-content>
</ion-card>
</ion-col>
<ion-col>
<ion-card>
<ion-card-content>
<ion-label class="header">Alumina</ion-label>
<ion-label class="month">June 300MT</ion-label>
<ion-label class="month">May 250MT</ion-label>
<ion-label class="month">April 300MT</ion-label>
</ion-card-content>
</ion-card>
</ion-col>
</ion-row>
</ion-grid>
This is the CSS for my page -
page-crm {
.dx-texteditor.dx-editor-outlined {
background: #fff;
border: 1px solid #ddd !important;
border-radius: 4px;
font-weight: 600;
font-size: 16px !important;
margin-bottom: 10px;
}
.header{
font-weight: 700;
font-size: 20px !important;
color: #4D4D4D !important;
}
.month{
color: #808080 !important;
font-weight: 500;
margin: 5px;
}
.card-content{
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 10px;
}
.card{
box-shadow: 0px 2px 10px #cccccc !important;
}
.listContainer{
box-shadow: 0px 2px 10px #cccccc !important;
}
}
I tried using .card.activated
but it didn't work. I want to add a border or change the shadow color to blue as shown in the image to indicate that the user has selected the card.