Polymorphic Component Overview

As an integral part of an application that can run in multi-device scenarios, components must be able to run on different devices. Necessary adjustments must also be made to them in terms of visual, interaction, and animation to achieve optimal experience. A component that is displayed in different forms on different devices is referred to as a polymorphic component.

Polymorphic components have the following characteristics:

  • Serving a variety of device forms, such as the default device, tablet, smart TV, telematics device, and smart wearable. (supported in OpenHarmony 3.2 and later versions)

  • Providing consistent effect in different scenarios: Polymorphic components enable the visual, interaction, and animation to be consistent in different scenarios, although attributes may be identical or differential in the design.

  • Enabling device-specific optimization: In addition to effect consistency, polymorphic components ensure that optimizations are made specific for different devices and the effects presented on the devices are optimal.

Component Statuses

  • Component statuses are visual presentations that show the current interaction phases of the components. The same state of different components should keep the same visual style, which must be clear and visible.

  • An application may be deployed on different devices. Some devices support multiple input modes. For example, a tablet can be connected to a Bluetooth keyboard and mouse for text editing. In this case, the component must meet the interaction requirements of both the keyboard and mouse, and support the focused and hover states. If the component does not support these two states, when users move focus using the keyboard or mouse over a given element, the component cannot render the appropriate state to give the user the correct visual guidance. OpenHarmony provides the default implementation for components in multiple interaction modes to support multiple input modes and unified interaction events.

Common button statuses are as follows.

1_en-us_image_0000001568212890.png 1_en-us_image_0000001568293053.png 1_en-us_image_0000001568212892.png
Normal
The component is interactive.
Disabled
The component is non-interactive.
Pressed
The component is being touched.
Operation: Touch the component with a finger or click the component with a mouse, and hold it.
1_en-us_image_0000001568212893.png 1_en-us_image_0000001568212894.png 1_en-us_image_0000001568212895.png
Focused
The component is focused. Operations:
- Use arrow keys on a keyboard or remote control to move the focus from one component over another.
- Use voice operations to allow a component to gain focus.
Activated
The component is activated. This state is used for the component that has multiple elements to be focused.
Operation: Click a focused subtab of a tab. Touch the tab to activate it.
Hover
The current component is hovered using a cursor.
Operation: Move the cursor over a component.

Component Lists

bottom-tab subtab-out-of-screen title-bar-common
Bottom tab Subtab Title bar
title-bar-common-backup stepper-default 2_en-us_image_0000001568412869.png
Sidebar Page indicator Stepper

Display Components

1_en-us_image_0000001568093257.png 1_en-us_image_0000001568212898.png 1_en-us_image_0000001568212899.png
Divider Bubble Progress bar
1_en-us_image_0000001517133790.png 1_en-us_image_0000001568093233.png 1_en-us_image_0000001577319197.png
Badge Instant tip Data panel
text_sub_1
Text
2_en-us_image_0000001568212961.png 1_en-us_image_0000001517452952.png 1_en-us_image_0000001568293089.png
Button Drop-down list State button
1_en-us_image_0000001517133794.png 1_en-us_image_0000001517133814.png 2_en-us_image_0000001517612920.png
Index bar Scrollbar Pull to refresh
1_en-us_image_0000001568212945.png
Menu

Input Components

1_en-us_image_0000001517452972.png 1_en-us_image_0000001568093217.png
Text box Search box

Selection Components

1_en-us_image_0000001517133818.png 1_en-us_image_0000001517293384.png 1_en-us_image_0000001568093265.png
Tick box Toggle Radio button
1_en-us_image_0000001517133778.png 1_en-us_image_0000001517452964.png 3_en-us_image_0000001517133822.png
Check box Rating bar Slider
1_en-us_image_0000001517293372.png
Picker

Container Components

2_en-us_image_0000001568212941.png 1_en-us_image_0000001568412877.png
Panel Dialog