1e41f4b71Sopenharmony_ci# Stack
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciThe **Stack** component provides a stack container where child components are successively stacked and the latter one overwrites the previous one.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci>  **NOTE**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci>  This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci## Child Components
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ciThis component can contain child components.
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ci## APIs
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ciStack(value?: { alignContent?: Alignment })
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 9.
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci**Parameters**
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci| Name      | Type                                   | Mandatory| Description                                                   |
28e41f4b71Sopenharmony_ci| ------------ | ------------------------------------------- | ---- | ----------------------------------------------------------- |
29e41f4b71Sopenharmony_ci| alignContent | [Alignment](ts-appendix-enums.md#alignment) | No  | Alignment of child components in the container.<br>Default value: **Alignment.Center**|
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_ci## Attributes
32e41f4b71Sopenharmony_ci
33e41f4b71Sopenharmony_ciIn addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported.
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ci### alignContent
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_cialignContent(value: Alignment)
38e41f4b71Sopenharmony_ci
39e41f4b71Sopenharmony_ciSets the alignment of all child components in the container. When both this attribute and the universal attribute [align](ts-universal-attributes-location.md#align) are set, whichever is set last takes effect.
40e41f4b71Sopenharmony_ci
41e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
42e41f4b71Sopenharmony_ci
43e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 9.
44e41f4b71Sopenharmony_ci
45e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
46e41f4b71Sopenharmony_ci
47e41f4b71Sopenharmony_ci**Parameters**
48e41f4b71Sopenharmony_ci
49e41f4b71Sopenharmony_ci| Name| Type                                       | Mandatory| Description                                                       |
50e41f4b71Sopenharmony_ci| ------ | ------------------------------------------- | ---- | ----------------------------------------------------------- |
51e41f4b71Sopenharmony_ci| value  | [Alignment](ts-appendix-enums.md#alignment) | Yes  | Alignment of all child components in the container.<br>Default value: **Alignment.Center**|
52e41f4b71Sopenharmony_ci
53e41f4b71Sopenharmony_ci
54e41f4b71Sopenharmony_ci## Example
55e41f4b71Sopenharmony_ci
56e41f4b71Sopenharmony_ci```ts
57e41f4b71Sopenharmony_ci// xxx.ets
58e41f4b71Sopenharmony_ci@Entry
59e41f4b71Sopenharmony_ci@Component
60e41f4b71Sopenharmony_cistruct StackExample {
61e41f4b71Sopenharmony_ci  build() {
62e41f4b71Sopenharmony_ci    Stack({ alignContent: Alignment.Bottom }) {
63e41f4b71Sopenharmony_ci      Text('First child, show in bottom').width('90%').height('100%').backgroundColor(0xd2cab3).align(Alignment.Top)
64e41f4b71Sopenharmony_ci      Text('Second child, show in top').width('70%').height('60%').backgroundColor(0xc1cbac).align(Alignment.Top)
65e41f4b71Sopenharmony_ci    }.width('100%').height(150).margin({ top: 5 })
66e41f4b71Sopenharmony_ci  }
67e41f4b71Sopenharmony_ci}
68e41f4b71Sopenharmony_ci```
69e41f4b71Sopenharmony_ci
70e41f4b71Sopenharmony_ci![en-us_image_0000001219982699](figures/en-us_image_0000001219982699.PNG)
71