ui.input_numeric
ui.input_numeric(id,
label,
value,*,
min=None,
max=None,
=None,
step=None,
width='change',
update_on )
Create an input control for entry of numeric values.
Parameters
id : str
-
An input id.
label : TagChild
-
An input label.
value : float
-
Initial 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.
width : Optional[str] = None
-
The CSS width, e.g. ‘400px’, or ‘100%’
update_on : Literal[‘change’, ‘blur’] = 'change'
-
When should the input value be updated? Options are
"change"
(default) and"blur"
. Use"change"
to update the input immediately whenever the value changes. Use"blur"
to delay the input update until the input loses focus (the user moves away from the input), or when Enter is pressed.
Returns
: Tag
-
A UI element.
Notes
Server value
A numeric value.
See Also
Examples
#| standalone: true
#| components: [editor, viewer]
#| layout: vertical
#| viewerHeight: 400
## file: app.py
from shiny import App, Inputs, Outputs, Session, render, ui
app_ui = ui.page_fluid(
ui.input_numeric("obs", "Observations:", 10, min=1, max=100),
ui.output_text_verbatim("value"),
)
def server(input: Inputs, output: Outputs, session: Session):
@render.text
def value():
return input.obs()
app = App(app_ui, server)