marshmallow / nova-fontawesome
A Font Awesome 6 Field for Laravel Nova 4
Installs: 14 281
Dependents: 1
Suggesters: 0
Security: 0
Stars: 7
Watchers: 1
Forks: 1
Open Issues: 1
Language:Vue
Requires
- php: ^8.0|^8.1
- laravel/nova: ^4.0|^5.0
- outl1ne/nova-translations-loader: ^5.0
README
A Laravel Nova 4 Field for Font Awesome 6 Icons
Installation:
You can install the package in to a Laravel app that uses Nova via composer:
composer require marshmallow/nova-fontawesome
Then copy FontAwesome v6 css assets to Laravel public path where this plugin will try to access:
- FontAwesome icon definition : http(s)://{fqdn}/css/all.min.css
/public/css/fontawesome.css
Usage:
Add the below to app/Nova resources.
use Marshmallow\NovaFontAwesome\NovaFontAwesome; NovaFontAwesome::make('Icon')
Add fontawesome.css to the public/css
You can override the text for the field button like so
NovaFontAwesome::make('Icon')->addButtonText('Click Me!')
You can set a default icon for when an icon has not been set like so. First parameter is the type e.g. far, fas, fab and the second is the icon name (without fa-)
NovaFontAwesome::make('Icon')->defaultIcon('far', 'check-circle')
If you want to persist the default icon (when they press clear it brings back the default so it can't be empty) then add the following:
NovaFontAwesome::make('Icon')->addButtonText('Click Me!')->defaultIcon('far', 'check-circle')->persistDefaultIcon()
You can limit the icons the user can choose from like so
NovaFontAwesome::make('Icon')->only([ 'facebook', 'twitch', 'twitter', ])
You can use Font Awesome Pro by doing the following (remember to get your license key!)
NovaFontAwesome::make('Icon')->pro()
Development
FONTAWESOME_NPM_AUTH_TOKEN=YOUR_TOKEN npm install
Free:
- @fortawesome/fontawesome-free@next
- @fortawesome/fontawesome-svg-core@next
- @fortawesome/free-solid-svg-icons@next
- @fortawesome/free-brands-svg-icons
- @fortawesome/free-regular-svg-icons@next
Pro:
- @fortawesome/fontawesome-pro@next
- @fortawesome/pro-solid-svg-icons@next
- @fortawesome/pro-regular-svg-icons@next
- @fortawesome/pro-light-svg-icons@next
- @fortawesome/pro-thin-svg-icons@next
- @fortawesome/pro-duotone-svg-icons@next
Credits
Based on Fontawesome Package by mdixon18 & PR from duckzland. See https://github.com/mdixon18/fontawesome
License:
The MIT License (MIT). Please see License File for more information.