VStack

VStack organizes items vertically in a layout. Alternatively, you can use Column as an alias for VStack to achieve the same layout.
Installation
API Reference
This is an illustration of VStack component.
space
reversed
<Box h="$80" justifyContent="center">
<VStack space="md" reversed={false}>
<Box w="$20" h="$20" bg="$primary300" />
<Box w="$20" h="$20" bg="$primary400" />
<Box w="$20" h="$20" bg="$primary500" />
</VStack>
</Box>

Installation

Step 1: Copy and paste the following code into your project.

import { styled } from "@gluestack-style/react"
import { View } from "react-native"
const StyledRoot = styled(
View,
{
flexDirection: "column",
variants: {
space: {
xs: {
gap: `$1`,
},
sm: {
gap: `$2`,
},
md: {
gap: `$3`,
},
lg: {
gap: `$4`,
},
xl: {
gap: `$5`,
},
"2xl": {
gap: `$6`,
},
"3xl": {
gap: `$7`,
},
"4xl": {
gap: `$8`,
},
},
reversed: {
true: {
flexDirection: "column-reverse",
},
},
},
},
{}
)
export const VStack = StyledRoot

Step 2: Update the import paths to match your project setup.

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

It inherits all the properties of React Native's View component.

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 component is created using View component from react-native. It extends all the props supported by React Native View, utility props and the props mentioned below.

VStack

Prop
Type
Default
Description
space
string
-
It sets the space between children.
reversed
boolean
-
When true, it places the VStack items in reverse direction.
Edit this page on GitHub