SlimBanner conveys brief information related to a specific section of a page. The message can relay success, warning, error or general information. Since they are about a specific section of a page or surface, SlimBanner sits inside of a container, and not at the top of the page. For alerts that apply to the whole page, use Callout.
also known as Notice, Note, Scoped Notification
Props
Usage guidelines
- When displaying section-level information to the user.
- When providing persistent messaging/guidance for specific elements or areas within a surface or page.
- When providing messaging/guidance on information-dense screens where there is limited space.
- When displaying information that pertains to the whole page and is of the highest priority. Use Callout instead.
- When interacting with the SlimBanner is required for the user to proceed with a task or flow. Use Modal instead.
- When describing the function of an interactive element that doesn’t have a text label. Use Tooltip instead.
- When calling a users attention to a feature for the first time. Use Popover instead.
Best practices
Use for messages generated by the system that stay persistent on a surface
Use for messages generated as an immediate response to user interaction. Instead, use [Toast]/toast) for ephemeral messages, and Modal for a message that remains on the screen until it’s dismissed by a user.
Place SlimBanner near elements of a section that it most relates to
Place SlimBanner at the top of a page and use them for highest-priority messaging. Use Callout instead
Use "bare" SlimBanners for dense interfaces where space is an issue.
Use a regular SlimBanner with a background for dense interfaces where space is an issue.
Accessibility
Labels
iconAccessibilityLabel
requires a short, descriptive label for screen readers. This label should communicate the intent of the icon, such as "Success", “Error”, “Info” or “Warning”. Also, if using dismissButton
or primaryAction
, their respective accessibilityLabel
s must be used. All labels should be localized.
Localization
Remember to localize message
, helperLink
and iconAccessibilityLabel
.
Variants
Neutral
Neutral SlimBanners are intended for Pinner interfaces where Pins and Boards take precedent or where we want to limit the use of color in the design.
import { Box, SlimBanner } from 'gestalt'; export default function Example() { return ( <Box padding={8} height="100%" display="flex" alignItems="center" justifyContent="center" > <SlimBanner message="Your total audience includes all users who have seen or engaged with any of your Pins in the last 30 days." /> </Box> ); }
Info
Info SlimBanners communicate helpful messages or guidance to users about a feature or section.
import { Box, Flex, SlimBanner } from 'gestalt'; export default function Example() { return ( <Box padding={8} height="100%" display="flex" alignItems="center" justifyContent="center" > <Flex direction="column" gap={{ column: 5, row: 0 }} width="100%"> <SlimBanner type="info" iconAccessibilityLabel="Info" message="Idea Pins are now available across platforms." /> <SlimBanner type="infoBare" iconAccessibilityLabel="Info" message="Idea Pins are now available across platforms." /> </Flex> </Box> ); }
Recommendation
Recommendation SlimBanners inform people of quick things they can do to improve their experience.
import { Box, Flex, SlimBanner } from 'gestalt'; export default function Example() { return ( <Box padding={8} height="100%" display="flex" alignItems="center" justifyContent="center" > <Flex direction="column" gap={{ column: 5, row: 0 }} width="100%"> <SlimBanner type="recommendation" iconAccessibilityLabel="Recommendation" message="Advertise with confidence! When you run ads on Pinterest, you'll find recommendations to improve them here." /> <SlimBanner type="recommendationBare" iconAccessibilityLabel="Recommendation" message="Advertise with confidence! When you run ads on Pinterest, you'll find recommendations to improve them here." /> </Flex> </Box> ); }
Success
Success SlimBanners communicate confirmation regarding an action within a larger flow.
import { Box, Flex, SlimBanner } from 'gestalt'; export default function Example() { return ( <Box padding={8} height="100%" display="flex" alignItems="center" justifyContent="center" > <Flex direction="column" gap={{ column: 5, row: 0 }} width="100%"> <SlimBanner type="success" iconAccessibilityLabel="Info" message="Your ads are doing great! Keep it up by using recommendations to optimize your ad spend." /> <SlimBanner type="successBare" iconAccessibilityLabel="Info" message="Your ads are doing great! Keep it up by using recommendations to optimize your ad spend." /> </Flex> </Box> ); }
Warning
Warning SlimBanners communicate cautionary messages to users. The SlimBanner should provide clear guidance on how to correct an issue and/or learn more about it. This is done via a link inside of the banner, or clear actions in the section that the banner refers to.
import { Box, Flex, SlimBanner } from 'gestalt'; export default function Example() { return ( <Box padding={8} height="100%" display="flex" alignItems="center" justifyContent="center" > <Flex direction="column" gap={{ column: 5, row: 0 }} width="100%"> <SlimBanner type="warning" iconAccessibilityLabel="Info" message="This feature is being sunset and will not be available after May 1, 2024." helperLink={{ text: 'Learn more.', accessibilityLabel: 'Learn more about deprecated features', href: 'http://www.pinterest.com', onClick: () => {}, }} /> <SlimBanner type="warningBare" iconAccessibilityLabel="Info" message="This feature is being sunset and will not be available after May 1, 2024." helperLink={{ text: 'Learn more.', accessibilityLabel: 'Learn more about deprecated features', href: 'http://www.pinterest.com', onClick: () => {}, }} /> </Flex> </Box> ); }
Error
Error SlimBanners inform users of problems that require immediate action to correct. Further actions on the page might be blocked if users don't correct the problems. The SlimBanner should also provide clear guidance on how to correct the issue and/or learn more about it. This is done via a link inside of the banner, or clear actions in the section that the banner refers to.
import { Box, Flex, SlimBanner } from 'gestalt'; export default function Example() { return ( <Box padding={8} height="100%" display="flex" alignItems="center" justifyContent="center" > <Flex direction="column" gap={{ column: 5, row: 0 }} width="100%"> <SlimBanner type="error" iconAccessibilityLabel="Info" message="There are issues with your account." helperLink={{ text: 'Go to account', accessibilityLabel: 'Go to your account', href: 'http://www.pinterest.com', onClick: () => {}, }} /> <SlimBanner type="errorBare" iconAccessibilityLabel="Info" message="There are issues with your account." helperLink={{ text: 'Go to account', accessibilityLabel: 'Go to your account', href: 'http://www.pinterest.com', onClick: () => {}, }} /> </Flex> </Box> ); }
Compact
For dense interfaces and placement inline, next to blocks of text, set SlimBanner to its compact type: “infoBare”, “successBare”, “warningBare”, “errorBare”, “recommendationBare“.
import { Box, Flex, SlimBanner } from 'gestalt'; export default function Example() { return ( <Box padding={8} height="100%" display="flex" alignItems="center" justifyContent="center" > <Flex direction="column" gap={{ column: 5, row: 0 }} width="100%"> {[ 'infoBare', 'successBare', 'warningBare', 'errorBare', 'recommendationBare', ].map((type) => ( <SlimBanner key={type} type={type} iconAccessibilityLabel={type} message="This is a compact SlimBanner." /> ))} </Flex> </Box> ); }
Message
The message
prop accepts either a string or Text. Use a string for simple messages without any visual style. SlimBanner will handle the message style and adherence to design guidelines. If a message with more complex style is required, such as bold text or inline links, use Text to wrap your message with any additional Text or Link usages contained within.
The SlimBanner message
string can be complemented with a helperLink
. When passing a Text component, helperLink
isn't rendered to prevent unnecessary visual load.
Due to localization constraints, the contents of message
and helperLink
cannot belong to the same sentence. They must be independent sentences separated by a period. Don't attempt to construct a compound sentence using message
and helperLink
.
import { Box, Flex, Link, SlimBanner, Text } from 'gestalt'; export default function Example() { return ( <Box padding={8}> <Flex direction="column" gap={6}> <Text weight="bold">Simple message string with helperText</Text> <SlimBanner type="info" message="This ad group is part of a campaign that is using campaign budget optimization. Changes to schedule or budget must be made at the campaign level." iconAccessibilityLabel="Information" helperLink={{ text: 'Learn more', accessibilityLabel: 'Learn more about campaign budget optimization', href: 'http://www.pinterest.com', onClick: () => {}, }} /> <Text weight="bold">Rich message with Text component</Text> <SlimBanner type="recommendation" message={ <Text inline> {' '} The campaign{' '} <Text inline weight="bold"> Back to School </Text>{' '} is regularly hitting its{' '} <Link display="inline" href=""> daily cap </Link> . Consider raising daily caps to increase scale for a similar CPC and CTR. </Text> } primaryAction={{ accessibilityLabel: 'Increase spend', label: 'Increase spend', onClick: () => {}, role: 'button', }} dismissButton={{ accessibilityLabel: 'Dismiss banner', onDismiss: () => {}, }} iconAccessibilityLabel="Recommendation" /> </Flex> </Box> ); }
Primary action
SlimBanners can have a primary action. This action can be a Link, by specifying the href
property, or a Button, when no href
is supplied.
SlimBanner actions with link interaction can be paired with GlobalEventsHandlerProvider. See GlobalEventsHandlerProvider to learn more about link navigation.
For example, “Learn more” may link to a separate documentation site, while “Apply now” could be a button that opens a Modal with an application flow. Be sure to localize the labels of the actions.
If needed, actions can become disabled after clicking by setting disabled: true
in the action data.
Note that actions are not available on compact ("___Bare" type) SlimBanners.
import { Box, SlimBanner } from 'gestalt'; export default function Example() { return ( <Box padding={8} height="100%" display="flex" alignItems="center" justifyContent="center" > <SlimBanner type="info" message="This ad group is part of a campaign that is using campaign budget optimization. Changes to schedule or budget must be made at the campaign level." iconAccessibilityLabel="Information" primaryAction={{ accessibilityLabel: 'Learn more about campaign budget optimization', label: 'Learn more', onClick: () => {}, role: 'button', }} /> </Box> ); }
Dismissible
dismissButton
can be used when SlimBanner doesn't indicate a persistent state. This will most commonly be used in type="info"
SlimBanners.
Don't use dismiss buttons in the following cases:
- There is a persistent account or page status that the user must address.
- The user must access SlimBanner's information again in order to perform a task.
Note that compact ("___Bare" type) SlimBanners are not dismissible.
import { Box, SlimBanner } from 'gestalt'; export default function Example() { return ( <Box padding={8} height="100%" display="flex" alignItems="center" justifyContent="center" > <SlimBanner type="info" message="This ad group is part of a campaign that is using campaign budget optimization. Changes to schedule or budget must be made at the campaign level." iconAccessibilityLabel="Information" dismissButton={{ accessibilityLabel: 'Dismiss banner', onDismiss: () => {}, }} /> </Box> ); }
Responsive
SlimBanner is responsive to different viewport breakpoints.
Therefore, SlimBanner behavior relies on the window size and requires SlimBanner to be used on a full-window width to correctly respond to different breakpoints.
SlimBanner doesn't depend on DeviceTypeProvider to display a mobile view; instead, it adjusts to the smallest viewport breakpoint. The example below forces a mobile viewport width to render SlimBanner at that particular viewport.
import React from 'react'; import { Box, SlimBanner } from 'gestalt'; export default function ResponsiveExample() { return ( <Box padding={8}> <SlimBanner type="info" message="This ad group is part of a campaign that is using campaign budget optimization. Changes to schedule or budget must be made at the campaign level." iconAccessibilityLabel="Information" dismissButton={{ accessibilityLabel: 'Dismiss banner', onDismiss: () => {}, }} primaryAction={{ accessibilityLabel: 'Learn more about campaign budget optimization', label: 'Learn more', onClick: () => {}, role: 'button', }} /> </Box> ); }
Writing
- Use succinct and scannable language that clearly conveys information to the user without being overly clever or technical
- Consider internationalization and how other languages may be constrained
- Write messages that are wordy and take up a lot of space
- For warnings and errors, exclamation points if the tone isn’t celebratory, for example: “Update your account!”
Component quality checklist
Quality item | Status | Status description |
---|---|---|
Figma Library | Ready | Component is available in Figma for web and mobile web. |
Responsive Web | Ready | Component responds to changing viewport sizes in web and mobile web. |
Related
Upsell
An Upsell is used to market new features or to encourage a user to try recommendations.
Callout
Callouts are used at the top-most level of a page to communicate highest-priority information that applies to the entire page or surface. Callouts can be dismissed and are also actionable.
Toast
Toast provides feedback shortly after a user interaction, like a confirmation that appears when a Pin has been saved. Unlike Upsells and SlimBanners, toasts overlay Page content. They also automatically disappear after a certain amount of time without being dismissed by the user.
Tooltip
Tooltip provides helpful information regarding an interactive UI element, typically an IconButton. It is displayed on hover of a UI element, and disappears on mouse out.