JGuang

Icons

Icons · Material UI

Preview
npm install @mui/material@9.4.0 @emotion/react@11.14.0 @emotion/styled@11.14.1

Icons

Wrap SVG paths or font glyphs with native size, color and semantics.

This guide covers Material UI Core with the default Emotion engine; extensions and additional demos are explicitly classified.

Use case and business boundary

SvgIcon/Icon wrappers are not a bundled icon catalog; font icons need an actual font asset and decorative icons should be hidden.

Native composition and scope

Icon, SvgIcon

Preserve native Material UI composition and types; do not substitute JGuang UI/Base UI/Radix APIs. Example entries are not extra components.

Native installation and initialization

npm install @mui/material@9.4.0 @emotion/react@11.14.0 @emotion/styled@11.14.1

Use native npm and Emotion, not an invented JGuang UI Registry URL. Place examples inside native ThemeProvider; choose CssBaseline or ScopedCssBaseline for the project. Inspect React, existing providers, lockfile and SSR first. Never overwrite files or conceal peer conflicts. This batch verified React 19.2.8; React 18 and below require matching react-is. See the included bilingual setup guide.

Practical native parameters

These selected parameters are not a flattened universal API. Preserve the native declaring owner, slot structure, nullable values and generics.

Owner.propPractical roleDeclaration source
SvgIcon.viewBoxSVG coordinate system; not rendered CSS dimensions.SvgIcon
SvgIcon.titleAccessAccessible SVG title; decorative SVGs normally omit this and remain hidden.SvgIcon
SvgIcon.fontSizeNative icon size enum; theme-aware, not an arbitrary universal size API.SvgIcon
Icon.baseClassNameFont-icon CSS class; an actual matching font asset must be loaded.Icon

Runnable native examples

Machine keys select example entries, not universal variant props. Native demo JSX/data stay unchanged; JGuang-authored acceptance fixtures are explicitly labelled.

  • Usage · SvgMaterialIcons · upstream native demo
  • SvgIcon · SvgIconChildren · upstream native demo
  • Color · SvgIconsColor · upstream native demo
  • Size · SvgIconsSize · upstream native demo
  • createSvgIcon · CreateSvgIcon · upstream native demo
  • Font Material Icons · Icons · upstream native demo
  • Custom font · TwoToneIcons · upstream native demo

Explicitly unsupported additional examples

These remain in the upstream inventory, not silently skipped or presented as working previews. Additional dependency/framework acceptance is required.

  • Font Awesome · FontAwesomeIcon: fg-loadcss
  • Font Awesome · FontAwesomeIconSize: fg-loadcss

Actual usage example

Unmodified pinned native demo; copy its required local helper files together.

import Box from '@mui/material/Box';
import Grid from '@mui/material/Grid';
import Typography from '@mui/material/Typography';
import DeleteIcon from '@mui/icons-material/Delete';
import DeleteOutlinedIcon from '@mui/icons-material/DeleteOutlined';
import DeleteRoundedIcon from '@mui/icons-material/DeleteRounded';
import DeleteTwoToneIcon from '@mui/icons-material/DeleteTwoTone';
import DeleteSharpIcon from '@mui/icons-material/DeleteSharp';
import DeleteForeverIcon from '@mui/icons-material/DeleteForever';
import DeleteForeverOutlinedIcon from '@mui/icons-material/DeleteForeverOutlined';
import DeleteForeverRoundedIcon from '@mui/icons-material/DeleteForeverRounded';
import DeleteForeverTwoToneIcon from '@mui/icons-material/DeleteForeverTwoTone';
import DeleteForeverSharpIcon from '@mui/icons-material/DeleteForeverSharp';
import ThreeDRotationIcon from '@mui/icons-material/ThreeDRotation';
import FourKIcon from '@mui/icons-material/FourK';
import ThreeSixtyIcon from '@mui/icons-material/ThreeSixty';

export default function SvgMaterialIcons() {
  return (
    <Box sx={{ flexGrow: 1 }}>
      <Grid container sx={{ color: 'text.primary' }}>
        <Grid size={4}>
          <Typography>Filled</Typography>
        </Grid>
        <Grid size={8}>
          <DeleteIcon />
          <DeleteForeverIcon />
        </Grid>
        <Grid size={4}>
          <Typography>Outlined</Typography>
        </Grid>
        <Grid size={8}>
          <DeleteOutlinedIcon />
          <DeleteForeverOutlinedIcon />
        </Grid>
        <Grid size={4}>
          <Typography>Rounded</Typography>
        </Grid>
        <Grid size={8}>
          <DeleteRoundedIcon />
          <DeleteForeverRoundedIcon />
        </Grid>
        <Grid size={4}>
          <Typography>Two Tone</Typography>
        </Grid>
        <Grid size={8}>
          <DeleteTwoToneIcon />
          <DeleteForeverTwoToneIcon />
        </Grid>
        <Grid size={4}>
          <Typography>Sharp</Typography>
        </Grid>
        <Grid size={8}>
          <DeleteSharpIcon />
          <DeleteForeverSharpIcon />
        </Grid>
        <Grid size={4}>
          <Typography>Edge-cases</Typography>
        </Grid>
        <Grid size={8}>
          <ThreeDRotationIcon />
          <FourKIcon />
          <ThreeSixtyIcon />
        </Grid>
      </Grid>
    </Box>
  );
}

