Posted 11 October 2024, 3:13 am EST
Hi,
The default checkbox doesn’t allow direct modification of its appearance, so you’ll need to use pseudo-elements like ::before and ::after or hide the default checkbox and replace it with a custom design.
You can refer to the following updated sample demonstrating the same - https://stackblitz.com/edit/angular-ndhvsg?file=src%2Fstyles.css
We have only applied the following CSS to the previous sample -
/* custom chekcbox CSS */
.wj-cell.my-checkbox-column.wj-cell input[type="checkbox"],
.wj-cell.wj-header input[type="checkbox"]
{
appearance: none; /* Remove default styling */
-webkit-appearance: none; /* For Safari */
width: 15px;
height: 15px;
background-color: white;
border: 2px solid #000;
border-radius: 4px;
position: relative;
cursor: pointer;
}
/* Create the checkmark */
.wj-cell.my-checkbox-column input[type="checkbox"]::after,
.wj-cell.wj-header input[type="checkbox"]::after {
content: "";
display: none;
position: absolute;
top: 2px;
left: 5px;
width: 3px;
height: 7px;
border: solid #000;
border-width: 0 2px 2px 0;
transform: rotate(45deg);
}
/* When the checkbox is checked */
.wj-cell.my-checkbox-column input[type="checkbox"]:checked,
.wj-cell.wj-header input[type="checkbox"]:checked {
background-color: #4CAF50; /* Change the color here */
}
.wj-cell.my-checkbox-column input[type="checkbox"]:checked::after,
.wj-cell.wj-header input[type="checkbox"]:checked::after {
display: block;
}
You can modify the checkbox color and styles as per your needs.
Regards