Skip to main content

input

Input

from dara.components.common.input import Input

class Input(FormComponent)

Input

The input component accepts a value, which should be a Variable instance and will allow the user to enter free text into the field.

An Input component is created via:

from dara.core import Variable
from dara.components.common import Input

value_var = Variable('initial input value')

Input(value=value_var)

You could define a numerical input with the following:

from dara.core import Variable
from dara.components.common import Input

value_var = Variable(0)

Input(value=value_var, type='number')

Arguments:

  • value: A Variable instance recording the component's state
  • onchange: Action triggered when the input value has changed.
  • type: The type of the input, can be any of the accepted by HTML input types, e.g. number, text
  • placeholder: Placeholder text to be displayed when the input is empty
  • id: the key to be used if this component is within a form

Attributes

  • id: Optional[str]
  • placeholder: Optional[str]
  • type: Optional[str]
  • onchange: Optional[Action]
  • value: Optional[Variable]