PPolaris ComponentsConnect an agent

InlineStack

Lays its children out in a row with a token-based gap, and controls how they are distributed horizontally, aligned vertically, and whether they wrap.

Preview

Code

Example.jsx
import { Card, Box, BlockStack, InlineStack, Text } from '@shopify/polaris';

const GAPS = ['100', '300', '500'];

const ALIGNS = ['start', 'center', 'end', 'space-between'];

const BLOCK_ALIGNS = ['start', 'center', 'end'];

const TAGS = ['Outerwear', 'Sale', 'New arrival', 'Winter 2025', 'Unisex', 'Waterproof', 'Bestseller'];

const Chip = ({ children, height }) => (
  <Box background="bg-surface-secondary" borderRadius="200" paddingBlock="200" paddingInline="300" minHeight={height}>
    <Text as="span" variant="bodySm">
      {children}
    </Text>
  </Box>
);

const Row = ({ label, children }) => (
  <BlockStack gap="200">
    <Text as="h3" variant="headingSm">
      {label}
    </Text>
    <Box background="bg-surface-secondary" borderRadius="200" borderWidth="025" borderColor="border" padding="200">
      <Box background="bg-surface" borderRadius="100" padding="200">
        {children}
      </Box>
    </Box>
  </BlockStack>
);

export const Example = () => (
  <Card>
    <BlockStack gap="500">
      {GAPS.map((gap) => (
        <Row key={gap} label={`gap="${gap}"`}>
          <InlineStack gap={gap}>
            <Chip>Draft</Chip>
            <Chip>Scheduled</Chip>
            <Chip>Published</Chip>
          </InlineStack>
        </Row>
      ))}

      {ALIGNS.map((align) => (
        <Row key={align} label={`align="${align}"`}>
          <InlineStack gap="200" align={align}>
            <Chip>Products</Chip>
            <Chip>Orders</Chip>
            <Chip>Customers</Chip>
          </InlineStack>
        </Row>
      ))}

      {BLOCK_ALIGNS.map((blockAlign) => (
        <Row key={blockAlign} label={`blockAlign="${blockAlign}"`}>
          <InlineStack gap="200" blockAlign={blockAlign}>
            <Chip height="72px">Tall</Chip>
            <Chip>Short</Chip>
            <Chip height="48px">Medium</Chip>
          </InlineStack>
        </Row>
      ))}

      <Row label="wrap (default) — items flow onto a new line">
        <InlineStack gap="200">
          {TAGS.map((tag) => (
            <Chip key={tag}>{tag}</Chip>
          ))}
        </InlineStack>
      </Row>
    </BlockStack>
  </Card>
);