g4b0rdev / filament-solar-icons
Solar icon pack for Filament Icons
Installs: 27
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/g4b0rdev/filament-solar-icons
Requires
- php: ^8.4
- codeat3/blade-solar-icons: ^1.3
- filafly/filament-icons: ^2.0
- filament/filament: ^4.1
Requires (Dev)
- laravel/pint: ^1.25
README
Filament Solar Icons
A Solar icon set implementation for Filament 4.x, providing the full set of Solar icons integrated with Filament's interface.
Important
The Solar icon set by 480 Design is licensed under CC BY 4.0. See Icon License section below for attribution requirements.
Index
> Installation..................................................................... > Icon Styles...................................................................... > Using Icons in Custom Enums...................................................... > Custom Enum with Icons......................................................... > Available Icon Style Enums..................................................... > Example: Table Column with Custom Icons........................................ > Example: Form Field with Icon.................................................. > Mixing Icon Styles............................................................. > Override Specific Icons.......................................................... > Override Icon Aliases.......................................................... > Override Individual Icons...................................................... > Override Styles for Specific Aliases........................................... > Override Styles for Specific Icons............................................. > Icon License..................................................................... > CC BY 4.0 Requirements......................................................... > Credits.......................................................................... > License..........................................................................
Installation
Install via Composer:
composer require g4b0rdev/filament-solar-icons
Register the plugin in your Filament Panel provider:
use G4b0rDev\Icons\Solar\SolarIcons; public function panel(Panel $panel): Panel { return $panel ->plugin(SolarIcons::make()); }
Icon Styles
Solar icons come in seven styles: bold
, broken
, duotone
, linear
, outline
, bold-duotone
, and line-duotone
.
By default, the package uses the outline
style. You can change the global style:
SolarIcons::make() ->style('bold');
Using Icons in Custom Enums
When you need to use Solar icons in custom enums or other contexts where you need the full icon name with the solar-
prefix, use the getIconName()
method.
This is particularly useful for Filament's HasIcon
interface.
Custom Enum with Icons
Example for enum:
<?php declare(strict_types=1); use Filament\Support\Contracts\HasColor; use Filament\Support\Contracts\HasIcon; use G4b0rDev\Icons\Solar\Enums\SolarLineDuotone; enum Status: string implements HasColor, HasIcon { case DRAFT = 'draft'; case PUBLISHED = 'published'; case ARCHIVED = 'archived'; public function getIcon(): string { return match ($this) { self::DRAFT => SolarLineDuotone::Pen->getIconName(), self::PUBLISHED => SolarLineDuotone::CheckRead->getIconName(), self::ARCHIVED => SolarLineDuotone::Box->getIconName(), }; } public function getColor(): string { return match ($this) { self::DRAFT => 'secondary', self::PUBLISHED => 'success', self::ARCHIVED => 'danger', }; } }
Available Icon Style Enums
All seven icon styles have corresponding enums with the getIconName()
method:
SolarBold
- Bold style iconsSolarBroken
- Broken style iconsSolarLinear
- Linear style iconsSolarOutline
- Outline style iconsSolarBoldDuotone
- Bold duotone style iconsSolarLineDuotone
- Line duotone style icons
Example: Table Column with Custom Icons
use Filament\Tables\Columns\TextColumn; use G4b0rDev\Icons\Solar\Enums\SolarBold; TextColumn::make('status') ->badge() ->icon(fn (string $state): string => match ($state) { 'active' => SolarBold::CheckCircle->getIconName(), 'inactive' => SolarBold::CloseCircle->getIconName(), 'pending' => SolarBold::ClockCircle->getIconName(), default => SolarBold::QuestionCircle->getIconName(), })
Example: Form Field with Icon
use Filament\Forms\Components\TextInput; use G4b0rDev\Icons\Solar\Enums\SolarOutline; TextInput::make('email') ->email() ->prefixIcon(SolarOutline::Letter->getIconName())
Mixing Icon Styles
You can mix different icon styles in the same component:
enum Priority: string implements HasIcon { case HIGH = 'high'; case MEDIUM = 'medium'; case LOW = 'low'; public function getIcon(): string { return match ($this) { self::HIGH => SolarBold::DangerTriangle->getIconName(), self::MEDIUM => SolarOutline::InfoCircle->getIconName(), self::LOW => SolarLinear::CheckCircle->getIconName(), }; } }
Override Specific Icons
Override Icon Aliases
SolarIcons::make() ->overrideAlias(PanelsIconAlias::SIDEBAR_EXPAND_BUTTON, SolarBold::AltArrowRight) ->overrideAlias(TablesIconAlias::SEARCH_FIELD, SolarOutline::Magnifer);
Or override multiple aliases:
SolarIcons::make() ->overrideAliases([ PanelsIconAlias::SIDEBAR_EXPAND_BUTTON => SolarBold::AltArrowRight, TablesIconAlias::SEARCH_FIELD => SolarOutline::Magnifer, ActionsIconAlias::CREATE_ACTION_GROUPED => SolarBold::AddCircle, ]);
Override Individual Icons
SolarIcons::make() ->overrideIcon(SolarOutline::MinimalisticMagnifer, SolarBold::Magnifer) ->overrideIcon(SolarOutline::AddCircle, SolarBold::AddSquare);
Or override multiple icons:
SolarIcons::make() ->overrideIcons([ SolarOutline::MinimalisticMagnifer->value => SolarOutline::Magnifer, SolarOutline::AddCircle->value => SolarOutline::AddSquare, SolarOutline::Pen->value => SolarOutline::PenNewSquare, ]);
Override Styles for Specific Aliases
SolarIcons::make() ->style('outline') ->overrideStyleForAlias(PanelsIconAlias::SIDEBAR_EXPAND_BUTTON, 'bold') ->overrideStyleForAlias([ TablesIconAlias::SEARCH_FIELD, TablesIconAlias::ACTIONS_FILTER, ], 'broken');
Override Styles for Specific Icons
SolarIcons::make() ->style('outline') ->overrideStyleForIcon(SolarOutline::Magnifer, 'bold') ->overrideStyleForIcon([ SolarOutline::Home, SolarOutline::User, ], 'broken');
Icon License
Important: The Solar icon set by 480 Design is licensed under CC BY 4.0.
CC BY 4.0 Requirements
When using Solar icons, you must:
- Give appropriate credit to 480 Design
- Provide a link to the license: https://creativecommons.org/licenses/by/4.0/
- Indicate if changes were made to the icons (if applicable)
You may satisfy the attribution requirement by including a notice in your application's credits, about page, or documentation. Example:
Icons by Solar Icon Set (480 Design) - CC BY 4.0
https://github.com/480-Design/Solar-Icon-Set
Credits
- Solar Icon Set for the icons
- codeat3 for the blade icon pack
- Filament Icons for the base icon system
- G4b0rDev
- All Contributors
License
The MIT License (MIT). Please see License for more information.