Skip to content

Loading Spinner#314

Merged
tcbegley merged 5 commits intomasterfrom
loading-spinner
Feb 18, 2020
Merged

Loading Spinner#314
tcbegley merged 5 commits intomasterfrom
loading-spinner

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

1 participant