bugo / moonshine-heroicons-field
MoonShine 的 Heroicons 选择字段
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
为 MoonShine 提供方便的 Heroicons 选择字段
安装
composer require bugo/moonshine-heroicons-field
配置
您可以指定图标所需的默认样式
.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'), ];
使用方法
您可以在资源中使用 Icon
字段
<?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'), ]; } }
Blade Heroicons 的所有用例也为您可用。
缓存
在 Blade 模板中使用图标时,请确保启用 缓存。
贡献
欢迎拉取请求。对于重大更改,请首先提交一个问题以讨论您想要更改的内容。
请确保根据需要更新测试。