Whenever i try to load a page from dash application, I see "Loading..." before the content is displayed. Please suggest me a way to remove that text and replace it with css spinner

I used the following simple code in dashapp.py file:

from logging import debug
from dash import Dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html 
from dash.dependencies import Input, Output, State
from config import appserver
import time

external_stylesheets = [dbc.themes.YETI,'./frontend/static/stylesheet.css']

dashapp = Dash(__name__, server = appserver,external_stylesheets=external_stylesheets, url_base_pathname='/application/', title='Home Page', assets_url_path='assets')

dashapp.css.config.serve_locally = True

dashapp.layout = html.Div([
    html.H1('Hi Welcome to Dash-Flask integration app!'),
], id="child-process")

if __name__=='__main__':

I used the following CSS in stylesheet.css file:

  visibility: hidden;
  content: "Loading...";
  display: inline-block;
  color: magenta;
  visibility: visible;

Anyone provide me answer pls

Hi prasad_ppn,
I think you must use dcc.Loading Component instead of CSS.

Using the fullscreen=True otion if you want to show it in a full screen.
And the type option you want.

Tried even with dcc.loading, still the same Loading… Text at start of each page in browser

See the section called: Customizing or Removing Dash’s “Updating…” Message https://dash.plotly.com/external-resources

Problem is not with updating… text in title bar… problem is with loading… Text in browser window everytime i load the page

You can customise it with some CSS. Here’s an example that replaces it with a Bootstrap spinner

├── app.py
└── assets
    └── style.css
# app.py
import time

import dash
import dash_bootstrap_components as dbc

def serve_layout():
    # add delay to initial layout load so we can see the spinner
    return dbc.Container(dbc.Alert("Testing"), className="p-5")

app = dash.Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])

app.layout = serve_layout

if __name__ == "__main__":

/* assets/style.css */
._dash-loading {
  margin: auto;
  color: transparent;
  width: 0;
  height: 0;
  text-align: center;

._dash-loading::after {
  content: '';
  display: inline-block;
  width: 2rem;
  height: 2rem;
  color: black;
  vertical-align: text-bottom;
  border: 0.25em solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  -webkit-animation: spinner-border 0.75s linear infinite;
  animation: spinner-border 0.75s linear infinite;
  margin-top: 2rem;

Worked like a charm!! Thank you so much for the help. Keeping only CSS file worked for me!!

1 Like