customize spinner

hello there,

i have 2 questions:

1- how can i customize the spinner with the html/css code below:

<style>

        *,

        *::after,

        *::before {

            padding: 0;

            margin: 0;

        }

        .main {

            top: 50%;

            left: 50%;

            transform: translate(-50%, -50%);

            position: absolute;

            transition: all 1s;

        }

        .loader {

            border-radius: 50%;

            border: 1px solid #D4AF37;

            position: relative;

        }

        .loader__inner {

            width: 4rem;

            height: 4rem;

            animation: spin 1s infinite linear;

        }

            .loader__inner::after {

                content: "";

                position: absolute;

                top: -1px;

                left: 0;

                width: 4rem;

                height: 4rem;

                border-radius: 50%;

                border-bottom: 6px solid #D4AF37;

            }

        .loader__outer {

            position: absolute;

            top: -30px;

            left: -32px;

            width: 8rem;

            height: 8rem;

            animation: spin 1s infinite linear reverse;

        }

            .loader__outer::after {

                content: "";

                position: absolute;

                top: -1px;

                left: 0;

                width: 8rem;

                height: 8rem;

                border-radius: 50%;

                border-bottom: 6px solid #D4AF37;

            }

        @keyframes spin {

            0% {

                transform: rotate(0deg);

            }

            100% {

                transform: rotate(360deg);

            }

        }

    </style>

-------HTML---

        <div class="main">

            <img src="images/logo/harmonelogo.png" class="img-fluid" alt="Responsive image" />

            <div class="loader loader__inner">

            </div>

            <div class="loader loader__outer">

            </div>

        </div>


#2- how can i change the opacity of the spinner background.




5 Replies

BS Buvana Sathasivam Syncfusion Team June 24, 2022 03:45 AM UTC

Hi Afshin,


Greetings from Syncfusion support.


Query #1: “how can i customize the spinner with the html/css code below”


You will be able to add the custom class name to the SfSpinner component using the CssClass property. Please find the below documentation link for your reference.

Documentation: https://blazor.syncfusion.com/documentation/spinner/customization#customize-when-initializing-the-spinner-component


Please check the above documentation page and let us know if you faced any issues.


Query #2: “how can i change the opacity of the spinner background.”


You will be able to change the spinner background opacity using the below styles.

 

<style>

    .e-spinner-pane.e-spin-overlay {

        background-color: rgba(0,0,0,.3);

    }

</style>


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/NEA67D~1-900042620


Regards,

Buvana S



AF Afshin June 24, 2022 04:22 AM UTC

thanks for the reply , my first question is that if i can replace the default spinning to the html i have provided in my question html/css i have produces the attached image
Capture.JPG



BS Buvana Sathasivam Syncfusion Team June 27, 2022 04:00 PM UTC

Hi Afshin,


You can render HTML and CSS with the SfSpinner component using SpinnerTemplates. In the below sample, we have created an SfSpinner component with your shared html and CSS code.

   <div class="main">

 

            <img src=https://ej2.syncfusion.com/demos/src/card/images/Tile_4.png class="img-fluid" alt="Responsive image" />

      

        <div>

            <SfSpinner @bind-Visible="VisiblePro">

                <SpinnerTemplates>

                    <Template>

                       <div class="loader loader__inner">

 

            </div>

                    </Template>

                </SpinnerTemplates>

            </SfSpinner>

        </div>

        <div>

            <SfSpinner @bind-Visible="VisiblePro">

                <SpinnerTemplates>

                    <Template>

                     <div class="loader loader__outer">

 

            </div>

                    </Template>

                </SpinnerTemplates>

            </SfSpinner>

        </div>

         </div>


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/NEC29D~1-592395620


API link: https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Spinner.SpinnerTemplates.html


Please let us know if you have any concerns.


Regards,

Buvana S



AF Afshin June 27, 2022 04:44 PM UTC

thank you so much, that was exactly what i was looking for however i changed my code as follow in case anyone else would be interested 

                <SfSpinner @bind-Visible="@SpinnerVisible" CssClass="e-spin-overlay" ZIndex="5555555" Size="100">

                    <SpinnerTemplates>

                        <Template>

                            <div class="main">

                                <img src="images/logo/harmonelogo.png" class="img-fluid" alt="Responsive image" />

                                <div class="loader loader__inner">

                                </div>

                                <div class="loader loader__outer">

                                </div>

                            </div>

                        </Template>

                    </SpinnerTemplates>

                </SfSpinner>



BS Buvana Sathasivam Syncfusion Team June 28, 2022 11:45 AM UTC

Hi Afshin,


Thank you for your update. Please let us know if you need any further assistance.


Regards,

Buvana S


Loader.
Up arrow icon