bugo / moonshine-heroicons-field
Heroicons selection field for MoonShine
0.3
2024-04-22 13:45 UTC
Requires
- php: ^8.1|^8.2
- blade-ui-kit/blade-heroicons: ^2.3
Requires (Dev)
- moonshine/moonshine: ^2.10.0
- orchestra/testbench: ^8.0
- pestphp/pest: ^2.34
- pestphp/pest-plugin-laravel: ^2.2
- rector/rector: ^1.0
Conflicts
- moonshine/moonshine: <2.0
README
Convenient Heroicons selection field for MoonShine
Installation
composer require bugo/moonshine-heroicons-field
Configuration
You can specify desired default style for icons:
.env
:
HEROICONS_STYLE=outline
config/heroicons-field.php
:
php artisan vendor:publish --tag=heroicons-field
/* * Possible values: * 's', 'solid' - Solid 24x24, Solid fill * 'o', 'outline' - Outline 24x24, 1.5px stroke * 'm', 'mini' - Mini 20x20, Solid fill * 'c', 'micro' - Micro 16x16, Solid fill */ return [ 'style' => env('HEROICONS_STYLE', 'solid'), ];
Usage
You can use Icon
field in your resources:
<?php declare(strict_types=1); namespace App\MoonShine\Resources; use Bugo\MoonShine\Heroicons\Fields\Icon; use MoonShine\Resources\ModelResource; /** * @extends ModelResource<Custom> */ class CustomResource extends ModelResource { public function fields(): array { return [ Icon::make('Icon') ->searchable() ->style('mini'), ]; } }
All use cases of Blade Heroicons are also available for you.
Caching
When using icons in Blade templates, be sure to enable Caching.
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.