Skip to main content
This document uses a small case of implementing text-copy functionality with a custom component, so you can experience the end-to-end process of custom component development, debugging, installation, and usage.

Case Scenario

Use the custom component feature to add low-code enhancements to YiDA’s built-in text component, enabling text-copy functionality. This copies text content to the clipboard, making it easier for users to fill in repetitive fields.

Result Preview

Steps

Step 1: Create a Custom Component

Configure properties such as the component name, type, and identifier to build a component tailored to your business needs at low cost. Steps:
  1. Go to YiDA App >> App Settings >> Component Management >> Component Center (as shown below).
  2. Add a Component >> fill in the component name, component type, component identifier, and other properties >> Confirm (as shown below).

Step 2: Develop and Debug the Custom Component

Develop and debug the component to meet different business needs. In this case, we implement the copy functionality of the component. Steps:
  1. Component Center >> My Components >> locate the component you want to debug >> Develop (as shown below).
  2. As mentioned earlier, a component is built from a view and its properties. When developing a component, first abstract the properties it requires. Let’s build the component properties first. This component needs only one property for text content. Go to Property Configuration >> Property Definition, add a text content property named content, set the property type to Text, and set the setter to textSetter.
  3. After the component properties are built, construct the component view by adding the required YiDA standard components to the canvas (in this case, two Text components are needed, named “Text” and “Copy” respectively). Configure their basic properties, and use variable binding to bind the Text component’s content to the property props.content you just built. The passed-in property value is then displayed at runtime (as shown below).
  4. Configure an action on the Button component to implement the text-copy effect. Select the “Copy” text >> Create Action >> onCopyText click (as shown below).
  5. Write the copy logic in the JS panel (as shown below).
  1. Save >> preview the component.
  2. Publish >> fill in the version number and related notes >> Confirm (as shown below).
  3. A prompt appears upon successful publishing (as shown below). In actual component development, once you save, you can install the development version (0.1.0) of the component for real-time debugging. The official version only needs to be published after component development is complete.

Step 3: Install the Custom Component

Install the developed and debugged custom component into a page so you can use it during page design. When installing the component, you must select the page type. Only after this selection will the custom component appear in the corresponding page designer. Steps:
  1. Form Design Page >> Component Library >> Custom Components >> Component Management (as shown below).
  2. Component Management Page >> Component List >> select the custom component you want to install >> Install (as shown below).
  3. Select the installation version and installation scope >> Install (as shown below).
  1. To ensure stable use of the custom component in production, be sure to install a stable version released after 1.x.x when selecting the component version.
  2. To ensure the custom component is available in the page designer, the installed component appears in a page designer only after you select the corresponding page type in the installation scope.

Step 4: Use the Custom Component

After the steps above, the custom component is installed under the Custom Components category in the page component library. Follow the steps below to use it. Steps:
  1. Form Design Page >> Component Library >> Custom Components >> select the component you need >> drag it to the canvas (as shown below).

Step 5: View or Modify Component Information

While using a component, if you need to modify its thumbnail, help document URL, or description, follow the steps below. Steps
  1. App Settings >> Component Management >> Component Center (as shown below).
  2. Select the component whose details you want to view or modify >> Details (as shown below).
Note: The component details page has three modules: Basic Information, Release Information, and Admin (as shown below).
  1. Basic Information: Click “Edit” to modify the custom component’s thumbnail, help document URL, and description. Other settings are configured at component creation and cannot be modified.
  2. Release Information: View the iteration history of the custom component, including the version and corresponding release notes.
  3. Admin (has permission to develop and debug the custom component; defaults to the component creator): Add or remove admins to manage permissions.

Custom Component Properties

In addition to supporting enhancements to YiDA’s built-in components, custom components also let you customize the properties (propTypes) of the generated custom component. This makes the custom component more aligned with developers’ daily work scenarios and habits, while giving it greater flexibility and customizability.

Entry for Custom Component Property Configuration

Path: Low-code component designer >> select the “low-code business component” on the canvas >> properties on the right (path shown below).

Custom Component Property Configuration Details

Custom component properties are divided into four modules: Dual-end Design, Property Definition (propTypes), Lifecycle, and Unique Identifier. Specifically:
  • Dual-end Design: A toggle. When enabled, the PC and mobile ends can be fully separated and designed independently to meet dual-end adaptation needs.
  • Property Definition (propTypes): Customize basic properties of the custom component such as title, name, type (data format), and default value. You can also bind events such as Hide (whether the component is hidden) and On Change (when the displayed value changes) to meet various business needs. For details, see Component Property Configuration.
  • Lifecycle: A custom component’s lifecycle has four stages: Component Rendered (componentDidMount), Component Updated (componentDidUpdate), Component Error Caught (componentDidCatch), and Before Component Unmount (componentWillUnmount). Write different logic for different lifecycle stages to meet complex business needs.
  • Unique Identifier: Like YiDA standard components, custom components also have a unique identifier property that serves as the component’s unique identification code. It is automatically generated by the system and generally does not need to be changed. It is used for YiDA backend data storage, code binding, and so on.
Important:
  • The component’s unique identifier (fieldId) is the unique identification code that YiDA uses to reference the component. Changing the identifier may affect the formulas used on this component, data storage (data may be lost), JS function references, and so on. We strongly advise against modifying the component’s unique identifier!
  • If you insist on modifying this identifier (currently only possible via schema import), by choosing this method you acknowledge that you fully understand the consequences and accept sole responsibility for them. YiDA is not liable for any resulting consequences. Thank you for your understanding and support.