Recipes for Plotly Dash

dash_ctx[source]

dash_ctx(inputs)

Provide a ctx dict to use in the dash callback system.

For example:

import dash
from dash.dependencies import Input, Output, State

app = dash.Dash('app')

outputs = [Output('main-div', 'children')]
inputs = [Input('selector1', 'value'), Input('selector2', 'value')]
states = [State('selector3', 'value')]

@app.callback(outputs, inputs, states)
@dash_ctx(inputs + states)
def update(**ctx):
    pass
    # do something with ctx['selector1'], ctx['selector2'], ctx['selector3']

idify[source]

idify(name)

Helper function to convert human labels to HTML ids

Component libraries

  • Dash Core Components comes with Dash
  • Dash Bootstrap Components provides Bootstrap compatible components which are easier to work with if you are familiar with Bootstrap
  • Dash Custom Components are recipes built on top of DCC and DBC for convenience