A utility component for creating horizontal flex containers.

Importing

The component can be imported via:

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

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={{ maxWidth: '500px' }}>
  <Stack alignInline="center">
    <Box mb="100" textAlign="center">
      <Code>start</Code>
    </Box>

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

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

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

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

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

alignInline

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

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

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

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

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

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

Wrap

The inline stack can be set to wrap with the wrap prop. It accepts a boolean value, or a wrap or nowrap string;

<InlineStack gap="200" wrap={true}>
  {[...Array(10)].map((_, index) => (
    <Box key={index} backgroundColor="information" p="200" />
  ))}
</InlineStack>

On this page