PPolaris ComponentsConnect an agent

Exception list

A compact list of warnings and critical problems attached to an item, such as the risks or fulfillment issues on a single order.

Preview

Code

Example.jsx
import { Badge, Card, Box, BlockStack, InlineStack, Text, ExceptionList, Divider } from '@shopify/polaris';
import { AlertTriangleIcon, AlertDiamondIcon, NoteIcon, InventoryIcon } from '@shopify/polaris-icons';

const ORDER_EXCEPTIONS = [
  {
    icon: AlertDiamondIcon,
    status: 'critical',
    title: 'High risk',
    description: 'The billing address does not match the card issuer country.',
  },
  {
    icon: AlertTriangleIcon,
    status: 'warning',
    title: 'Address',
    description: 'The shipping address may be incomplete: no apartment or unit number.',
  },
  {
    icon: NoteIcon,
    description: 'Customer note: please leave the parcel with the building concierge.',
  },
];

const PRODUCT_EXCEPTIONS = [
  {
    icon: InventoryIcon,
    status: 'critical',
    title: 'Out of stock',
    description: 'Aurora Wool Scarf has 0 units left and is still selling.',
  },
  {
    icon: AlertTriangleIcon,
    status: 'warning',
    title: 'Missing weight',
    description: 'Shipping rates cannot be calculated at checkout until a weight is set.',
  },
];

export const Example = () => (
  <BlockStack gap="400">
    <Card>
      <BlockStack gap="300">
        <InlineStack align="space-between" blockAlign="center">
          <Text as="h2" variant="headingMd">
            Order #1042
          </Text>
          <Badge tone="attention" progress="incomplete">
            Unfulfilled
          </Badge>
        </InlineStack>
        <Divider />
        <Box paddingBlockStart="100">
          <ExceptionList items={ORDER_EXCEPTIONS} />
        </Box>
      </BlockStack>
    </Card>

    <Card>
      <BlockStack gap="300">
        <Text as="h2" variant="headingMd">
          Needs attention
        </Text>
        <Divider />
        <Box paddingBlockStart="100">
          <ExceptionList items={PRODUCT_EXCEPTIONS} />
        </Box>
      </BlockStack>
    </Card>
  </BlockStack>
);