Banner
A prominent message at the top of a page or card that informs merchants about a change, a problem or an action they need to take.
Preview
Code
Example.jsx
import { useState } from 'react';
import { Banner, BlockStack, InlineStack, Text, Button, Link, List } from '@shopify/polaris';
export const Example = () => {
const [dismissed, setDismissed] = useState(false);
return (
<BlockStack gap="400">
{dismissed ? (
<InlineStack gap="300" blockAlign="center">
<Text as="p" tone="subdued">
The dismissible banner is hidden.
</Text>
<Button onClick={() => setDismissed(false)}>Bring it back</Button>
</InlineStack>
) : (
<Banner title="Your free trial ends in 3 days" onDismiss={() => setDismissed(false)}>
<Text as="p">
Pick a plan before July 17 to keep your discount rules running. Nothing is charged until the trial ends.
</Text>
</Banner>
)}
<Banner
title="Order #1042 was archived"
tone="success"
action={{ content: 'View order' }}
secondaryAction={{ content: 'Undo' }}
>
<Text as="p">The customer was refunded $84.00 and the inventory has been restocked.</Text>
</Banner>
<Banner
title="Some products are missing a weight"
tone="warning"
action={{ content: 'Edit products' }}
secondaryAction={{ content: 'Learn more' }}
>
<BlockStack gap="200">
<Text as="p">Shipping rates cannot be calculated at checkout until every product has a weight.</Text>
<List>
<List.Item>Aurora Wool Scarf</List.Item>
<List.Item>Cedar Camp Mug</List.Item>
</List>
</BlockStack>
</Banner>
<Banner
title="We could not charge your card"
tone="critical"
action={{ content: 'Update payment method' }}
secondaryAction={{ content: 'Contact support' }}
>
<Text as="p">
Your subscription is paused. Update your billing details to restore access, or{' '}
<Link url="https://help.shopify.com" removeUnderline>
read about failed payments
</Link>
.
</Text>
</Banner>
</BlockStack>
);
};