Add template ui element to horizontal list
Function: Add template ui element to horizontal list
This function allows you to dynamically insert a pre-designed "Template" into an existing "Horizontal List" UI element on your application's screen. This is useful for building flexible layouts where content can be added or removed on the fly, such as displaying a list of products, user profiles, or news articles.
Input
- List ui element (UI element, required): This is the specific "Horizontal List" component on your page where you want to add the new template. You must select an existing Horizontal List.
- Template (Template, required): This is the pre-built "Template" that you wish to insert into the Horizontal List.
- Code (A piece of text, required): A unique identifier or code for this specific instance of the template being added. This helps in managing or referencing this particular template instance later.
- Form group (A piece of text, required): A grouping identifier for the template instance, often used to organize related form fields or data within the template.
- Template parameters (Parameters that can be passed to templates when executing, optional): If your chosen "Template" is designed to accept specific data, you can provide those values here. These parameters will be used to populate the content within the newly added template.
Output
No explicit output is returned by this function. The primary outcome is the modification of the user interface, where the specified "Template" UI element is added to the chosen "Horizontal List" on the screen.
Execution Flow
Real-Life Examples
Example 1: Displaying a New Product Card
Imagine you have an e-commerce application and you want to dynamically add a new product to a "Featured Products" section, which is a Horizontal List.
- Inputs:
- List ui element:
Featured Products List(your Horizontal List component) - Template:
Product Card Template(a template designed to display product information) - Code:
PROD_XYZ_123 - Form group:
ProductDisplay - Template parameters: (empty, as product details might be fetched separately or the template has default values)
- List ui element:
- Result: A new "Product Card" UI element, based on the
Product Card Template, appears at the end of yourFeatured Products List.
Example 2: Adding a User Profile Widget to a Team View
You're building a team management dashboard and want to add a new team member's profile widget to a "Team Members" horizontal list when a new user is created.
- Inputs:
- List ui element:
Team Members List(your Horizontal List component) - Template:
User Profile Widget(a template showing user name, photo, and role) - Code:
USER_PROFILE_007 - Form group:
TeamManagement - Template parameters:
\{
"userId": "user_id_from_database",
"userName": "Alice Smith",
"userRole": "Project Manager"
\}
- List ui element:
- Result: A new "User Profile Widget" UI element, pre-filled with Alice Smith's details, is added to the
Team Members List.
Example 3: Showing a New Notification Alert
On a user's dashboard, you want to display a new notification alert in a "Recent Notifications" horizontal list whenever an important event occurs.
- Inputs:
- List ui element:
Recent Notifications List(your Horizontal List component) - Template:
Notification Alert Template(a template for displaying a notification message) - Code:
NOTIF_CRITICAL_456 - Form group:
DashboardNotifications - Template parameters:
\{
"message": "Your subscription is expiring soon!",
"type": "warning",
"timestamp": "2023-10-27T10:00:00Z"
\}
- List ui element:
- Result: A new "Notification Alert" UI element, displaying the warning message, appears in the
Recent Notifications Liston the user's dashboard.