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