Numeric Input Examples and Reference


Default Numeric Input

An example of a default numeric input without any extra properties.

import dash
import dash_daq as daq
import dash_html_components as html

external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']

app = dash.Dash(__name__, external_stylesheets=external_stylesheets)

app.layout = html.Div([
    daq.NumericInput(
        id='my-numeric-input',
        value=0
    ),
    html.Div(id='numeric-input-output')
])


@app.callback(
    dash.dependencies.Output('numeric-input-output', 'children'),
    [dash.dependencies.Input('my-numeric-input', 'value')])
def update_output(value):
    return 'The value is {}.'.format(value)


if __name__ == '__main__':
    app.run_server(debug=True)

Label

Set the label and label position with label and labelPosition.

import dash_daq as daq

daq.NumericInput(
    label='Label',
    labelPosition='bottom',
    value=10,
)  

Size

Extend the size with size.

import dash_daq as daq

daq.NumericInput(
    value=10,
    size=120
)  

Max and Min

Set the minimum and maximum bounds with min and max.

import dash_daq as daq

daq.NumericInput(
    min=0,
    max=100,
    value=20
)  

Disable

Disable the numeric input by setting disabled=True.

import dash_daq as daq

daq.NumericInput(
    disabled=True,
    min=0,
    max=10,
    value=2
)  


Numeric Input Properties

Access this documentation in your Python terminal with:
```python

help(dash_daq.NumericInput)
```

id (string; optional): The ID used to identify this compnent in Dash callbacks

className (string; optional): Class to apply to the root component element.

disabled (boolean; optional): If true, numeric input cannot changed.

label (dict; optional): Description to be displayed alongside the control. To control styling, pass an object with label and style properties. label has the following type: string | dict containing keys ‘style’, ‘label’. Those keys have the following types:

  • style (dict; optional)
  • label (string; optional)

labelPosition (a value equal to: ‘top’, ‘bottom’; default 'top'): Where the numeric input label is positioned.

min (number; default 0): The minimum value of the numeric input

max (number; default 10): The maximum value of the numeric input

persistence (boolean | string | number; optional): Used to allow user interactions in this component to be persisted when the component - or the page - is refreshed. If persisted is truthy and hasn’t changed from its previous value, a value that the user has changed while using the app will keep that change, as long as the new value also matches what was given originally. Used in conjunction with persistence_type.

persisted_props (list of a value equal to: ‘value’s; default ['value']): Properties whose user interactions will persist after refreshing the component or the page. Since only value is allowed this prop can normally be ignored.

persistence_type (a value equal to: ‘local’, ‘session’, ‘memory’; default 'local'): Where persisted user changes will be stored: memory: only kept in memory, reset on page refresh. local: window.localStorage, data is kept after the browser quit. session: window.sessionStorage, data is cleared once the browser quit.

size (number; optional): The size (length) of the numeric input in pixels

style (dict; optional): Style to apply to the root component element.

theme (dict; default light): Theme configuration to be set by a ThemeProvider

value (number; optional): The value of numeric input