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

abaabil

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abaabil

A lightweight SVG icon component for React.

  • 1.0.4
  • unpublished
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-85.71%
Maintainers
1
Weekly downloads
 
Created
Source

abaabil.icon

A lightweight SVG icon component for React.

Installation

npm install abaabil.icon

Usage

import React from 'react';
import Icon from 'abaabil.icon';

function MyApp() {
    return (
        <Icon
          size={32}
          iconName="myIcon"
        />
    );
}

Props

  • size (number, default: 32): Size of the icon.
  • iconName (string): ID of the icon in the SVG sprite.
  • style (object): Inline styles for the icon SVG element.

Icon Sprite

Important: This component expects an SVG sprite to be available at the root of your public directory.

Ensure that an SVG sprite is available at [your-domain]/sprite.svg. Each icon in the sprite should be given an ID, which will be referenced by the iconName prop.

Example SVG sprite structure:

<svg xmlns="http://www.w3.org/2000/svg">
  <symbol id="exampleIcon" viewBox="0 0 24 24">
    <!-- SVG path/data for the icon -->
  </symbol>
  <!-- More icons... -->
</svg>

Usage Example

To use an icon named exampleIcon from your sprite, utilize the iconName prop:

<Icon
  size={32}
  iconName="exampleIcon"
/>

The component will then render the icon using:

<use xlinkHref="/sprite.svg#exampleIcon" />

License

MIT

Keywords

FAQs

Package last updated on 14 Oct 2023

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