Looking for documentation on gluestack-ui v2 with NativeWind? Refer to this
link.
This is an illustration of a Themed HStack component with default configuration.
<HStack space="md" reversed={false}>
<Box w="$20" h="$20" bg="$blue300" />
<Box w="$20" h="$20" bg="$blue400" />
<Box w="$20" h="$20" bg="$blue500" />
API Reference
Import
To use this component in your project, include the following import statement in your file.
import { HStack } from '@gluestack-ui/themed';
Anatomy
The structure provided below can help you identify and understand a HStack component's various parts.
export default () => <HStack />
Component Props
This section provides a comprehensive reference list for the component props, detailing descriptions, properties, types, and default behavior for easy project integration.
HStack
It inherits all the properties of React Native's
View component.
Accessibility
The accessibility of a HStack is primarily determined by the accessibility information of the components it contains. When you pass an accessible component inside a HStack, its accessibility attributes, such as labels and hints, will be utilized by assistive technologies like screen readers.
Themed
The themed version of the component is a pre-styled version of the component, which allows you to quickly integrate the component into your project. The component's design and functionality are fully defined, allowing you to focus on the more important aspects of your project. To know more about Themed Library please visit this
link.
Props
HStack 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.
Prop | Type | Default | Description |
---|
space | string | - | It sets the space between children. By default there is no space between the HStack items. |
reversed | boolean | false | When true, it places the HStack items in reverse direction. |
Note: These props are exclusively applicable when utilizing the default configuration of gluestack-ui/config. If you are using a custom theme, these props may not be available.
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.
HStack Reversed
An HStack component with the reversed prop reverses the order of horizontally stacked elements, allowing for customized layouts and visual arrangements of content within a user interface.
<HStack space="md" reversed>
<Box w="$20" h="$20" bg="$blue300" />
<Box w="$20" h="$20" bg="$blue400" />
<Box w="$20" h="$20" bg="$blue500" />
Unstyled
We provide in-depth information on how to customize and extend the component's functionality to meet your needs. Below, we describe how to modify the component to suit your requirements.
Spec Doc
Explore the comprehensive details of the HStack in this document, including its implementation details, checklist, and potential future additions. Dive into the thought process behind the component and gain insights into its development journey.