React Integration
Welcome to the React integration section of Lineicons documentation. Here we’ll guide you on how to integrate your React projects and start using Lineicons.
You can effortlessly add a huge range of scalable and customizable icons to your React applications. In this guide, we will walk you through installation, implementation, and customization to ensure the icons go perfectly with your project’s design and functionality.
How to Integrate Lineicons with React Projects
Lineicons provides ready-to-use React components for Lineicons via NPM package for both Free and Pro Icons. Making it easy to add clean, scalable SVG icons to your React or Next.js projects. You can customize size, color, and style with simple props.
Step-1: Install the React wrapper and the free icons package:
npm
npm install @lineiconshq/react-lineicons @lineiconshq/free-iconsStep-2: After installing the package import icon and use anywhere -
import React from "react";
import { Lineicons } from "@lineiconshq/react-lineicons";
import {
Home2Outlined,
CloudBolt1Bulk,
CloudBolt1Outlined,
CloudBolt1Duotone,
CloudBolt1Solid,
} from "@lineiconshq/free-icons";
function App() {
return (
<div>
<Lineicons
icon={Home2Outlined}
size={24}
color="blue"
strokeWidth={1.5}
/>
<Lineicons icon={CloudBolt1Bulk} size={40} color="orange" />
<Lineicons icon={CloudBolt1Outlined} size={50} color="blue" />
<Lineicons icon={CloudBolt1Duotone} size={30} color="green" />
<Lineicons icon={CloudBolt1Solid} size={24} />
</div>
);
}
export default App;Using Pro Icons
Pro gives you access to all 31,204 icons and works the same way as the free package.
Pro packages are not on the public npm registry, so npm install @lineiconshq-pro/... on its own will fail. Log in to your Lineicons account and download the package files from the Downloads page, then install them from a local file.
Download the Pro packages
Log in to your Lineicons account and open Downloads from the account menu. Download the .tgz file for each style you need: Stroke, Outlined, Solid, Duotone, or Bulk.
Move them into your project
Run this from your project root (change ~/Downloads if you saved the files elsewhere):
mkdir -p vendor/lineicons && mv ~/Downloads/lineiconshq-pro-core-*.tgz vendor/lineicons/Install the Pro packages
This installs every .tgz file in vendor/lineicons:
npm
npm install ./vendor/lineicons/*.tgzOn Windows, *.tgz is not expanded. List each file path instead, as shown in the Pro Packages guide.
Install the wrapper
Pro icons render through @lineiconshq/react-lineicons, the same package you use for free icons. Skip this step if you already installed it.
npm
npm install @lineiconshq/react-lineiconsUse Pro icons
Import icons from the Pro package for the style you want. Pro icon names have no style suffix, so the outlined AlarmError comes from @lineiconshq-pro/core-outlined.
import React from "react";
import { Lineicons } from "@lineiconshq/react-lineicons";
import { AlarmError } from "@lineiconshq-pro/core-outlined";
function App() {
return (
<div>
<Lineicons
icon={AlarmError}
size={24}
color="blue"
strokeWidth={1.5}
/>
</div>
);
}
export default App;To get an icon’s import name, open it on lineicons.com/icons , click Copy Icon Name, and convert it to PascalCase (alarm-error → AlarmError).
Tip: You can install free and Pro packages together. If two imports share a name, rename one on import, for example import { AlarmError as AlarmErrorSolid } from "@lineiconshq-pro/core-solid";.
Commit vendor/lineicons so CI and hosting builds can install it, but only in private repositories. Never publish the .tgz files to npm or push them to a public repo.
For deploying, updating, and troubleshooting, see Pro Packages.
API Reference
<Lineicons />
interface LineiconsProps extends React.SVGProps<SVGSVGElement> {
icon: React.ComponentType<React.SVGProps<SVGSVGElement>>;
size?: number | string;
color?: string;
strokeWidth?: number;
className?: string;
}| Prop | Type | Default | Description |
|---|---|---|---|
icon | React.ComponentType<SVGProps<SVGSVGElement>> | — (required) | The icon component to render. |
size | number | string | 24 | Icon size (pixels or CSS units). |
color | string | currentColor | Icon color. |
strokeWidth | number | 1.5 | Stroke width for outlined icons. |
className | string | — | Optional CSS class for custom styling. |
All other valid SVG props are supported and passed through.