![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@iconify/react
Advanced tools
@iconify/react is a React component for Iconify, a versatile icon framework that allows you to use a wide range of icons from different icon sets. It provides a simple way to include icons in your React applications, supporting customizations such as size, color, and more.
Basic Icon Usage
This feature allows you to easily include an icon in your React component. You import the Icon component from @iconify/react and the specific icon from an icon set, then use it within your JSX.
import { Icon } from '@iconify/react';
import homeIcon from '@iconify-icons/mdi/home';
function App() {
return (
<div>
<Icon icon={homeIcon} />
</div>
);
}
export default App;
Customizing Icon Size
This feature allows you to customize the size of the icon. You can set the width and height properties to adjust the icon's size.
import { Icon } from '@iconify/react';
import homeIcon from '@iconify-icons/mdi/home';
function App() {
return (
<div>
<Icon icon={homeIcon} width="48" height="48" />
</div>
);
}
export default App;
Customizing Icon Color
This feature allows you to customize the color of the icon. You can set the color property to change the icon's color.
import { Icon } from '@iconify/react';
import homeIcon from '@iconify-icons/mdi/home';
function App() {
return (
<div>
<Icon icon={homeIcon} color="red" />
</div>
);
}
export default App;
Inline Icon Usage
This feature allows you to use the icon inline with text. Setting the inline property to true makes the icon align with the text.
import { Icon } from '@iconify/react';
import homeIcon from '@iconify-icons/mdi/home';
function App() {
return (
<div>
<Icon icon={homeIcon} inline={true} />
<span>Home</span>
</div>
);
}
export default App;
react-icons provides a comprehensive set of icons from various icon libraries such as Font Awesome, Material Design, and more. It is similar to @iconify/react in that it allows you to easily include and customize icons in your React applications. However, react-icons focuses on a curated set of popular icon libraries, whereas @iconify/react supports a broader range of icon sets.
react-fontawesome is a React component library specifically for Font Awesome icons. It allows you to use Font Awesome icons in your React applications with ease. Compared to @iconify/react, react-fontawesome is limited to Font Awesome icons, while @iconify/react supports a wider variety of icon sets.
react-svg is a React component that allows you to import and use SVG files as React components. It provides more flexibility in terms of using custom SVG icons. While @iconify/react focuses on providing a large collection of pre-defined icons, react-svg is more suitable for projects that require custom SVG icons.
This is a development version. Proper readme will be here later
import { Icon, InlineIcon } from "@iconify/react";
import home from "@iconify/react/mdi-light/home";
import faceWithMonocle from "@iconify/react/twemoji/face-with-monocle";
<Icon icon={home} />
<p>This is some text with <InlineIcon icon={faceWithMonocle} /></p>
Both components are the same, the only difference is InlineIcon has negative vertical alignment, so it behaves like glyph.
Use Icon for decorations, InlineIcon if you are migrating from glyph font.
You can pass any custom properties to Icon and InlineIcon.
Custom properties:
See Iconify icon sets page for list of available icons.
Import format for each icon is "@iconify/react/{prefix}/{icon}" where {prefix} is collection prefix, {icon} is icon name.
Import imports JSON data for icon, to render it use Icon or InlineIcon component.
Each icon is split in its own file, so only icons that you import are compiled when you build React application.
You can use any name for imported icon. For example:
import notCat from "@iconify/react/noto-v1/dog";
You can use build script with custom icon sets that have been converted to Iconify JSON format.
Add your own JSON files to directory "json", run build script from command line:
node node_modules/@iconify/react/build --source json --target icons
where "json" is directory where JSON files are, "icons" is directory where components will be exported.
There are more command line options:
Examples:
node node_modules/@iconify/react/build --module @iconify/json --dir json --target iconify-icons --filter fa-brands,logos,brandico
node node_modules/@iconify/react/build --module @iconify/json --dir json --target iconify-icons --skip fa-brands,logos,brandico --silent
React component is released with MIT license.
© 2019 Vjacheslav Trushkin
See Iconify icon sets page for list of collections and their licenses.
FAQs
Iconify icon component for React.
The npm package @iconify/react receives a total of 0 weekly downloads. As such, @iconify/react popularity was classified as not popular.
We found that @iconify/react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.