tempi-marathon / blade-meteocons
A package to easily make use of Meteocons in your Laravel Blade views.
Requires
- php: ^8.2
- blade-ui-kit/blade-icons: ^1.6
- illuminate/support: ^10.0|^11.0|^12.0|^13.0
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0|^10.0|^11.0
- phpunit/phpunit: ^10.5|^11.0|^12.0
README
A package to easily make use of Meteocons in your Laravel Blade views.
For a full list of available icons see the SVG directory or preview them at meteocons.com.
Requirements
- PHP 8.2 or higher
- Laravel 10.0 or higher
Installation
composer require tempi-marathon/blade-meteocons
Updating
Please refer to the upgrade guide when updating the library.
To regenerate icons from upstream locally:
npm install composer install vendor/bin/blade-icons-generate
Blade Icons
Blade Meteocons uses Blade Icons under the hood. Please refer to the Blade Icons readme for additional functionality. We also recommend to enable icon caching with this library.
Configuration
Blade Meteocons also offers the ability to use features from Blade Icons like default classes, default attributes, etc. If you'd like to configure these, publish the blade-meteocons.php config file:
php artisan vendor:publish --tag=blade-meteocons-config
Variants
Icons are generated from both @meteocons/svg (animated) and @meteocons/svg-static (static), across all four styles:
| Prefix | Source | Notes |
|---|---|---|
fill- |
Animated fill | Self-colored illustration |
flat- |
Animated flat | Self-colored illustration |
line- |
Animated line | Self-colored illustration |
mono- |
Animated monochrome | Tintable via currentColor / text-* |
static-fill- |
Static fill | Self-colored illustration |
static-flat- |
Static flat | Self-colored illustration |
static-line- |
Static line | Self-colored illustration |
static-mono- |
Static monochrome | Tintable via currentColor / text-* |
Tinting caveat: only mono- and static-mono- icons are designed to inherit currentColor. Fill, flat, and line variants (animated or static) keep baked-in colors and — for animated sources — SMIL animations. Treat those as illustrations rather than UI icons you recolor with utility classes.
Usage
Icons can be used as self-closing Blade components which will be compiled to SVG icons:
<x-meteocon-static-mono-clear-day/>
You can also pass classes to your icon components:
<x-meteocon-static-mono-clear-day class="w-6 h-6 text-sky-500"/>
And even use inline styles:
<x-meteocon-static-mono-clear-day style="color: #555"/>
Animated fill icons can be referenced like this:
<x-meteocon-fill-clear-day class="w-12 h-12"/>
Helpers and directives
@svg('meteocon-mono-rain') {{ svg('meteocon-line-cloudy') }}
Filament
Because Filament uses Blade Icons, pass the icon name wherever Filament accepts an icon string:
Actions\Action::make('weather') ->icon('meteocon-static-mono-clear-day');
Raw SVG Icons
If you want to use the raw SVG icons as assets, you can publish them using:
php artisan vendor:publish --tag=blade-meteocons --force
Then use them in your views like:
<img src="{{ asset('vendor/blade-meteocons/static-mono-clear-day.svg') }}" width="64" height="64"/>
Changelog
Check out the CHANGELOG in this repository for all the recent changes.
Maintainers
Blade Meteocons is developed and maintained by tempi-marathon.
Icons are designed by Bas Milius as part of Meteocons.
License
Blade Meteocons is open-sourced software licensed under the MIT license.
The bundled Meteocons icons are also MIT-licensed — copyright (c) 2020-present Bas Milius.