0.1.58 • Published 1 year ago

abaabil v0.1.58

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

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

0.1.58

1 year ago

0.1.52

1 year ago

0.1.53

1 year ago

0.1.54

1 year ago

0.1.50

1 year ago

0.1.51

1 year ago

0.1.49

2 years ago

0.1.41

2 years ago

0.1.42

2 years ago

0.1.43

2 years ago

0.1.44

2 years ago

0.1.45

2 years ago

0.1.46

2 years ago

0.1.47

2 years ago

0.1.48

2 years ago

0.1.40

2 years ago

0.1.38

2 years ago

0.1.39

2 years ago

0.1.31

2 years ago

0.1.32

2 years ago

0.1.33

2 years ago

0.1.34

2 years ago

0.1.35

2 years ago

0.1.36

2 years ago

0.1.37

2 years ago

0.1.13

2 years ago

0.1.14

2 years ago

0.1.15

2 years ago

0.1.30

2 years ago

0.1.27

2 years ago

0.1.28

2 years ago

0.1.29

2 years ago

0.1.20

2 years ago

0.1.21

2 years ago

0.1.22

2 years ago

0.1.23

2 years ago

0.1.24

2 years ago

0.1.25

2 years ago

0.1.26

2 years ago

0.1.16

2 years ago

0.1.17

2 years ago

0.1.18

2 years ago

0.1.19

2 years ago

0.1.10

2 years ago

0.1.11

2 years ago

0.1.12

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.9

2 years ago

0.0.24

2 years ago

0.0.25

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.0.26

2 years ago

0.0.27

2 years ago

0.0.28

2 years ago

0.0.29

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.0.22

2 years ago

0.0.23

2 years ago

0.0.20

2 years ago

0.0.21

2 years ago

0.0.18

2 years ago

0.0.19

2 years ago

0.0.10

2 years ago

0.0.11

2 years ago

0.0.14

2 years ago

0.0.9

2 years ago

0.0.16

2 years ago

0.0.8

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago