fawaziwalewa/filament-icon-picker 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

fawaziwalewa/filament-icon-picker

Composer 安装命令:

composer require fawaziwalewa/filament-icon-picker

包简介

A beautiful icon picker field for FilamentPHP v5 with support for Heroicons, Lucide and more

README 文档

README

Latest Version on Packagist Total Downloads License

Sponsored by Tasklemon.

A beautiful, searchable icon picker field for FilamentPHP v5, built with Livewire and Alpine.js. Select from multiple icon sets including Heroicons, Lucide, and more.

Filament Icon Picker

Icon Picker Preview

Features

  • 🎨 Beautiful UI - Clean, modern interface that matches Filament's design
  • 🔍 Searchable - Quickly find icons with real-time search
  • 📦 Multiple Icon Sets - Support for Heroicons, Lucide, Font Awesome, Bootstrap Icons, and more
  • Fast - Built with Alpine.js for instant interactions
  • 🎯 Native Filament Integration - Uses Filament's icon rendering system
  • 🌙 Dark Mode - Full dark mode support
  • ⚙️ Configurable - Customize sets, columns, search, and more
  • 🧪 Production Ready - Clean, tested, maintainable code

Requirements

  • PHP 8.2+
  • Laravel 12+
  • FilamentPHP v5.0+
  • Blade Icons (blade-ui-kit/blade-icons)

Installation

Install the package via Composer:

composer require fawaziwalewa/filament-icon-picker

Optional (recommended):

php artisan vendor:publish --tag="filament-icon-picker-config"

Optional (only if you want to override the UI):

php artisan vendor:publish --tag="filament-icon-picker-views"

Configuration

The configuration file (config/filament-icon-picker.php) controls:

  • which icon sets are available and enabled
  • default selected sets (sets)
  • default grid columns (columns)
  • default search toggle (searchable)
  • placeholder text (placeholder)
  • caching and endpoint behavior

Heroicons, Lucide, Font Awesome, and Bootstrap Icons are bundled as Composer dependencies of this package.

Usage

use FawazIwalewa\FilamentIconPicker\Forms\Components\IconPicker;

IconPicker::make('icon')
    ->label('Icon')
    ->required();

Sets

Sets are referenced by their config keys (from filament-icon-picker.icon_sets):

IconPicker::make('icon')
    ->sets(['heroicons', 'lucide', 'bootstrap']);

Grid + search

IconPicker::make('icon')
    ->gridColumns(8)
    ->searchable(true)
    ->placeholder('Pick an icon');

Prefix icon behavior (important)

The selected icon is always shown as the field prefix icon using Filament's input wrapper styling.

  • Do not call ->prefixIcon(...) on this field.
  • IconPicker::prefixIcon() is intentionally not supported and will throw.

Rendering icons

The selected value is stored as a string (e.g. heroicon-o-user, lucide-alarm-clock, bi-alarm, fas-user).

In Filament

use Filament\Tables\Columns\TextColumn;

TextColumn::make('name')
    ->icon(fn ($record) => $record->icon);

In Blade

@php
    $html = rescue(fn () => svg($record->icon, 'h-6 w-6')->toHtml(), '');
@endphp

@if (filled($html))
    {!! $html !!}
@endif

Normalizing legacy Font Awesome values

If you have existing database values saved as fa-solid-* / fa-regular-* / fa-brands-*, normalize them to fas-* / far-* / fab-* when reading/writing:

use FawazIwalewa\FilamentIconPicker\Services\IconService;
use Illuminate\Database\Eloquent\Casts\Attribute;

protected function icon(): Attribute
{
    return Attribute::make(
        get: fn (?string $value): ?string => IconService::normalizeIconName($value),
        set: fn (?string $value): ?string => IconService::normalizeIconName($value),
    );
}

How it works

  • The dropdown UI is Alpine.js.
  • Icons are fetched lazily from a paginated JSON endpoint.
  • The endpoint is protected by web + auth middleware and throttled.

Artisan commands

php artisan filament-icon-picker:list

Filter by set key:

php artisan filament-icon-picker:list --set=heroicons

Search:

php artisan filament-icon-picker:list --search=user

Export:

php artisan filament-icon-picker:list --json > icons.json

Testing

php artisan test

Changelog

See CHANGELOG.

Contributing

See CONTRIBUTING.

Security

See SECURITY.

License

The MIT License (MIT). Please see License File for more information.

fawaziwalewa/filament-icon-picker 适用场景与选型建议

fawaziwalewa/filament-icon-picker 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.06k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2026 年 01 月 25 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「icon-picker」 「livewire」 「filament」 「Heroicons」 「lucide」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 fawaziwalewa/filament-icon-picker 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 fawaziwalewa/filament-icon-picker 我们能提供哪些服务?
定制开发 / 二次开发

基于 fawaziwalewa/filament-icon-picker 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.06k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 11
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-25