This package is for including icons within react-md. There is included support for both font icons and SVG icons. There is also a helper component for applying spacing between icons and text.
npm install @react-md/iconCreate icons using a font-icon library like material-icons or font-awesome or
plain old accessible SVG icons. There are also a few additional helpers to
creating animating rotating icons and separating text from an icon.
``sh`
npm install --save @react-md/icon
It is also recommended to install the other packages if you have not done so:
`sh`
npm install --save @react-md/theme @react-md/typography
If you would like to have access to all material icons as existing components
instead of having to manually remember the correct children to provide or thepath
correct , you can install the @react-md/material-icons package. This
will include all material icons as font and SVGs.
You should check out the
full documentation for live examples
and more customization information, but an example usage is shown below.
Even though the FontIcon and SVGIcon components are the "main" exports forTextIconSpacing
this package, they are more utility components and probably won't be used much
once you set up your own icon system. The _real_ exports are going to be the and IconRotator components.
The TextIconSpacing component is used to add spacing between an icon and someIconRotator
"text" where the text can be any renderable element. The is used
to animate an icon rotation such as expander or collapse icons.
`tsx
import { render } from "react-dom";
import { FontIcon, TextIconSpacing } from "@react-md/icon";
import { Typography } from "@react-md/typography";
// the Typography component is optional, it'll just add better typography
// than normal text.
const App = () => (
<>
// creates an icon spaced before the "Go Home" text
// creates an icon spaced after the "Go Home" text
// it can also be combined
>
);
render(
`
This package's icon component usage is really only helpful when generating icon
components through an external script or using font icons. However, here are a
few examples of using the FontIcon and SVGIcon components:
`tsx
import { render } from "react-dom";
import { FontIcon, SVGIcon } from "@react-md/icon";
// When using font icons, you'll need to make sure they icon fonts have been
// correctly included in your app. Check out the documentation site for more
// info
const App = () => (
<>
>
);
render(
``