VStack

RSC
VStack is a layout component for arranging elements vertically.
Installation
API Reference
Important Note
This is the documentation for gluestack-ui v2 (beta). For @gluestack-ui/themed (stable) documentation, refer to gluestack-ui v1.
This is an illustration of VStack component.
space
reversed
<Box className="justify-center h-80">
<VStack space="md" reversed={false}>
<Box className="h-20 w-20 bg-primary-300" />
<Box className="h-20 w-20 bg-primary-400" />
<Box className="h-20 w-20 bg-primary-500" />
</VStack>
</Box>

Installation

Run the following command:

npx gluestack-ui add vstack

API Reference

To use this component in your project, include the following import statement in your file.
import { VStack } from "@/components/ui/vstack"
export default () => <VStack />

Component Props

This section provides a comprehensive reference list for the component props, detailing descriptions, properties, types, and default behavior for easy project integration.

VStack

Renders a <div /> on web and a View on native.

Platform
Output
Web
<div />
Native
<View />

Accessibility

The accessibility of a VStack is primarily determined by the accessibility information of the components it contains. When you pass an accessible component inside a VStack, its accessibility attributes, such as labels and hints, will be utilized by assistive technologies like screen readers.
In essence, the VStack acts as a container that inherits and propagates the accessibility attributes of its child views.

Props

VStack

Prop
Type
Default
Description
space
string
-
It sets the space between children. By default there is no space between the VStack items.
reversed
boolean
false
When true, it places the VStack items in reverse direction.

Examples

The Examples section provides visual representations of the different variants of the component, allowing you to quickly and easily determine which one best fits your needs. Simply copy the code and integrate it into your project.

VStack Reversed

A VStack component with the reversed prop reverses the order of vertically stacked elements, enabling customized vertical layouts and visual arrangements of content within a user interface.
<VStack space="md">
<Box className="w-20 h-20 bg-primary-300" />
<Box className="w-20 h-20 bg-primary-400" />
<Box className="w-20 h-20 bg-primary-500" />
</VStack>