Field
Introduction
Field
widget within Supervisely is a type of form which has the ability to contain various other widgets. This feature enables users to organize multiple widgets within a layout. Additionally, users have the option to customize the widget by setting a title
, icon
, title_url
and description
.
Function signature
Field(
content=Empty(),
title="Field",
description=None,
title_url=None,
description_url=None,
icon=None,
widget_id=None,
)

Parameters
content
Widget
Widget to display on Field
title
str
Determines Field
title
description
str
Determines Field
description
title_url
str
Determines url used on Field
title
description_url
str
Determines url used on Field
description
icon
Field.Icon
Determines Field
icon
widget_id
str
ID of the widget
content
Determine Widget
to display on Field
.
type: Widget
field = Field(
content=Button(text="Button"),
title="Field with button",
)

title
Determines Field
title.
type: str
field = Field(
content=Empty(),
title="Field title",
)

description
Determines Field
description.
type: str
default value: None
field = Field(
content=Empty(),
title="Field title",
description="Field description",
)

title_url
Determines url used on Field
title.
type: str
default value: None
field = Field(
content=Empty(),
title="Field title",
title_url="https://i.imgur.com/0E8d8bB.png",
)

description_url
Determines url used on Field
description.
type: str
default value: None
field = Field(
content=Empty(),
title="Field title",
description="Field description",
description_url="https://i.imgur.com/0E8d8bB.png",
)

icon
Determines Field
icon. Icons can be found at zavoloklom.github.io.
type: Field.Icon
default value: None
icon = Field.Icon(image_url="https://i.imgur.com/0E8d8bB.png")
field = Field(content=Empty(), title="Field title", icon=icon)

widget_id
ID of the widget.
type: str
default value: None
Mini App Example
You can find this example in our Github repository:
ui-widgets-demos/layouts and containers/004_field/src/main.py
Import libraries
import supervisely as sly
from dotenv import load_dotenv
from supervisely.app.widgets import Card, Empty, Field
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
load_dotenv("local.env")
load_dotenv(os.path.expanduser("~/supervisely.env"))
api = sly.Api()
Initialize Field
widget
Field
widgetfield = Field(content=Empty(), title="Field", description="Field description")
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.
card = Card(title="Card", description="Card Description", content=field)
layout = Container(widgets=[card])
Create app using layout
Create an app object with layout parameter.
app = sly.Application(layout=layout)

Last updated
Was this helpful?