• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
12Supported
13
14
15## APIs
16
17Stack(value?: { alignContent?: Alignment })
18
19**Parameters**
20
21| Name| Type| Mandatory| Description|
22| -------- | -------- | -------- | -------- |
23| alignContent | [Alignment](ts-appendix-enums.md#alignment) | No| Alignment of child components in the container.<br>Default value: **Alignment.Center**|
24
25
26## Example
27
28```ts
29// xxx.ets
30@Entry
31@Component
32struct StackExample {
33  build() {
34    Stack({ alignContent: Alignment.Bottom }) {
35      Text('First child, show in bottom').width('90%').height('100%').backgroundColor(0xd2cab3).align(Alignment.Top)
36      Text('Second child, show in top').width('70%').height('60%').backgroundColor(0xc1cbac).align(Alignment.Top)
37    }.width('100%').height(150).margin({ top: 5 })
38  }
39}
40```
41
42![en-us_image_0000001219982699](figures/en-us_image_0000001219982699.PNG)
43