NPM Packages
Lineicons also have npm packages, if you want to use them you can do that very easily. Lineicons have two npm packages, one is just the library other one is for React.js
Let’s show you how you can use the Lineicons npm packages.
Lineicons Package
You can download the npm package using this command:
npm install lineicons
or
yarn add lineicons
After the installation is done, you’ll have to include the CSS file in your project.
Here’s the code for including the CSS file:
<link rel="stylesheet" href="./node_modules/lineicons/web-font/lineicons.css" />
Lineicons React
You can use Lineicons with React.js too. All you have to do is install the Lineicons React package.
Here’s the code to install it:
npm install lineicons-react
or
yarn add lineicons-react
After that, all you have to do is import the Lineicons package you installed earlier and call the component with the icon name.
Like this:
import React from "react";
import ReactDOM from "react-dom";
import LineIcon from "lineicons-react";
function App() {
return <LineIcon name="spinner" />;
}