Skip to content

Conversation

tcbegley
Copy link
Collaborator

This PR adds dcc.Loading style functionality to Spinner, i.e. the spinner will be rendered while the children of the Spinner are loading.

Here's a simple example of usage:

import time

import dash
import dash_bootstrap_components as dbc
import dash_html_components as html
from dash.dependencies import Input, Output

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

app.layout = html.Div(
    [
        dbc.Button("load", id="button"),
        dbc.Spinner(html.Div(id="output"), color="primary"),
    ]
)


@app.callback(Output("output", "children"), [Input("button", "n_clicks")])
def load_content(n):
    time.sleep(3)
    return "Loaded!"


if __name__ == "__main__":
    app.run_server(debug=True)

@tcbegley tcbegley merged commit 85aa909 into master Feb 18, 2020
@tcbegley tcbegley deleted the loading-spinner branch February 18, 2020 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant