
Security News
rv Is a New Rust-Powered Ruby Version Manager Inspired by Python's uv
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
react-inline-icons
Advanced tools
A collection of inline SVG React components from your favorite icon packs
A collection of inline SVG React components from your favorite icon packs
React Inline Icons was created to solve several issues with using web font icon packs:
You can find out more about the benefits of inline SVG over web font icon packs here:
By extracting the glyphs from an SVG web font, we are able to generate a collection of React components with the glyphs as inline SVGs.
You can install React Inline Icons from npm (with --save
to automatically add it to your package.json and --save-exact
to pin the version).
npm install react-inline-icons --save --save-exact
Using React Inline Icons is considerably easier than using a web font icon pack. Just import the icon you want to use, and put it in your markup.
Because the icons are distributed as individual files, you only need to include the ones you are actually using.
There's plenty of different ways to import our icons
// Import a single icon (this will only include the single module needed for this icon)
import IconName from 'react-inline-icons/dist/icon-pack/icon-name';
// Import an icon pack & namespace the ones you want (loads all icons from this pack into your bundle)
import { IconName } from 'react-inline-icons/dist/icon-pack';
// Import all icon packs (loads every icon pack into your bundle)
import ReactInlineIcons from 'react-inline-icons';
const { IconPack: { IconName } } = ReactInlineIcons;
import IconGithub from 'react-inline-icons/dist/font-awesome/icon-github';
function MyComponent() {
return (
<p>
GitHub <IconGithub />
</p>
);
}
Because the icons are inline SVGs (as opposed to an image tag) you can style them using CSS or inline styles.
svg {
width: 20px;
height: 20px;
fill: red;
}
<IconGithub width={20} height={20} fill="red" />
You can define the icon sizes relative to the font-size or at an explicit size. This example uses LESS (css pre-processor), but you can do the same thing with SASS, SCSS or plain CSS.
@base-font-size: 14px;
@icon-size: 1em;
html,
body {
font-size: @base-font-size;
}
// Default icon size is relative to the font size
svg {
width: @icon-size;
height: @icon-size;
}
h1 {
font-size: @base-font-size * 2;
// Override the default size for h1s with an explicit size not relative to the font
svg {
width: 20px;
height: 20px;
}
}
FAQs
A collection of inline SVG React components from your favorite icon packs
We found that react-inline-icons demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.