A utility component for creating vertical flex containers.

Importing

The component can be imported via:

import { Stack } from '@customerio/pluma-components/react';
<Stack gap="200">
  <Box backgroundColor="information" p="200" />
  <Box backgroundColor="information" p="200" />
  <Box backgroundColor="information" p="200" />
</Stack>

Alignment

Alignment within the flex container can be controlled with the alignBlock and alignInline props.

  • alignBlock controls alignment along the block axis (typically the vertical axis)
  • alignInline controls alignment along the inline axis (typically the horizontal axis)

Internally, these props are translated to the align-items and justify-content CSS properties.

alignBlock

start
center
end
<InlineStack alignInline="space-between" alignBlock="stretch" gap="200" style={{ width: '300px' }}>
  <Stack alignInline="center">
    <Box mb="100" textAlign="center">
      <Code>start</Code>
    </Box>

    <Box display="flex" style={{ height: '200px' }}>
      <Stack gap="200" alignBlock="start" backgroundColor="information-minimal">
        <Box backgroundColor="information" p="200" />
        <Box backgroundColor="information" p="200" />
        <Box backgroundColor="information" p="200" />
      </Stack>
    </Box>
  </Stack>

  <Stack alignInline="center">
    <Box mb="100" textAlign="center">
      <Code>center</Code>
    </Box>

    <Box display="flex" style={{ height: '200px' }}>
      <Stack gap="200" alignBlock="center" backgroundColor="information-minimal">
        <Box backgroundColor="information" p="200" />
        <Box backgroundColor="information" p="200" />
        <Box backgroundColor="information" p="200" />
      </Stack>
    </Box>
  </Stack>

  <Stack alignInline="center">
    <Box mb="100" textAlign="center">
      <Code>end</Code>
    </Box>

    <Box display="flex" style={{ height: '200px' }}>
      <Stack gap="200" alignBlock="end" backgroundColor="information-minimal">
        <Box backgroundColor="information" p="200" />
        <Box backgroundColor="information" p="200" />
        <Box backgroundColor="information" p="200" />
      </Stack>
    </Box>
  </Stack>
</InlineStack>

alignInline

start
center
end
<Stack gap="200" style={{ width: '300px' }}>
  <Box>
    <Box mb="100" textAlign="center">
      <Code>start</Code>
    </Box>

    <Stack gap="200" alignInline="start" backgroundColor="information-minimal">
      <Box backgroundColor="information" p="200" />
      <Box backgroundColor="information" p="200" />
      <Box backgroundColor="information" p="200" />
    </Stack>
  </Box>

  <Box>
    <Box mb="100" textAlign="center">
      <Code>center</Code>
    </Box>

    <Stack gap="200" alignInline="center" backgroundColor="information-minimal">
      <Box backgroundColor="information" p="200" />
      <Box backgroundColor="information" p="200" />
      <Box backgroundColor="information" p="200" />
    </Stack>
  </Box>

  <Box>
    <Box mb="100" textAlign="center">
      <Code>end</Code>
    </Box>

    <Stack gap="200" alignInline="end" backgroundColor="information-minimal">
      <Box backgroundColor="information" p="200" />
      <Box backgroundColor="information" p="200" />
      <Box backgroundColor="information" p="200" />
    </Stack>
  </Box>
</Stack>

On this page