Atomic Layout

The atomic layout features adaptive change and layout capabilities for screens of different sizes and types. Designers can use the atomic layout to define adaptive rules for elements on UIs of different forms. Developers can use the atomic layout to implement the adaptive UI features matching the design effect for a variety of screens.

NOTE: The atomic layout is supported since API version 5.

Hiding Components

You can set priority flags for a flex layout that does not support cross-row display to define the display priorities for elements in the horizontal or vertical direction. The elements are hidden based on available space of the container.

Style

Value Type

Default Value

Description

display-index

number

Infinity

Hide child components according to the ascending order of their display-index values when the space on the flex main axis of the container is insufficient to display all content.

Child components with the same display-index value are hidden at the same time.

You can use the default value (Infinity) for a child component, which means that it will not be hidden.

This style is applicable only to child components in a container that supports flex layout, such as <div>.

Proportion

In a flex layout that does not support cross-row display, elements with the proportion style configured are always arranged with the set proportions in the container.

Style

Value Type

Default Value

Description

flex-weight

number

-

Size weight of an element on the flex main axis.

Element size = Container main axis size x flex-weight / Sum of all element size weights.

This style takes effect only when it is set for all elements in the container.

Fixed Ratio

A component with fixed ratio can be scaled up and down while retaining its aspect ratio.

Style

Value Type

Default Value

Description

aspect-ratio

number

-

Aspect ratio of the component. The value is a floating-point value greater than 0.

The value is subjective to the upper and lower limits of the component size.

In a flex layout, the main axis size is adjusted first, based on which the cross axis size is adjusted.