Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[icons] Gavel Icon Outlined not outlined #42190

Open
Rishi556 opened this issue May 10, 2024 · 1 comment
Open

[icons] Gavel Icon Outlined not outlined #42190

Rishi556 opened this issue May 10, 2024 · 1 comment
Assignees
Labels
package: icons Specific to @mui/icons status: waiting for maintainer These issues haven't been looked at yet by a maintainer

Comments

@Rishi556
Copy link
Contributor

Rishi556 commented May 10, 2024

Steps to reproduce

Link to live example: https://stackblitz.com/edit/react-pfmck1?file=Demo.tsx

image

Steps:

  1. View The Gavel Icon And The Outlined Gavel Icon
  2. Notice how similar they are

Current behavior

Both are filled in

Expected behavior

Outlined icon to have the inside not be filled in

Context

The gavel icon outlined version should have the inside be transparent rather than being filled in.

Your environment

Using "@mui/icons-material": "^5.15.17"

Search keywords: gavel material icons

@Rishi556 Rishi556 added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label May 10, 2024
@cw235
Copy link

cw235 commented May 10, 2024

To achieve the expected behavior where the outlined gavel icon has the inside not filled in, you need to customize the icon using Material-UI icons. You can leverage the createTheme and ThemeProvider components from Material-UI to customize the icon color.

Here's a step-by-step guide on how you can make this adjustment:

  1. In your React project, make sure you have installed @mui/icons-material version 5.15.17.
  2. Locate the component or file where you are rendering the gavel icons in your project.
  3. Add the following imports from Material-UI at the top of your file:
import { createTheme, ThemeProvider } from '@mui/system';
  1. Create a custom theme to set the inside color of the outlined gavel icon as transparent. Define your custom theme by adding the following code before the component where you are rendering the icons:
const theme = createTheme({
  components: {
    MuiSvgIcon: {
      styleOverrides: {
        root: {
          '&.MuiOutlined': {
            '& path': {
              fill: 'transparent',
            },
          },
        },
      },
    },
  },
});
  1. Wrap the rendering of your gavel icons with the ThemeProvider component and pass in the theme you just created. Your component should look like this:
<ThemeProvider theme={theme}>
    // Render your gavel icons here
</ThemeProvider>

By following these steps, you should now see the outlined gavel icon with the inside not filled in, as the inside color will be set to transparent based on the custom theme you applied using Material-UI.

@zannager zannager added the package: icons Specific to @mui/icons label May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: icons Specific to @mui/icons status: waiting for maintainer These issues haven't been looked at yet by a maintainer
Projects
None yet
Development

No branches or pull requests

4 participants