Input
Introduction
Input
widget in Supervisely allows to create input fields for text. It is a useful widget for applications that require users to enter text, such as project name, dataset name or path to folder or archive with data.
The Input
widget also allows you to set default text to be displayed in the input field, set text placeholder, set input field to be readonly
, and set a minimum and maximum length for the input.
Function signature
Parameters
Parameters | Type | Description |
---|---|---|
|
| Binding value |
|
| Minimum input text length |
|
| Maximum input text length |
|
| Placeholder of input |
|
| Size of input |
|
| Same as readonly in native input |
|
| Same as type in native input |
|
| Set an icon to indicate input type |
|
| ID of the widget |
value
Binding value.
type: str
default value: ""
minlength
Minimum input text length.
type: int
default value: 0
maxlength
Maximum input text length.
type: int
default value: 1000
placeholder
Placeholder of input.
type: str
default value: ""
size
Size of input.
type: Literal["mini", "small", "large", None]
default value: None
readonly
Same as readonly in native input.
type: bool
default value: false
type
Same as type in native input.
type: Literal["text", "password"]
default value: None
icon
Set an icon to indicate input type. Set to None
to disable icon.
type: Literal["search", "edit"]
default value: None
widget_id
ID of the widget.
type: str
default value: None
Methods and attributes
Attributes and Methods | Description |
---|---|
| Return |
| Set input value. |
| Get input value. |
| Enable input`s readonly property. |
| Disable input`s readonly property. |
| Set icon type: "edit" or "search". |
| Decorator functions is handled when input value is changed. |
Mini App Example
You can find this example in our Github repository:
ui-widgets-demos/input/001_input/src/main.py
Import libraries
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Initialize Input
widget
Input
widgetCreate buttons to control Input
widget values.
Input
widget values.Create app layout
Prepare a layout for app using Card
widget with the content
parameter and place widget that we've just created in the Container
widget.
Create app using layout
Create an app object with layout parameter.
Add functions to control widget from python code
Last updated