HStack
A view that arranges its children horizontally.
Example​
- swiftui-react-native
- SwiftUI
- React Native
<HStack alignment="top" spacing={10}>
<Text>Hello</Text>
<Text>World</Text>
</HStack>
HStack(alignment: .top, spacing: 10) {
Text("Hello")
Text("World")
}
<View style={{ flexDirection: 'row', jusitfyContent: 'flex-start', gap: 10 }}>
<Text>Hello</Text>
<Text>World</Text>
</View>
Props​
HStack inherits all View Modifiers as props.
prop | description | type | required | default |
---|---|---|---|---|
spacing | Amount of space between stack items | number | no | 0 |
alignment | The alignment guide | 'top' | 'bottom' | 'center' | no | 'center' |
children | Stack items | ReactNode | no | null |