githubEdit

ElementTag

Introduction

ElementTag widget in Supervisely is a widget that allows users to display elements tagarrow-up-right in the UI.

Function signature

ElementTag(text="", type=None, hit=False, color="", widget_id=None)

Parameters

Parameters
Type
Description

text

str

ElementTag text

type

Literal["primary", "gray", "success", "warning", "danger", None]

ElementTag theme

hit

bool

Whether ElementTag has a highlighted border

color

str

Background color of the ElementTag

widget_id

str

ID of the widget

text

Determine ElementTag text.

type: str

el_tag = ElementTag(text="Tag example")

type

Determine ElementTag theme.

type: Literal["primary", "gray", "success", "warning", "danger", None]

default value: None

hit

Determine whether ElementTag has a highlighted border.

type: bool

default value: False

color

Determine background color of the ElementTag.

type: str

default value: ""

widget_id

ID of the widget

type: str

default value: None

Methods and attributes

Attributes and Methods
Description

set_text(value: str)

Set ElementTag text.

get_text()

Return ElementTag text.

set_type()

Set ElementTag type.

get_type()

Return ElementTag type.

set_hit()

Set ElementTag hit value.

get_hit()

Get hit value.

get_color()

Return ElementTag color.

set_color(value: str)

Set ElementTag color.

Mini App Example

You can find this example in our Github repository:

supervisely-ecosystem/ui-widgets-demos/text elements/008_element_tag/src/main.pyarrow-up-right

Import libraries

Init API client

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

Initialize ElementTag widgets

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.

Last updated

Was this helpful?