ichinya/moonshine-fontawesome-component

Font Awesome icons selection component for MoonShine

1.3.1 2025-01-26 10:15 UTC

This package is auto-updated.

Last update: 2025-04-17 10:13:51 UTC


README

PHP

Requirements

  • MoonShine v3.0+
MoonShine FontAwesomeIcon
2.0+ 1.0
3.0+ 1.1+

Installation

composer require ichinya/moonshine-fontawesome-component

Usage

Example of usage:

  • FontAwesome::make('<i class="fa-brands fa-telegram"></i>' , 'blue')
  • FontAwesome::make('fa-brands fa-telegram' , \MoonShine\Support\Enums\Color::Blue)

For out:

    echo FontAwesome::make('fa-brands fa-telegram')->toString();
    echo FontAwesome::make('fa-brands fa-telegram' , \MoonShine\Support\Enums\Color::Blue)->render();
    echo (string) FontAwesome::make('fa-brands fa-telegram' , \MoonShine\Support\Enums\Color::Blue);

You can use FontAwesome component in your resources:

class CustomResource extends ModelResource
{
    public function fields(): array
    {
        return [
             Select::make('Тип', 'type')->options([
//                    TelegramBot::class => FontAwesome::make('<i class="fa-brands fa-telegram"></i>' , 'blue'),
                    TelegramBot::class =>  Badge::make(FontAwesome::make('<i class="fa-brands fa-telegram"></i>' , 'blue') . 'Telegram', 'blue'),

                ]),
        ];
    }
}

Use in Menu:

use Ichinya\FontAwesome\Components\MenuItem;

protected function menu(): array
    {
        return [
            MenuItem::make('Файлы', FileResource::class)->fontAwesomeIcon('<i class="fa-solid fa-upload"></i>'),
        ];
    }

Plans

  • Macros to Fields.
  • fa-brands fa-telegram => telegram
  • Add more customization options for the FontAwesome Component.

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.