devletes/filament-progress-bar
Reusable progress bar components for Filament 5 tables and infolists. Shared API for columns/entries, built-in success/warning/danger thresholds (ascending/descending) or custom state maps, multiple sizes and text positions, dark-mode aware styling, and proper progressbar semantics.
ProgressBarColumn, ProgressBarEntry), making it modular and reusable across tables and infolists.maxValue() and structured arrays (progress/total), accommodating diverse data models without forcing schema changes.--primary-500) for default colors. Custom themes may need adjustments to ensure visual consistency.successColor(fn ($record) => ...)) add runtime overhead but enable powerful customization. Overuse could complicate debugging.primary-500, warning-500, etc.) align with the project’s design system? If not, how will custom colors be managed?role="progressbar" and ARIA attributes meet WCAG compliance? Test with screen readers if accessibility is a priority.composer require devletes/filament-progress-bar
php artisan filament:assets
filament:assets command is idempotent and only registers the package’s CSS.ProgressBarColumn or ProgressBarEntry.// Before (custom HTML)
TextColumn::make('storage_used')
->getStateUsing(fn ($record) => "{$record->used}GB / {$record->total}GB");
// After (progress bar)
ProgressBarColumn::make('storage_used')
->state(fn ($record) => [
'progress' => $record->used,
'total' => $record->total,
])
->thresholdDirection('descending')
->warningThreshold(80);
progress/total or maxValue). Add computed properties or database columns if needed.// In a Filament service provider
Filament::serving(function () {
ProgressBarColumn::configureUsing(function ($component) {
$component->successColor('#10b981'); // Custom green
});
});
dangerLabel(fn ($current, $total) => ...)), enabling i18n if labels are localized.ProgressBarColumn/ProgressBarEntry to test threshold logic and data resolution.maxValue(fn ($record) => ...)) can obscure errors. Log intermediate values during development:
->maxValue(fn ($record) => {
\Log::debug('Max value for record ' . $record->id, ['value' => $record->quota]);
return $record->quota;
})
Html column or custom Vue components.successColor(fn ($record) => ...)) add per-row computation. Cache results if used in loops:
->successColor(fn ($record) => cache()->remember(
"progress_bar_color_{$record->id}",
now()->addHours(1),
fn () => $record->is_priority ? '#7c3aed' : null
))
| Failure Scenario | Impact | Mitigation |
|---|---|---|
Missing total value |
Bar shows 0% (graceful) |
Validate data models; use maxValue() fallback. |
Invalid CSS in borderRadius |
Falls back to default pill shape | Sanitize inputs or use predefined values. |
| Filament 5.x major version update | Potential API breaks | Test in a staging environment; fork if needed. |
Closure errors (e.g., undefined $record) |
Silent failures or incorrect values | Add null checks or default values in closures. |
| Theme CSS conflicts | Styling inconsistencies | Scope custom CSS to the package’s classes. |
How can I help you explore Laravel packages today?