Code Monkey home page Code Monkey logo

Comments (2)

marcstern14 avatar marcstern14 commented on June 11, 2024 1

Thanks @tcbegley! I did a lot of googling, not sure how I didn't find that thread, but I appreciate your response. This solution works great for me!

from dash-bootstrap-components.

tcbegley avatar tcbegley commented on June 11, 2024

Hi @marcstern14

Check out this topic on the Plotly Forums.

The "Loading..." appears while the javascript bundles are being fetch and Dash is starting up, so the correct solution is to use some CSS that will be applied on initial page load. Updated and Bootstrap specific example below.

import time

import dash_bootstrap_components as dbc
from dash import Dash


def slow_serve_layout():
    # this is just to slow down the initial load to make the spinner clear
    time.sleep(5)
    return dbc.Container(
        dbc.Alert("Hello, world!", color="success"), className="p-5"
    )


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

if __name__ == "__main__":
    app.run_server(debug=True)
._dash-loading {
  margin: auto;
  color: transparent;
  width: 2rem;
  height: 2rem;
  text-align: center;
}

._dash-loading::after {
  content: '';
  display: inline-block;
  width: 2rem;
  height: 2rem;
  color: var(--bs-secondary);
  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;
}

from dash-bootstrap-components.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.