bugo / moonshine-fontawesome-field
Font Awesome icons selection field for MoonShine
Package info
github.com/dragomano/moonshine-fontawesome-field
pkg:composer/bugo/moonshine-fontawesome-field
Requires
- php: ^8.4
- owenvoke/blade-fontawesome: ^3.3
Requires (Dev)
- laravel/pint: ^1.32
- moonshine/moonshine: ^5.0
- orchestra/testbench: ^10.0|^11.0
- pestphp/pest: ^4.7|^5.3
- pestphp/pest-plugin-laravel: ^4.0|^5.0
- rector/rector: ^2.8
Suggests
None
Provides
None
Conflicts
- moonshine/moonshine: <5.0
Replaces
None
README
Convenient Font Awesome icons selection field for MoonShine
Support MoonShine versions
| MoonShine | This package |
|---|---|
| 2.0+ | 0.x |
| 3.0+ | 1.x |
| 4.0+ | 2.x |
| 5.0+ | 3.x |
Requirements
MoonShine 5 requires PHP 8.4+ and Laravel 11, 12 or 13.
This package additionally requires Laravel 12 or 13: owenvoke/blade-fontawesome depends on
illuminate/support ^12.0|^13.0, so Laravel 11 is not supported.
Installation
composer require bugo/moonshine-fontawesome-field
Usage
You can use IconSelect field in your resources:
<?php declare(strict_types=1); namespace App\MoonShine\Resources; use Bugo\MoonShine\FontAwesome\Fields\IconSelect; use MoonShine\Laravel\Resources\ModelResource; use MoonShine\Contracts\UI\FieldContract; use MoonShine\Contracts\UI\ComponentContract; /** * @extends ModelResource<Custom> */ class CustomResource extends ModelResource { /** * @return list<ComponentContract|FieldContract> */ protected function formFields(): iterable { return [ IconSelect::make('Icon') ->searchable(), ]; } }
All use cases of Blade Font Awesome are also available for you.
Escaping
Since MoonShine 5 labels, hints and prefixes are escaped by default. If you need raw HTML in them, disable escaping for the specific element:
IconSelect::make('<strong>Icon</strong>') ->unescapeLabel();
Caching
When using icons in Blade templates, be sure to enable Caching.
How to update icon sets
Once the package is installed, run these commands:
pnpm add @fortawesome/fontawesome-free -D php artisan moonshine:update-fa-icons
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.