-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathplacement.py
40 lines (36 loc) · 1009 Bytes
/
placement.py
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
30
31
32
33
34
35
36
37
38
39
40
import dash_mantine_components as dmc
from dash import html, Output, Input, State, callback
data = [
["Left (Default)", "left"],
["Top", "top"],
["Right", "right"],
["Bottom", "bottom"],
]
component = html.Div(
[
dmc.Drawer(
id="drawer-position",
),
dmc.Group(
align="center",
gap="xl",
children=[
dmc.RadioGroup(
dmc.Group([dmc.Radio(label, value=value) for label, value in data]),
id="drawer-position-radio",
value="left",
),
dmc.Button("Open Drawer", id="drawer-position-button"),
],
),
]
)
@callback(
Output("drawer-position", "opened"),
Output("drawer-position", "position"),
Input("drawer-position-button", "n_clicks"),
State("drawer-position-radio", "value"),
prevent_initial_call=True,
)
def toggle_drawer(n_clicks, position):
return True, position