Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVG Checkbox remove padding

I trying to override MUI5 checkbox CSS fields, this is the current status:

enter image description here

My CSS classes are:

 MuiCheckbox: {
  styleOverrides: {
    root: {
      ".MuiSvgIcon-root": {
        backgroundColor: "white",
      },
    },
  },
},

And the structure is:

 <svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-7w1q46-MuiSvgIcon-root" focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="CheckBoxIcon">
 <path id="kk" d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"></path>
 </svg>

My question is how can i remove the white border without removing the backgroundColor?(without the backgroundColor the inner check is transparent)

like image 907
Ar26 Avatar asked Jul 23 '26 19:07

Ar26


1 Answers

Considering I can't override the viewBox values I found a simple solution

my updated CSS override:

 MuiCheckbox: {
  styleOverrides: {
    root: {
      ".MuiSvgIcon-root": {
        backgroundColor: "white",
        path: {
          transform: "translate(-2px, -2px) scale(1.2)",
        },
      },
    },
  },
},
like image 140
Ar26 Avatar answered Jul 26 '26 11:07

Ar26



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!