Rectangle
Use this component as a background for other components or to create custom visual patterns. This topic describes how to configure the component.
Use cases
-
Create display-only patterns.

-
Serve as a background for numbers or text.

Step 1: Add the component
-
Create a web application. For more information, see Create a web application.
-
In the web application editor, click the component icon
on the far left. -
In the search box above the component list, enter Rectangle. Then, drag the component onto the canvas.
For more information about adding components, see Add a component.
Step 2: Configure styles
-
In the Style panel on the right, set the corner radius, fill color, and border style.
Many settings in the Style panel support dynamic data sources, including device, API, and application push. However, the border color setting only supports API and application push data sources.
Each parameter requires a specific data format. The data returned by your data source must match the required format.
Parameter
Data format
Component Visibility
A
booleanorenumtype. Set the corresponding values for Visible and Invisible.If the data source is a device, you can only select a property from the thing model. Supported data formats are
float,double,integer,boolean, andenum. In this case, you can configure whether the component is visible when the device is offline. If the data source returns a numerical data type, you must use Convert Integer to Boolean or Convert Number to Enum to configure the visibility.NoteIn a Repeat List, to configure component visibility based on a thing model property (including the offline state), the component's data source must be a device. The configuration is as follows:
If the data source of the Repeat List is a device, the data source for component visibility can be set to parent component data source or device.
If the data source of the Repeat List is a non-device type, the data source for component visibility must be device.
Fill Color
A
booleanorenumtype.If the data source is a device, you can only select a property from the thing model. Supported data formats are
float,double,integer,boolean, andenum. In this case, you can configure the display color of the component's content when the device is offline. If the data source returns a numerical type, you must use Convert Integer to Boolean or Convert Number to Enum to set the colors for different values.NoteIn a Repeat List, to configure the color based on a thing model property (including the offline state), the component's data source must be a device. The configuration is as follows:
If the data source of the Repeat List is a device, the data source for the component's color can be set to parent component data source or device.
If the data source of the Repeat List is a non-device type, the data source for the component's color must be device.
Border Width
An integer from 0 to 1000.
Border Color
A JSON object for an RGB color.
NoteThe a parameter is optional and represents the color's opacity, ranging from 0 to 100.
{ "r": 255, "g": 255, "b": 255, "a":0 }Border Style
An integer from 0 to 2.The values map to the line styles as follows (in the same order as the dropdown list):
- 0: Solid line
- 1: Dashed line
- 2: Dotted line
-
Adjust the component's position on the page. For more information about general component style settings, see Configure styles.
Step 3: Configure interactions
Select the component's Interaction tab to configure events and actions. For more information, see Configure interactions.
For example, you can configure the component to trigger the open link action on click. This action allows you to specify how a link opens and what it displays.
-
Click Preview in the upper-right corner of the page to view and debug the component's data and style.