Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Filament Toggle Icon Column Laravel Package

asignua/filament-toggle-icon-column

A Filament table column that renders a boolean value as a clickable icon, letting you toggle the state inline straight from the table row. Drop it into any Filament resource to replace clunky switches with a compact, customizable icon toggle with configurable colors.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Install with composer require and, if the package registers a Filament plugin, add it to your panel provider's ->plugins([...]) array; otherwise just reference the column class in a table.
  • Run php artisan filament:assets immediately after installing or updating. As of v1.0.1 the colour support ships as a small stylesheet; without republishing, onColor(), offColor() and hoverColor() are silently inert and every icon renders grey.
  • First use case: an inline boolean toggle on a resource table, e.g. ToggleIconColumn::make('is_active')->onColor('success')->offColor('gray'), so an admin can flip a flag without opening an edit modal.
  • Look first at the workbench demo added in this release (screenshots and cover are in the docs) — it shows the rendered markup and dark-mode behaviour faster than reading the source. Then read the column class for the fluent API surface.
  • Verify the install by toggling a record in light and dark mode; the tooltip should read "On. Click to turn off." / "Off. Click to turn on." in your panel's locale.

Implementation Patterns

  • Status-flag tables. Use the toggle column for is_active, is_featured, is_visible-style flags, and keep a plain IconColumn or badge TextColumn on read-only relation managers so non-editing contexts stay cheap.
  • Gate the interaction, not just the render. Pair the column with ->disabled(fn ($record) => ! auth()->user()->can('update', $record)) (or hide it) — the column issues a Livewire round-trip and Laravel policy checks still run server-side, but a disabled icon is clearer UX than a 403 flash.
  • Semantic colours only. success, danger, warning, info, gray map onto Filament's --text / --dark-text CSS variables. Hardcoded hex values or your own .fi-icon rules will fight the shipped stylesheet and usually lose.
  • Deploy pipeline. Add php artisan filament:assets (plus view:clear) to your release script and CI, right after composer install. This is the single operational change v1.0.1 introduces — treat it like filament:upgrade and forget it at your peril.
  • Theming. If the panel uses a custom Vite theme, confirm the plugin's CSS is still loaded in that theme's build; filament:assets publishes package assets but does not compile them into your resources/css/filament/* bundle.
  • Translations. Tooltips are shipped per-language. For a locale the package doesn't cover, publish the translations and add the two keys rather than overriding tooltips inline, so future wording fixes flow through.
  • Testing. Cover the toggle with a Livewire table test that calls the column action and asserts the model attribute flipped plus the policy-blocked case stays unchanged.

Gotchas and Tips

  • Grey icons after upgrade are almost always stale assets. Run php artisan filament:assets, php artisan view:clear, then hard-refresh the browser. Filament's own CSS only paints .fi-ta-icon > .fi-icon.fi-color; the plugin's markup isn't matched by it, which is exactly the bug v1.0.1 fixes.
  • Pin ^1.0.1. On v1.0.0 the colour methods are effectively a no-op — if your UI uses colour to encode state, 1.0.0 is a silent accessibility regression, not just a cosmetic one.
  • Dark mode is inherited, not configured. Colours follow whatever --text / --dark-text resolve to. If you have overridden those variables globally for contrast reasons, your toggle icons change with them; don't patch the plugin stylesheet, adjust the variables.
  • No optimistic UI. The icon updates after the Livewire response. On high-latency connections users may double-click; consider disabling the column on slow-reporting tables or adding a loading indicator via Filament's table config.
  • Debugging rendering. Inspect the DOM: the <svg> should carry both fi-icon and fi-color, with a text-custom-*/text-{color}-* class from the plugin's CSS variables. If fi-color is absent, the colour argument isn't reaching the column — check the make() name and the record's attribute cast (boolean, not "1"/"0" string comparisons).
  • Extension point: the stylesheet is deliberately tiny and variable-driven, so wrapping it in @layer or overriding via Filament's ->colors() panel config is safe; rewriting the selectors is not.
  • No breaking changes in 1.0.1 — it's a patch. The only action item is the asset publish step, but skipping it means the headline fix never lands.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings