Update: version 1.16 has been released since this was posted.
Dash 1.7.0 is a minor release adding support for inline clientside callbacks, improving dcc’s Slider and RangeSlider styling and behavior, and fixing some additional bugs for async components.
Changelog
Dash v.1.7.0
Highlights
- Update to Plotly.js 1.51.2
- Additional async component fixes
- Improved dcc.Slider and dcc.RangeSlider styling
- Community contribution New inline clientside callbacks
Previous Releases
In Depth
Inline Clientside Callbacks
import dash
import dash_html_components as html
import dash_core_components as dcc
from dash.dependencies import ClientsideFunction, Input, Output
app = dash.Dash(__name__)
app.layout = html.Div([
dcc.Input(id='input'),
html.Div(id='output-clientside'),
html.Div(id='output-serverside')
])
@app.callback(
Output('output-serverside', 'children'),
[Input('input', 'value')])
def update_output(value):
return 'Server says "{}"'.format(value)
app.clientside_callback(
# ClientsideFunction(
# namespace='clientside',
# function_name='display'
# ),
"""
function (value) {
if (value && value.indexOf('--') === 0) {
throw window.dash_clientside.PreventUpdate;
}
if (value && value.indexOf('__') === 0) {
return window.dash_clientside.no_update;
}
return 'Client says "' + value + '"';
}
""",
Output('output-clientside', 'children'),
[Input('input', 'value')]
)
if __name__ == "__main__":
app.run_server(port=8070)