Combine custom & standard components (Alpha)

triangle-exclamation

Combining Custom components (Alpha) with Standard componentsarrow-up-right enables the creation of advanced functionality and rich user interfaces. Standard components, such as stepper , progress-bar , and countdown , provide a reliable foundation for common interactions, ensuring consistency and usability. By integrating custom components and tailored elements designed to meet specific requirements, you can extend this functionality to create dynamic features like interactive menus, tabbed navigation, and toggles with unique behaviors. This blend allows for a balance between efficiency and creativity, enabling apps to stand out with innovative designs while maintaining intuitive user experiences.

This approach encourages modular development, fostering scalability and adaptability, whether for small projects or enterprise-grade applications.

Here are code examples to illustrate combining custom and standard components to build advanced features.

Considerations

  • When using component.image in a custom component, the height property must be specified as part of the size property. Otherwise, validation errors occur, see below:

# Correct YAML snippet for using the height property in the image component,
# when used in a custom component.
- type: component.image
          options:
            size: 
              height: 196
            source:
              uri: https://images

Example and code samples

The examples use a set of custom components called sections. The sections are for titles, spacing, and context. The sections code is available on GitHubarrow-up-right.

Countdown

Countdown
Countdown

In this example, the first component.countdown is a standard component and the following four are custom components. Here, the component.countdown is configured in a component.card with color.

Example:

  1. See the section component example in GitHubarrow-up-right.

  2. See the custom component example in GitHubarrow-up-right.

  3. See the jig example in GitHubarrow-up-right.

Progress Bar

In this example, the component.progress-bar, is customized by adding a component.card, component.icon, and component.text to achieve the required appearance.

Example:

  1. See the section component example in GitHubarrow-up-right.

  2. See the custom component example in GitHubarrow-up-right.

  3. See the jig example in GitHubarrow-up-right.

Progress-bar
Progress-bar

More examples of customized progress bars are available on GitHubarrow-up-right:

Ratings

Ratings
Ratings

This example demonstrates how you can create your own component using the custom components. Here various rating components are created by configuring the component.view and component.text.

Example:

  1. See the section component example in GitHubarrow-up-right.

  2. See the custom component example in GitHubarrow-up-right.

  3. See the jig example in GitHubarrow-up-right.

Sections

This example demonstrates how you can create one custom component and reuse it multiple times, in this instance, in the same jig. We use inputs to show different data and elements in each reuse of the custom component. Here a standard component.avatar is combined with component.view, component.text and component.icon.

Example:

  1. See the custom component example in GitHubarrow-up-right.

  2. See the jig example in GitHubarrow-up-right.

Sections
Sections

More examples of customized sections are available on GitHubarrow-up-right:

Stepper

Steppers
Steppers

This example demonstrates how you can create one custom component and reuse it multiple times, in this instance in the two different jigs. We use inputs to show the number of steps and current steps in each reuse of the custom component. Here a stepper component is created by configuring the component.view.

Example:

  1. See the section component example in GitHubarrow-up-right.

  2. See the custom component example in GitHubarrow-up-right.

  3. See the jig example in <GitHubarrow-up-right.

More examples of customized sections are available on GitHubarrow-up-right:

Tabs

This example demonstrates how you can create custom components and reuse them multiple times. We use inputs to show the tab value, name, indicator and alignment in each reuse of the custom component. Here tab components are created by configuring the component.view. Additionally, we show how to reference a custom component inside a standard component.list-item.

Example:

  1. See the section component example in GitHubarrow-up-right.

  2. See the custom component example in GitHubarrow-up-right.

  3. See the jig example in GitHubarrow-up-right.

Tabs
Tabs

Tags

Tags
Tags

This example demonstrates how you can create tags in a custom component. We use inputs in the custom component to show the tag color and title. Here a tab component is created by configuring the component.view and component.text. Additionally, we show you how to reference a custom component inside a standard component.list, and use a second custom component to create an action allowing you to tap a link at the top to add new tag.

Example:

  1. See the custom component example in GitHubarrow-up-right.

  2. See the jig example in GitHubarrow-up-right.

Toggles

This example demonstrates how you can create a custom component providing the functionality to toggle. We use inputs to determine the toggle name, highlighting and value. Here a toggle component is created by configuring the component.view and component.text. Additionally, we show you how to reference a custom component inside a standard component.list. The custom component is configured with the onPress event to trigger an action when the toggle is pressed.

Example:

  1. See the custom component example in GitHubarrow-up-right.

  2. See the jig example in GitHubarrow-up-right.

Toggles
Toggles

Last updated

Was this helpful?