- How do I integrate this icon picker into a Filament form?
- Use the `IconPicker` field in your Filament form builder. For example, add `IconPicker::make('icon_field')` to your form’s `$fields` array. The package automatically handles validation and UI rendering. You can customize the available icon sets via config or directly in the field definition.
- Which Laravel and Filament versions are supported?
- This package requires **Laravel 12+**, **Filament 5.0+**, and **PHP 8.2+**. It’s designed for modern Laravel stacks and won’t work with older versions like Laravel 10 or Filament 4. Always check the [GitHub repo](https://github.com/wallacemartinss/filament-icon-picker) for updates on version compatibility.
- Can I restrict which icon sets are available in the picker?
- Yes, you can restrict icon sets via the `config/filament-icon-picker.php` file. Use the `available_icon_sets` array to whitelist or blacklist sets like `['heroicons', 'phosphor']`. This helps reduce bundle size and improves performance, especially for large icon libraries like Phosphor or Material.
- Does this package work with custom Tailwind CSS themes?
- The package is optimized for Tailwind CSS and uses its utility classes. If your project uses a custom Tailwind theme, ensure the icon picker’s styles (e.g., modal, grid, and search bar) align with your design system. Override Tailwind classes in your `app.css` if needed, or extend the package’s published assets.
- How do I cache icons for better performance in production?
- Run `php artisan icons:cache` to generate a static JSON file of all available icons. This reduces runtime processing and speeds up the picker’s load time. Cache the file in your CI/CD pipeline or after updating icon sets. For large libraries like Phosphor, caching is highly recommended to avoid performance hits.
- Can I use dynamic icons (e.g., based on user input) without Enums?
- Yes, use the `Icon::helper()` method to dynamically generate icon names or paths. For example, `Icon::helper('heroicons-outline', 'user')` returns the correct Blade icon syntax. This is useful for cases where you need flexibility beyond the auto-generated Enums, though Enums provide compile-time safety.
- Will this package break if I upgrade to Filament 6.0?
- The package is currently tied to **Filament 5.0+**, so an upgrade to Filament 6.0 may require updates. Monitor the [GitHub repo](https://github.com/wallacemartinss/filament-icon-picker) for compatibility announcements. If no updates are provided, you can fork the package or check for community forks that support Filament 6.
- How do I add custom animations or styling to the modal?
- Extend the package’s Blade views or publish its assets using `php artisan vendor:publish --tag=filament-icon-picker-assets`. Override the modal’s CSS classes (e.g., `.filament-icon-picker-modal`) in your global stylesheet. For animations, use Tailwind’s animation utilities or add custom JavaScript via the `extra_attributes` option in the field definition.
- Is there a way to test the icon picker in a CI environment?
- Test the picker by mocking the Blade Icons service or using a headless browser like Laravel Dusk. Ensure your CI environment includes the required icon sets (installed via Composer) and that the `icons:cache` command runs before tests. Focus on testing the field’s validation, icon selection, and UI rendering in isolation.
- What are the alternatives to this package for Filament icon management?
- Alternatives include manually using Blade Icons with custom form fields or leveraging third-party packages like `spatie/laravel-filament-resources` for basic icon support. However, this package stands out for its **dedicated modal UI, infinite scroll, and deep Filament integration**. If you need a lighter solution, consider `filament/spatie-laravel-medialibrary` for icon storage but not selection.