express.ui.update_numeric
express.ui.update_numeric(id
*
=None
label=None
valuemin=None
max=None
=None
step=None
session )
Change the value of a number input on the client.
Parameters
id : str
-
An input id.
label : Optional[str] = None
-
An input label.
value : Optional[float] = None
-
A new value.
min : Optional[float] = None
-
The minimum allowed value.
max : Optional[float] = None
-
The maximum allowed value.
step : Optional[float] = None
-
Interval to use when stepping between min and max.
session : Optional[
Session
] = None
Note
The input updater functions send a message to the client, telling it to change the settings of an input object. The messages are collected and sent after all the observers (including outputs) have finished running.
The syntax of these functions is similar to the functions that created the inputs in the first place. For example, input_numeric and update_numeric take a similar set of arguments.
Any arguments with None
values will be ignored; they will not result in any changes to the input object on the client.
For update_radio_buttons, update_checkbox_group, and update_select, the set of choices can be cleared by using choices=[]
. Similarly, for these inputs, the selected item can be cleared by using selected=[]
.
See Also
Examples
#| standalone: true
#| components: [editor, viewer]
#| layout: vertical
#| viewerHeight: 400
## file: app.py
from shiny import reactive
from shiny.express import input, ui
ui.input_slider("controller", "Controller", min=0, max=20, value=10)
ui.input_numeric("inNumber", "Input number", 0)
ui.input_numeric("inNumber2", "Input number 2", 0)
@reactive.effect
def _():
x = input.controller()
ui.update_numeric("inNumber", value=x)
ui.update_numeric(
"inNumber2",
label="Number label " + str(x),
value=x,
min=x - 10,
max=x + 10,
step=5,
)