Text

Updated at:
Copy as MD

The Text component displays specified text. This article describes how to configure the Text component.

Step 1: Add the component

  1. Create a mobile application. For more information, see Create a mobile application.

  2. In the mobile application editor, click the Components icon 组件 on the far left.

  3. (Optional) Add a column component to set the page layout. For more information, see Horizontal columns and vertical columns.

  4. Above the component list to the left of the canvas, enter Text in the search box and drag the component onto the canvas.

    For more information about adding components, see Add a component. After you drag the component onto the canvas, select the Text component. In the Style panel on the right, you can configure its basic settings, including text content, text level, font size, font, text color, line height, font weight, and alignment.

Step 2: Configure the data source

In the Style panel on the right side of the mobile application editor, configure the Text component's content.

  • Static data

    Enter content in the input box for Text, or double-click the Text component on the canvas.

    This content appears statically on the page.

  • Dynamic data

    Click the configure data source icon 配置数据源 next to the text input box. Then, select a data source type, complete the configuration, and click OK.

    Available data source types include Device, API, and App Push. The component's content updates in real time based on this data source.

    Note
    • The component supports the following data types: single-precision number, double-precision number, integer, and string.

    • If you enter both static data and dynamic data for Text, dynamic data takes precedence.

    • If the data source is device, you can configure the text to display when the device is offline.

      When using this component in a Repeat List, to configure its display for when the device is offline, you must associate its data source with a device. The configuration is as follows:

      • If the data source of the Repeat List is a device, this component's data source can be set to parent component data source or device.

      • If the data source of the Repeat List is a non-device type, this component's data source must be device.

Step 3: Configure styles

  1. In the Style panel on the right side of the mobile application editor, configure the Text component's text level, font size (custom values supported), font, text color, line height, font weight, and alignment.

    Some style properties support dynamic data sources. For more information, see Data sources for configuration items.

  2. Adjust the component's width, height, and position on the page. For more information, see General styles.

Step 4: Configure interactions

  1. In the Interaction panel on the right side of the mobile application editor, click Add Interaction, and then set the Event and Action.

    This component only supports the Click event. For example, you can click the component to show or hide specific content.

    For more information, see Configure interactions.

  2. Preview and debug the component's data display and style. For more information, see Preview and debug.