ui.input_numeric

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 : 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%’

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)