# Using icon libraries

Learn how to use your favorite icon library with Joy UI.

## Material UI Icons [@mui/icons-material](https://www.npmjs.com/package/@mui/icons-material) includes the 2,100+ official [Material Icons](https://fonts.google.com/icons?icon.set=Material+Icons) converted to [SVG Icon](/material-ui/api/svg-icon/) components. ### Installation This section assumes that you've already installed Joy UI in your app—see [Installation](/joy-ui/getting-started/installation/) for instructions. #### yarn ```bash yarn add @mui/icons-material @mui/material ``` :::warning Because `@mui/material` is a required dependency of `@mui/icons-material`, you have to add a workaround with yarn resolutions: ```json { "dependencies": { "@mui/material": "npm:@mui/joy@latest" }, "resolutions": { "@mui/material": "npm:@mui/joy@latest" } } ``` After that, run `yarn install` in your terminal. We are aware of this limitation and are considering removing the dependency. You can keep track of the progress in [this issue](https://github.com/mui/material-ui/issues/34489). ::: #### npm ```bash npm install @mui/icons-material @mui/material ``` :::warning Because `@mui/material` is a required dependency of `@mui/icons-material`, you have to update your bundler's config to add an alias. Here is an example of how you can do it, if you use [webpack](https://webpack.js.org/): **webpack.config.js** ```diff module.exports = { //... + resolve: { + alias: { + '@mui/material': '@mui/joy', + }, + }, }; ``` If you use TypeScript, you will need to update the TSConfig. **tsconfig.json** ```diff { "compilerOptions": { + "paths": { + "@mui/material": ["./node_modules/@mui/joy"] + } } } ``` ::: :::error `` is _required_ when working with Material UI's icons inside an app using Joy UI, so that the components can correctly adjust the icons based on the usage. ::: ### Usage By default, Joy UI components are able to control an icon's color, font size, and margins when its size or variant changes. {{"demo": "JoyMaterialIcon.js"}} ### Size To control the size of the icon, use `fontSize` prop. The value can be one of the keys in `theme.fontSize` (the default value is `"xl"`). {{"demo": "IconFontSizes.js"}} ## Third-party icons To use other icon libraries, web font icons, or plain SVG icons with Joy UI, apply the styles with specific CSS variables as shown in the example below: ```jsx import { CssVarsProvider } from '@mui/joy/styles'; import GlobalStyles from '@mui/joy/GlobalStyles'; // The `GlobalStyles` component is used to create a global style sheet. // You can replace it with your preferred CSS solution. function App() { return ( ) } ``` Joy UI components can control those variables based on their size and variant to make the icons fit perfectly. --- Here is a collection of well-known icon libraries that you can use with Joy UI. ### react-icons - [Installation](https://react-icons.github.io/react-icons/) ### Ionicons - [Browse icons](https://ionic.io/ionicons) - [Installation](https://ionic.io/ionicons/usage) ### Heroicons - [Browse icons](https://heroicons.com/) - [Installation](https://github.com/tailwindlabs/heroicons#react) ### Bootstrap Icons - [Browse icons](https://icons.getbootstrap.com/) - [Installation](https://icons.getbootstrap.com/#install) ### Font Awesome Icons - [Browse icons](https://fontawesome.com/icons) - [Installation](https://docs.fontawesome.com/web/use-with/react) ### Iconify - [Browse icons](https://icon-sets.iconify.design/) - [Installation—React](https://iconify.design/docs/icon-components/react/) - [Installation—Web component](https://iconify.design/docs/iconify-icon/) - [Figma plugin](https://iconify.design/docs/design/figma/) ### Lucide - [Browse icons](https://icon-sets.iconify.design/) - [Installation—React](https://lucide.dev/guide/packages/lucide-react)