TextArea

Introduction

TextArea widget in Supervisely is a widget that allows users to enter and edit multiple lines of text. The widget provides a large text input area that can be customized with various options, such as placeholder text, autosize or read-only properties, and default value. TextArea widget is often used for collecting longer form input from users, such as descriptions or comments.

Function signature

TextArea(
    value=None,
    placeholder="Please input",
    rows=2,
    autosize=True,
    readonly=False,
    widget_id=None,
)

Parameters

Parameters
Type
Description

value

str

Widgets text value

placeholder

str

Specifies a short hint that describes the expected value of a text area

rows

int

Specifies the visible number of lines in a text area

autosize

bool

Specifies that a text area should automatically get focus

readonly

bool

Specifies that a text area should be read-only

widget_id

str

ID of the widget

value

Widgets text value

type: str

default value: None

placeholder

Specifies a short hint that describes the expected value of a text area.

type: str

default value: "Please input"

rows

Specifies the visible number of lines in a text area.

type: int

default value: 2

autosize

Specifies that a text area should automatically get focus.

type: bool

default value: True

readonly

Specifies that a text area should be read-only.

type: bool

default value: false

widget_id

ID of the widget.

type: str

default value: None

Methods and attributes

Attributes and Methods
Description

set_value(value: str)

Set value data.

get_value()

Returns input value data.

is_readonly()

Check TextArea is readonly or not.

enable_readonly()

Set readonly == True.

disable_readonly()

Set readonly == False.

Mini App Example

You can find this example in our Github repository:

ui-widgets-demos/text elements/002_textarea/src/main.py

Import libraries

Init API client

First, we load environment variables with credentials and init API for communicating with Supervisely Instance:

Initialize Button widgets we will use

Initialize TextArea widget

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 widgets from python code

Last updated

Was this helpful?