Column
Lays children out vertically. Extends Box with all spacing, alignment, and gap props.
Usage
import { Button, Column, Typography } from '@onlynative/components'
import { ThemeProvider } from '@onlynative/core'
import { SafeAreaProvider } from 'react-native-safe-area-context'
import { View } from 'react-native'
export default function App() {
return (
<SafeAreaProvider>
<ThemeProvider>
<View style={{ flex: 1, justifyContent: 'center' }}>
<Column gap="md" p="lg">
<Typography variant="headlineSmall">Title</Typography>
<Typography variant="bodyMedium">Description text</Typography>
<Button variant="filled" onPress={() => {}}>Action</Button>
</Column>
</View>
</ThemeProvider>
</SafeAreaProvider>
)
}
Inverted
Reverse the layout direction with inverted:
import { Column, Typography } from '@onlynative/components'
import { ThemeProvider } from '@onlynative/core'
import { SafeAreaProvider } from 'react-native-safe-area-context'
import { View } from 'react-native'
export default function App() {
return (
<SafeAreaProvider>
<ThemeProvider>
<View style={{ flex: 1, justifyContent: 'center', padding: 16 }}>
<Column inverted gap="sm">
<Typography>First</Typography>
<Typography>Second</Typography>
</Column>
</View>
</ThemeProvider>
</SafeAreaProvider>
)
}
Props
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
inverted | boolean | | No | Reverses the layout direction (`column-reverse`). |
p | SpacingValue | - | No | Padding on all sides |
px | SpacingValue | - | No | Horizontal padding (paddingStart + paddingEnd) |
py | SpacingValue | - | No | Vertical padding (paddingTop + paddingBottom) |
pt | SpacingValue | - | No | Padding top |
pb | SpacingValue | - | No | Padding bottom |
ps | SpacingValue | - | No | Padding start (left in LTR, right in RTL) |
pe | SpacingValue | - | No | Padding end (right in LTR, left in RTL) |
m | SpacingValue | - | No | Margin on all sides |
mx | SpacingValue | - | No | Horizontal margin (marginStart + marginEnd) |
my | SpacingValue | - | No | Vertical margin (marginTop + marginBottom) |
mt | SpacingValue | - | No | Margin top |
mb | SpacingValue | - | No | Margin bottom |
ms | SpacingValue | - | No | Margin start |
me | SpacingValue | - | No | Margin end |
gap | SpacingValue | - | No | Gap between children |
rowGap | SpacingValue | - | No | Row gap between children |
columnGap | SpacingValue | - | No | Column gap between children |
flex | number | - | No | Flex value |
align | enum | - | No | Align items along the cross axis |
justify | enum | - | No | Justify content along the main axis |
bg | string | - | No | Background color |