- Does this package support Filament v3.x?
- The package was last updated in 2024 with a minor bug fix, but there’s no explicit confirmation of Filament v3.x compatibility. Test it in a staging environment or check the closed issue #3 for clues. If broken, consider forking or exploring alternatives like `spatie/laravel-color-picker` for Filament.
- How do I install and set up the Tailwind color picker in Filament?
- Run `composer require happytodev/filament-tailwind-color-picker:^0.1.9` and ensure Tailwind CSS is installed. Add the field to your Filament form using `ColorPicker::make('field_name')->default('#ffffff')`. No additional JavaScript is required beyond Filament’s core setup.
- Can I customize the color palette beyond Tailwind’s defaults?
- Yes, you can override the palette by passing an array of custom hex values: `ColorPicker::make('color')->palette(['brand' => '#10b981', 'custom' => '#ff0000'])`. However, hardcoded Tailwind classes may limit full theming flexibility.
- Will this work with Laravel 10 and PHP 8.2?
- The package has no PHP 8.2-specific dependencies, but it lacks type hints, which could pose runtime risks. Test thoroughly in your Laravel 10 environment, especially if using Filament v3.x, as compatibility isn’t guaranteed.
- Does the live preview feature work reliably in production?
- The live preview is functional, but the 2024 bug fix (issue #3) may address flickering or rendering issues. Profile performance with Laravel Telescope to check for unnecessary re-renders, especially in high-traffic admin panels.
- How do I handle invalid hex color inputs (e.g., #g00000) in forms?
- Add validation rules to your Filament form field, such as `ColorPicker::make('color')->rules(['regex:/^#[0-9A-F]{6}$/i'])` to enforce valid hex formats. The package itself doesn’t validate inputs, so rely on Filament’s built-in validation.
- Is this package compatible with Tailwind CSS v3.x and JIT mode?
- The package requires Tailwind CSS but hasn’t been explicitly tested with v3.x or JIT mode. If using custom colors in `tailwind.config.js`, ensure they’re included in the picker’s palette via the `palette()` method to avoid mismatches.
- What are the alternatives if this package doesn’t meet my needs?
- Consider `spatie/laravel-color-picker` for broader color format support (HSL/RGB) or `filament/filament`’s native `ColorPicker` field if you’re on v3.x. For Tailwind-specific needs, check if forking this package to add Filament v3.x support is viable.
- How do I test this package for regressions after the 2024 bug fix?
- Test edge cases like empty inputs, invalid hex values, and Tailwind JIT mode. Verify live preview functionality by toggling colors in a form and checking for visual glitches. Use Filament’s built-in testing tools or Laravel Pest for automated checks.
- Can I use this with Filament plugins that override form fields?
- Potential conflicts may arise if plugins modify Filament’s form field rendering. Test in a staging environment with your plugin stack enabled. If issues occur, inspect the plugin’s field registration logic for overrides.