Icons
Using Icons-Sets from Iconify and react-icons in docusaurus.
Iconify​
Install​
- npm
- Yarn
- pnpm
- Bun
npm install --save-dev @iconify/react
yarn add --dev @iconify/react
pnpm add --save-dev @iconify/react
bun add --dev @iconify/react
Usage​
- MDXComponents.js
- doc.mdx
- Output
import React from 'react';
// Import the original mapper
import MDXComponents from '@theme-original/MDXComponents';
import { Icon } from '@iconify/react'; // Import the entire Iconify library.
export default {
// Re-use the default mapping
...MDXComponents,
Icon, // Make the iconify Icon component available in MDX as <icon />.
};
<Icon icon="streamline-stickies-color:dangerous-chemical-lab" height="48" />
<Icon icon="line-md:arrow-down-square" height="48" />
<Icon icon="fa:arrow-left" height="48" rotate="90" />
react-icons​
https://react-icons.github.io/react-icons/
Install​
- npm
- Yarn
- pnpm
- Bun
npm install react-icons --save
yarn add react-icons
pnpm add react-icons
bun add react-icons
Usage​
- MDXComponents.js
- doc.mdx
- Output
import * as FaIcons from 'react-icons/fa';
export default {
// Re-use the default mapping
...MDXComponents,
...FaIcons,
};
<FaGithub size="48"/>
<FaBeer size="48" color="orange" className="class-name" style={{ boxShadow: '0 0 10px rgba(0,0,0,0.3)' }} />
<FaFacebook size="48" attr={{
'aria-label': 'Facebook icon',
fill: 'blue',
stroke: 'white',
strokeWidth: 2,
className: 'mein-icon',
viewBox: "0 0 550 550",
}} />