HStack component uses flexbox to lay content out in a column.
On mobile only HStack is essentially the same component as Box, because Box by default has flexbox enabled (display: flex
) and takes column
as its initial flex-direction
value.
You should use VStack when:
- you want to lay content out in rows that are sized to their content (height only, by default each child will fill the width of the VStack)
- you want to add gaps between columns
- you want to lay content out in columns that fill the available space within the parent container
- you need columns of proportionate size to each other (also known as a ratio-based layout)
Rows Sized to Content
Loading...
Rows with Gaps
Loading...
Rows that Fill the Available Space
Loading...
Rows that Have Proportionate Sizes
Loading...
A11y
Has the same accessibility requirements as Box.
Responsive Styles
Web only You can create responsive layouts by passing a configuration object to each supported property of VStack and specify unique styles for phones, tablets, or desktops.
Please note, there are no default responsive styles for VStack. This is an additive feature that you will need to configure yourself.
Supported Properties
- Padding
- Margin
- Gap
- Flex styles (justify content, align content, align items, align self, flex direction, and flex wrap)
- Display
- Visibility
Usage
Loading...