Giter VIP home page Giter VIP logo

heroicon's Introduction

Heroicon Nova Field

A Laravel Nova Field for managing icons. Heroicons and free Font Awesome supported out of the box, pro version of Font Awesome can be registered as custom set of icons.

Custom sets of icons can be registered globally for each field or locally for concrete field instanse and used with or instead default sets.

Each icon can be changed via editor.

Icon saved as svg html tag into db.

Installation:

Use composer for installation. Laravel with nova required.

composer require alexazartsev/heroicon

Usage:

Use it as regular nova field:

use AlexAzartsev\Heroicon\Heroicon;

Heroicon::make('Icon');

Default icon sets available:

Name Label Icons
solid Heroicons solid Heroicons solid
outline Heroicons outline Heroicons outline
fa-brands Font Awesome brands Font Awesome brands
fa-solid Font Awesome solid Font Awesome solid
fa-regular Font Awesome regular Font Awesome regular

To use custom or customize existing icon click on Edit button and just edit svg code of selected icon:

To register custom set of icons use global or local configuration discribed below:

Configuration:

Global configuration:

Field can be configured globally in NovaServiceProvider:

namespace App\Providers;

use AlexAzartsev\Heroicon\Heroicon;

class NovaServiceProvider extends NovaApplicationServiceProvider
{
    ...
    public function boot()
    {
        parent::boot();
        
        // to register set of icons globally, just specify folder with svg icons like this:
        // (icons should be located directly in specified folder in .svg format)
        // 'custom' icon set will be available for every Heroicon in your app
        Heroicon::registerGlobalIconSet('custom', 'Custom Icons', resource_path('img/icons'));
        // to pick default icon sets that will be available on field all over app use this:
        // default sets available: 'solid', 'outline', 'fa-brands', 'fa-regular', 'fa-solid'
        Heroicon::defaultIconSets(['solid', 'fa-brands', 'custom']);
        // to make svg editor disabled by default for every field use this:
        Heroicon::defaultEditorEnable(false);

    }

Local configuration:

To disable or enable svg editor of the icon:

use AlexAzartsev\Heroicon\Heroicon;

Heroicon::make('Icon')->disableEditor();
Heroicon::make('Icon')->enableEditor();

To register custom set of icons (icons should be located directly in specified folder in .svg format):

use AlexAzartsev\Heroicon\Heroicon;

Heroicon::make('Icon')->registerIconSet('custom', 'Custom', resource_path('img/icons'));

To allow certain sets of icons:

use AlexAzartsev\Heroicon\Heroicon;

Heroicon::make('Icon')->only(['custom', 'solid']);
//for default sets you can use these methods:
Heroicon::make('Icon')->onlySolid();
Heroicon::make('Icon')->onlyOutline();
Heroicon::make('Icon')->onlyFaBrands();
Heroicon::make('Icon')->onlyFaSolid();
Heroicon::make('Icon')->onlyFaRegular();

Support:

[email protected]

License:

The MIT License (MIT). Please see License File for more information.

heroicon's People

Contributors

alexazartsev avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.