shiny.ui.input_numeric#

shiny.ui.input_numeric(id, label, value, *, min=None, max=None, step=None, width=None)#

Create an input control for entry of numeric values.

Parameters
  • id (str) – An input id.

  • label (Union[Tagifiable, Tag, MetadataNode, str, TagList, float, None, Dict[str, Union[str, float, bool, None]], Sequence[Union[Tagifiable, Tag, MetadataNode, str, TagList, float, None, Dict[str, Union[str, float, bool, None]], Sequence[ForwardRef]]]]) – An input label.

  • value (float) – Initial value.

  • min (Optional[float]) – The minimum allowed value.

  • max (Optional[float]) – The maximum allowed value.

  • step (Optional[float]) – Interval to use when stepping between min and max.

  • width (Optional[str]) – The CSS width, e.g. ‘400px’, or ‘100%’

Return type

A UI element.

Notes

Server value

A numeric value.

See also

update_numeric

Example

#| standalone: true
#| components: [editor, viewer]
#| layout: vertical
#| viewerHeight: 400
from shiny import *

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):
    @output
    @render.text
    def value():
        return input.obs()


app = App(app_ui, server)