-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathusage.py
More file actions
29 lines (24 loc) · 745 Bytes
/
usage.py
File metadata and controls
29 lines (24 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import dash_breakpoints
from dash import Dash, html, clientside_callback, Input, Output, State
app = Dash(__name__)
app.layout = html.Div(
[
html.Div(id="display"),
dash_breakpoints.WindowBreakpoints(
id="breakpoints",
widthBreakpointThresholdsPx=[800, 1200],
widthBreakpointNames=["sm", "md", "lg"],
),
]
)
clientside_callback(
"""(wBreakpoint, w) => {
console.log("Only updating when crossing the threshold")
return `Breakpoint name: ${wBreakpoint}, width: ${w}px`
}""",
Output("display", "children"),
Input("breakpoints", "widthBreakpoint"),
State("breakpoints", "width"),
)
if __name__ == '__main__':
app.run_server(debug=True)