# Material Symbols Material Symbols is a comprehensive monorepo providing the latest variable icon fonts and optimized SVGs for Google's Material Symbols icon library. The package offers icons in three visual styles (Outlined, Rounded, and Sharp) with support for variable font axes including fill, weight, grade, and optical size. All packages are automatically updated via GitHub Actions, ensuring developers always have access to the most current icons from Google. The library is available as multiple npm packages to suit different project needs: the main `material-symbols` package includes full variable fonts with all weight variations (100-700), while individual `@material-symbols/font-{weight}` packages offer smaller file sizes for projects requiring only specific weights. SVG packages (`@material-symbols/svg-{weight}`) provide optimized vector graphics for both filled and unfilled icon states, ideal for React, Vue, and other component-based frameworks. ## Installation Install the Material Symbols icon fonts via npm to access over 3,800 icons in your web projects with full variable font support. ```bash # Install full variable font package (supports weights 100-700) npm install material-symbols@latest # Or install a specific weight for smaller bundle size npm install @material-symbols/font-400@latest # Install SVG package for component-based usage npm install @material-symbols/svg-400@latest ``` ## Importing in JavaScript Import the icon fonts directly in your JavaScript entry point file. This approach works with bundlers like webpack, Vite, and build tools in React, Vue, and Angular projects. ```javascript // Import all icon styles (outlined, rounded, sharp) with full variable font support import 'material-symbols'; // Or import only the outlined style to reduce bundle size import 'material-symbols/outlined.css'; // For specific weight packages import '@material-symbols/font-400'; import '@material-symbols/font-400/outlined.css'; ``` ## Importing in CSS Import the icon fonts directly in your CSS or preprocessor files for projects that don't use JavaScript bundlers or prefer CSS-based imports. ```css /* Import all icon styles */ @import 'material-symbols'; /* Import specific style only */ @import 'material-symbols/outlined.css'; @import 'material-symbols/rounded.css'; @import 'material-symbols/sharp.css'; /* For specific weight packages */ @import '@material-symbols/font-400'; @import '@material-symbols/font-400/outlined.css'; ``` ## Importing in HTML Link the CSS files directly in your HTML for static websites or projects without a build process. ```html
home ``` ## Displaying Icons Use span elements with the appropriate class name to render icons. The icon name goes inside the element as text content. ```html face home settings search favorite face home settings face home settings ``` ## Customizing Variable Font Axes Material Symbols are variable fonts supporting four axes: FILL (0-1), weight (wght: 100-700), grade (GRAD: -25 to 200), and optical size (opsz: 20-48). Customize these via CSS font-variation-settings. ```css /* Default settings */ .material-symbols-outlined { font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 48; } /* Filled icons */ .material-symbols-outlined.filled { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 48; } /* Bold icons */ .material-symbols-outlined.bold { font-variation-settings: 'FILL' 0, 'wght' 700, 'GRAD' 0, 'opsz' 48; } /* Light icons */ .material-symbols-outlined.light { font-variation-settings: 'FILL' 0, 'wght' 200, 'GRAD' 0, 'opsz' 48; } /* Custom icon sizes using optical size */ .material-symbols-outlined.small { font-size: 20px; font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20; } .material-symbols-outlined.large { font-size: 48px; font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 48; } /* Emphasized icons with higher grade */ .material-symbols-outlined.emphasized { font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 200, 'opsz' 48; } ``` ## Using with Sass Import the Sass files for more control over icon styling and to leverage Sass variables for customizing the font path. ```scss // Default import @import 'material-symbols'; // Import specific styles @import 'material-symbols/outlined'; @import 'material-symbols/rounded'; @import 'material-symbols/sharp'; // If using webpack or Vue CLI, set the font path first $material-symbols-font-path: '~material-symbols/'; @import 'material-symbols'; // For specific weight packages $material-symbols-font-path: '~@material-symbols/font-400/'; @import '@material-symbols/font-400'; // Custom icon styling with Sass .icon-button { .material-symbols-outlined { font-size: 24px; vertical-align: middle; font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; &:hover { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; } } } ``` ## Using with Angular mat-icon Integrate Material Symbols with Angular Material's mat-icon component by specifying the fontSet attribute. ```html