An example of a default Joystick without any extra properties.
from dash import Dash, html, Input, Output, callback
import dash_daq as daq
app = Dash()
app.layout = html.Div([
daq.Joystick(
id='my-joystick-1',
label="Default",
angle=0
),
html.Div(id='joystick-output-1')
])
@callback(
Output('joystick-output-1', 'children'),
Input('my-joystick-1', 'angle'),
Input('my-joystick-1', 'force')
)
def update_output(angle, force):
return [f'Angle is {angle}', html.Br(), f'Force is {force}']
if __name__ == '__main__':
app.run(debug=True)
Change the label and label orientation with label
and labelPosition
.
import dash_daq as daq
daq.Joystick(
label="Label",
labelPosition="bottom"
)
Change the size of the joystick with size
.
import dash_daq as daq
daq.Joystick(
size=250
)
Access this documentation in your Python terminal with:
```pythonhelp(dash_daq.Joystick)
```
Our recommended IDE for writing Dash apps is Dash Enterprise’s
Data Science Workspaces,
which has typeahead support for Dash Component Properties.
Find out if your company is using
Dash Enterprise.
id
(string; optional):
The ID used to identify the color picker in Dash callbacks.
disabled
(boolean; optional):
If True, color cannot be picked.
angle
(number; optional):
Joystick angle in degrees, 0 = right, 90 = up, 180 = left, 270 = down.
force
(number; optional):
Joystick force: distance between cursor and center in big-circle radii.
size
(number; default 100
):
Size (width) of the component in pixels.
theme
(dict; default light
):
Theme configuration to be set by a ThemeProvider.
label
(dict; optional):
Description to be displayed alongside the control. To control styling,
pass an object with label and style properties.
label
is a string | dict with keys:
label
(string; optional)
style
(dict; optional)
labelPosition
(a value equal to: ‘top’ or ‘bottom’; default 'top'
):
Where the indicator label is positioned.
className
(string; optional):
Class to apply to the root component element.
style
(dict; optional):
Style to apply to the root component element.