Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading Spinner #314

Merged
merged 5 commits into from
Feb 18, 2020
Merged

Loading Spinner #314

merged 5 commits into from
Feb 18, 2020

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
Development

Successfully merging this pull request may close these issues.

1 participant