# Lighter Loading Spinner for Gravity Forms

> Replaces the Gravity Forms AJAX loading spinner with a small inline SVG spinner in your brand color, with no extra file to download.

- Type: PHP
- Runs: Run everywhere
- Category: [Forms](https://wpide.com/library/category/forms/)
- Tags: gravity-forms, ajax, styling
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/gf-custom-spinner/

## Code

```php
$wpide_gf_spinner_color = '#2563eb';

add_filter( 'gform_ajax_spinner_url', function () use ( $wpide_gf_spinner_color ) {
    $svg = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9" fill="none" stroke="' . esc_attr( $wpide_gf_spinner_color ) . '" stroke-width="3" stroke-dasharray="42 15" stroke-linecap="round"><animateTransform attributeName="transform" type="rotate" from="0 12 12" to="360 12 12" dur="0.8s" repeatCount="indefinite"/></circle></svg>';

    return 'data:image/svg+xml;base64,' . base64_encode( $svg );
} );
```

## Notes

Change the color at the top; the spinner is embedded as a data URI.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Lighter Loading Spinner for Gravity Forms" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