Example dependency boundaries

@mui/material/Box, @mui/material/Grid, @mui/material/Typography, @mui/icons-material/Delete, @mui/icons-material/DeleteOutlined, @mui/icons-material/DeleteRounded, @mui/icons-material/DeleteTwoTone, @mui/icons-material/DeleteSharp, @mui/icons-material/DeleteForever, @mui/icons-material/DeleteForeverOutlined, @mui/icons-material/DeleteForeverRounded, @mui/icons-material/DeleteForeverTwoTone, @mui/icons-material/DeleteForeverSharp, @mui/icons-material/ThreeDRotation, @mui/icons-material/FourK, @mui/icons-material/ThreeSixty, @mui/material/SvgIcon, @mui/material/Stack, @mui/material/colors, @mui/material/utils, @mui/material/Icon, @mui/material/styles

Direct Icons/System/Utils example imports require their matching 9.4.0 packages. Relative data/helpers are part of the example closure, not extra components. Remote images and simulated operations do not supply a backend.

Pinned upstream API metadata reference

These tables retain the upstream metadata, not a newly inferred generic type system. Conditional generics, inherited props and callback details are defined by the source declarations below. Theme defaults may override metadata defaults.

Icon

import Icon from '@mui/material/Icon';
import { Icon } from '@mui/material';
PropRequiredUpstream metadata type / constraintMetadata default
baseClassNamenostring'material-icons'
childrennonode—
classesnoobject—
colorno'inherit' | 'action' | 'disabled' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning' | string'inherit'
componentnoelementType—
fontSizeno'inherit' | 'large' | 'medium' | 'small' | string'medium'
sxnoArray<func | object | bool> | func | object—

SvgIcon

import SvgIcon from '@mui/material/SvgIcon';
import { SvgIcon } from '@mui/material';
PropRequiredUpstream metadata type / constraintMetadata default
childrennonode—
classesnoobject—
colorno'inherit' | 'action' | 'disabled' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning' | string'inherit'
componentnoelementType—
fontSizeno'inherit' | 'large' | 'medium' | 'small' | string'medium'
htmlColornostring—
inheritViewBoxnoboolfalse
shapeRenderingnostring—
sxnoArray<func | object | bool> | func | object—
titleAccessnostring—
viewBoxnostring'0 0 24 24'

Native source declarations

Declarations/imports are extracted from pinned source without flattening unions or external inheritance. Original English comments/types are source reference, not a claim of translated upstream prose. Shared types stay in their native packages.

vendor/src/Icon/Icon.d.ts

import * as React from 'react';

import { SxProps } from '@mui/system';

import { OverridableStringUnion } from '@mui/types';

import { Theme } from '../styles';

import { OverridableComponent, OverrideProps } from '../OverridableComponent';

import { IconClasses } from './iconClasses';

export interface IconPropsSizeOverrides {}

export interface IconPropsColorOverrides {}

export interface IconOwnProps {
  /**
   * The base class applied to the icon. Defaults to 'material-icons', but can be changed to any
   * other base class that suits the icon font you're using (for example material-icons-rounded, fas, etc).
   * @default 'material-icons'
   */
  baseClassName?: string | undefined;
  /**
   * The name of the icon font ligature.
   */
  children?: React.ReactNode;
  /**
   * Override or extend the styles applied to the component.
   */
  classes?: Partial<IconClasses> | undefined;
  /**
   * The color of the component.
   * It supports both default and custom theme colors, which can be added as shown in the
   * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
   * @default 'inherit'
   */
  color?:
    | OverridableStringUnion<
        | 'inherit'
        | 'action'
        | 'disabled'
        | 'primary'
        | 'secondary'
        | 'error'
        | 'info'
        | 'success'
        | 'warning',
        IconPropsColorOverrides
      >
    | undefined;
  /**
   * The fontSize applied to the icon. Defaults to 24px, but can be configure to inherit font size.
   * @default 'medium'
   */
  fontSize?:
    | OverridableStringUnion<'inherit' | 'large' | 'medium' | 'small', IconPropsSizeOverrides>
    | undefined;
  /**
   * The system prop that allows defining system overrides as well as additional CSS styles.
   */
  sx?: SxProps<Theme> | undefined;
}

export interface IconTypeMap<
  AdditionalProps = {},
  RootComponent extends React.ElementType = 'span',
> {
  props: AdditionalProps & IconOwnProps;
  defaultComponent: RootComponent;
}

declare const Icon: OverridableComponent<IconTypeMap> & { muiName: string };

export type IconProps<
  RootComponent extends React.ElementType = IconTypeMap['defaultComponent'],
  AdditionalProps = {},
> = OverrideProps<IconTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
  component?: React.ElementType | undefined;
};

vendor/src/SvgIcon/SvgIcon.d.ts

import * as React from 'react';

import { SxProps } from '@mui/system';

import { OverridableStringUnion } from '@mui/types';

import { Theme } from '../styles';

import { OverridableComponent, OverrideProps } from '../OverridableComponent';

import { SvgIconClasses } from './svgIconClasses';

export interface SvgIconPropsSizeOverrides {}

export interface SvgIconPropsColorOverrides {}

export interface SvgIconOwnProps {
  /**
   * Node passed into the SVG element.
   */
  children?: React.ReactNode;
  /**
   * Override or extend the styles applied to the component.
   */
  classes?: Partial<SvgIconClasses> | undefined;
  /**
   * The color of the component.
   * It supports both default and custom theme colors, which can be added as shown in the
   * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
   * You can use the `htmlColor` prop to apply a color attribute to the SVG element.
   * @default 'inherit'
   */
  color?:
    | OverridableStringUnion<
        | 'inherit'
        | 'action'
        | 'disabled'
        | 'primary'
        | 'secondary'
        | 'error'
        | 'info'
        | 'success'
        | 'warning',
        SvgIconPropsColorOverrides
      >
    | undefined;
  /**
   * The fontSize applied to the icon. Defaults to 24px, but can be configure to inherit font size.
   * @default 'medium'
   */
  fontSize?:
    | OverridableStringUnion<'inherit' | 'large' | 'medium' | 'small', SvgIconPropsSizeOverrides>
    | undefined;
  /**
   * Applies a color attribute to the SVG element.
   */
  htmlColor?: string | undefined;
  /**
   * If `true`, the root node will inherit the custom `component`'s viewBox and the `viewBox`
   * prop will be ignored.
   * Useful when you want to reference a custom `component` and have `SvgIcon` pass that
   * `component`'s viewBox to the root node.
   * @default false
   */
  inheritViewBox?: boolean | undefined;
  /**
   * The shape-rendering attribute. The behavior of the different options is described on the
   * [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Attribute/shape-rendering).
   * If you are having issues with blurry icons you should investigate this prop.
   */
  shapeRendering?: string | undefined;
  /**
   * The system prop that allows defining system overrides as well as additional CSS styles.
   */
  sx?: SxProps<Theme> | undefined;
  /**
   * Provides a human-readable title for the element that contains it.
   * https://www.w3.org/TR/SVG-access/#Equivalent
   */
  titleAccess?: string | undefined;
  /**
   * Allows you to redefine what the coordinates without units mean inside an SVG element.
   * For example, if the SVG element is 500 (width) by 200 (height),
   * and you pass viewBox="0 0 50 20",
   * this means that the coordinates inside the SVG will go from the top left corner (0,0)
   * to bottom right (50,20) and each unit will be worth 10px.
   * @default '0 0 24 24'
   */
  viewBox?: string | undefined;
}

export interface SvgIconTypeMap<
  AdditionalProps = {},
  RootComponent extends React.ElementType = 'svg',
> {
  props: AdditionalProps & SvgIconOwnProps;
  defaultComponent: RootComponent;
}

declare const SvgIcon: OverridableComponent<SvgIconTypeMap> & { muiName: string };

export type SvgIconProps<
  RootComponent extends React.ElementType = SvgIconTypeMap['defaultComponent'],
  AdditionalProps = {},
> = OverrideProps<SvgIconTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
  component?: React.ElementType | undefined;
};

Post-install acceptance

Run strict types, production build and real interactions. Check keyboard labels/focus, disabled/error/read-only semantics where natively supported, both themes, narrow screens and reduced motion. Verify callbacks against the real host data; do not declare installation complete from copying a prompt. Initialization fixtures also require server HTML and warning-free hydration.

Source and license

https://github.com/mui/material-ui/tree/809a7717b4c050ba3f69b75300689f07c050a16e

MIT · @mui/material@9.4.0. Vendor originals and license are preserved. Full original upstream prose remains in vendor/docs and is not represented as fully translated.