Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lil-icons/react

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lil-icons/react

SVG icons components for React

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

lil-icons

Demo

Installation

npm install @lil-icons/react

or

yarn add @lil-icons/react

Usage

Use icon as a common component:

import { IconSuccess } from '@lil-icons/react';

const MyComponent = () => (
  <div>
    <IconSuccess />
  </div>
);

You can use LilIconsContext to declare props once in the root component, they will be passed down to all the icons. It uses Context API:

import { LilIconsContext, IconSuccess } from '@lil-icons/react';

const App = () => (
  <div>
    <LilIconsContext.Provider value={{ color: 'green', width: 64, height: 64 }}>
      <IconSuccess /> // green 64x64
    </LilIconsContext.Provider>
  </div>
);

Icon props have a higher priority than provider props:

<LilIconsContext.Provider value={{ color: 'green' }}>
  <IconSuccess color="red" /> // red
</LilIconsContext.Provider>

You can get props from context in your custom components using withLilIconsContext:

import { withLilIconsContext } from '@lil-icons/react';

const SomeIcon = ({ width, height, color }) => (
  <svg width={width} height={height} color={color}>
    ...
  </svg>
);

const MyCustomIcon = withLilIconsContext(SomeIcon);

Props

PropTypeRequired
colorStringNo
widthString or NumberNo
heightString or NumberNo

Keywords

FAQs

Package last updated on 20 Aug 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc