Primals
Flex

Flex Component

The Flex component is a flexible box layout component for building responsive layouts in your application.

Props

The Flex component accepts the following props:

PropDescriptionType
dirA string that sets the direction of the Flex container.String
directionA string that sets the direction of the Flex container.String
wrapA string that sets the wrap property of the Flex container.String
justifyA string that sets the justify-content property of the Flex container.String
itemsA string that sets the align-items property of the Flex container.String
contentA string that sets the align-content property of the Flex container.String
gapA string that sets the gap between Flex items.String
gapXA string that sets the horizontal gap between Flex items.String
gapYA string that sets the vertical gap between Flex items.String
flexA string that sets the flex property of the Flex container.String
radiusA string that sets the border radius of the Flex container.String
bgA string that sets the background color of the Flex container.String
backgroundColorA string that sets the background color of the Flex container.String
wA string that sets the width of the Flex container.String
hA string that sets the height of the Flex container.String
widthA string that sets the width of the Flex container.String
heightA string that sets the height of the Flex container.String
pA string that sets the padding of the Flex container.String
ptA string that sets the top padding of the Flex container.String
prA string that sets the right padding of the Flex container.String
pbA string that sets the bottom padding of the Flex container.String
plA string that sets the left padding of the Flex container.String
pxA string that sets the horizontal padding of the Flex container.String
pyA string that sets the vertical padding of the Flex container.String
paddingA string that sets the padding of the Flex container.String
mA string that sets the margin of the Flex container.String
mtA string that sets the top margin of the Flex container.String
mbA string that sets the bottom margin of the Flex container.String
mrA string that sets the right margin of the Flex container.String
mlA string that sets the left margin of the Flex container.String
mxA string that sets the horizontal margin of the Flex container.String
myA string that sets the vertical margin of the Flex container.String
marginA string that sets the margin of the Flex container.String

Usage

<Flex
  dir="row"
  wrap="wrap"
  justify="center"
  items="start"
  content="start"
  gap="2"
  radius="md"
  bg="primary"
  w="full"
  h="full"
  p="4"
  m="2"
>
  <Button>Item 1</Button>
  <Button>Item 2</Button>
  <Button>Item 3</Button>
</Flex>

Examples

Column

Column with gap


Column with align items

Start
End
Center

Column with justify content

Start
End
Center

Column with align content

Start
End
Center

Row

Row with gap


Row with align items

Start
End
Center

Row with justify content

Start
End
Center

Row with align content

For content to work the container of the element must be a flex container and flex wrap must be set to wrap.

Start
End
Center