Skip to content

Refactor SVG handling for loading indicator#19435

Open
Shaharyar-WebDev wants to merge 1 commit intofilamentphp:4.xfrom
Shaharyar-WebDev:patch-1
Open

Refactor SVG handling for loading indicator#19435
Shaharyar-WebDev wants to merge 1 commit intofilamentphp:4.xfrom
Shaharyar-WebDev:patch-1

Conversation

@Shaharyar-WebDev
Copy link

@Shaharyar-WebDev Shaharyar-WebDev commented Mar 5, 2026

Refactor loading indicator SVG handling to use a custom SVG if configured, otherwise use default SVG.

Description

Refactored generate_loading_indicator_html() to support a custom SVG
loading indicator via the filament.loading_indicator_svg config key.

Previously, the SVG was hardcoded inline. Now the function:

  1. Builds the default SVG as before (no behaviour change if config is unset)
  2. Checks config('filament.loading_indicator_svg') for a custom SVG string
  3. If found, replaces the __attributes__ placeholder with the resolved
    ComponentAttributeBag attributes (classes, wire:loading, etc.) and
    returns that instead

This keeps full backwards compatibility — existing apps with no config
value set will see zero change in behaviour or appearance.

Visual changes

If a user sets loading_indicator_svg in
their filament.php config, their chosen SVG will render in place of
the default spinner.
See Visuals

Functional changes

  • [] Code style has been fixed by running the composer cs command.
  • [] Changes have been tested to not break existing functionality.
  • [] Documentation is up-to-date.

Refactor loading indicator SVG handling to use a custom SVG if configured otherwise use default SVG.

Signed-off-by: Shaharyar Ahmed <shery.codes@gmail.com>
Copy link
Member

@danharrin danharrin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that a config file is suitable for this sort of change to be honest. How about we ask the user to bind an Htmlable object to the container via a specific interface from Filament, that receives the attributes object in the constructor?

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Roadmap Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request pending changes

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants