An open API service indexing awesome lists of open source software.

https://github.com/viewi/icons

SVG icons package for Viewi
https://github.com/viewi/icons

Last synced: 6 months ago
JSON representation

SVG icons package for Viewi

Awesome Lists containing this project

README

          

# Viewi Icons package

## SVG Sprites:

- Has bootstrap icons on board [https://icons.getbootstrap.com/](https://icons.getbootstrap.com/)

Append prefix `bi-` to use the icon. It is necessary in order to avoid conflicts with future icon sprites.

For example, for icon `emoji-sunglasses` use `bi-emoji-sunglasses`: ``

## SVG sprite vs. Font icons

An SVG sprite renders directly into the page (or can be accessed as an asset with a URL). Then, you can use the icon from that sprite.
Sprite includes only those icons that you really want to use.

Font icons require you to include links to the font and css, which have all the icons altogether, even if you are not using most of them.

## How to use

`composer require viewi/icons`

In your Viewi config:

Add `use Viewi\Icons\ViewiIcons;`

Use the package `->use(ViewiIcons::class)`;

```php

use(ViewiIcons::class)

// ...

return $viewiConfig;
```

Add sprite component `IconsSprite` at the beginning of the `body` tag in your layout component, for example:

```html


$title | {t('layout.title')}

...


...

```

`IconsSprite` renders the sprite (or SVG map) with icons that you use.

Package will analyze your source code and include only those icons that you really use.

For example, if you use `emoji-sunglasses` icon only, it will render something like this:

```html









```

Use the icon:

```html

```

This will render something like this:

```html

```

Custom class with `classList`:

```html

```

Will render:

```html

```

Support
--------

We all have full-time jobs and dedicate our free time to this project, and we would appreciate Your help of any kind. If you like what we are creating here and want us to spend more time on this, please consider supporting:

- Give us a star⭐.
- Support me on [buymeacoffee](https://www.buymeacoffee.com/ivan.v)
- Follow us on [Twitter/X](https://x.com/viewiphp).
- Contribute by sending pull requests.
- Any other ideas or proposals? Please mail me contact@viewi.net.
- Feel welcome to share this project with your friends.

License
--------

Copyright (c) 2020-present Ivan Voitovych

Please see [MIT](/LICENSE) for license text