React Native MantineLayout

Flex

Flexible box layout with full control

Import: import { Flex } from 'react-native-mantine';

Usage

import { Flex , Badge } from 'react-native-mantine';

// Row layout with gap
<Flex
  direction="row"
  justify="space-between"
  align="center"
  gap="md"
>
  <Badge>Item 1</Badge>
  <Badge>Item 2</Badge>
</Flex>

// Column layout
<Flex direction="column" gap="sm">
  <Badge>Item 1</Badge>
  <Badge>Item 2</Badge>
</Flex>

// Wrap layout
<Flex wrap="wrap" gap="md">
  <Badge>Item 1</Badge>
  <Badge>Item 2</Badge>
  <Badge>Item 3</Badge>
</Flex>

Props

PropTypeDefaultDescription
direction'row' | 'row-reverse' | 'column' | 'column-reverse''row'Flex direction - defines the main axis direction
wrap'nowrap' | 'wrap' | 'wrap-reverse''nowrap'Flex wrap behavior - whether items wrap to new lines
align'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline'Align items along the cross axis (align-items property)
justify'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly'Justify content along the main axis (justify-content property)
gap'xs' | 'sm' | 'md' | 'lg' | 'xl' | numberGap between flex items from theme.spacing or number for gap in px
columnGap'xs' | 'sm' | 'md' | 'lg' | 'xl' | numberColumn gap from theme.spacing or number for gap in px
rowGap'xs' | 'sm' | 'md' | 'lg' | 'xl' | numberRow gap from theme.spacing or number for gap in px
childrenReact.ReactNodeFlex container children
styleViewStyleAdditional styles to apply to the flex container
pstring | numberPadding on all sides (inherited from BoxView)
pxstring | numberPadding horizontal (inherited from BoxView)
pystring | numberPadding vertical (inherited from BoxView)
ptstring | numberPadding top (inherited from BoxView)
pbstring | numberPadding bottom (inherited from BoxView)
plstring | numberPadding left (inherited from BoxView)
prstring | numberPadding right (inherited from BoxView)
mstring | numberMargin on all sides (inherited from BoxView)
mxstring | numberMargin horizontal (inherited from BoxView)
mystring | numberMargin vertical (inherited from BoxView)
mtstring | numberMargin top (inherited from BoxView)
mbstring | numberMargin bottom (inherited from BoxView)
mlstring | numberMargin left (inherited from BoxView)
mrstring | numberMargin right (inherited from BoxView)
fullWidthbooleanTakes 100% width (inherited from BoxView)
fullHeightbooleanTakes 100% height (inherited from BoxView)

Source on GitHub · npm