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

Web:

iOS:

Android:

A11y:

Props

Component props
Name
Type
Default
message
Required
string | React.Element<typeof Text>
-

Main content of SlimBanner. Content should be localized. See the Message variant to learn more.

dismissButton
{|
  accessibilityLabel: string,
  onDismiss: () => void,
|}
-

Adds a dismiss button to SlimBanner. See the Dismissible variant for more info.
The accessibilityLabel should follow the Accessibility guidelines.

Note that compact ("___Bare" type) SlimBanners are not dismissable.

{|
  accessibilityLabel: string,
  href: string,
  onClick?: ({|
    event: SyntheticMouseEvent<HTMLAnchorElement> | SyntheticKeyboardEvent<HTMLAnchorElement>,
    dangerouslyDisableOnNavigation: () => void,
  |}) => void,
  target?: null | "self" | "blank",
  text: string,
|}
-

Helper Link to be placed after the message. See the Message variant to learn more.

iconAccessibilityLabel
string
-

Label to describe the status icon’s purpose. See the Accessibility guidelines for details on proper usage.

primaryAction
{|
  accessibilityLabel: string,
  disabled?: boolean,
  href?: string,
  label: string,
  onClick?: ({|
    event:
      | SyntheticMouseEvent<HTMLButtonElement>
      | SyntheticMouseEvent<HTMLAnchorElement>
      | SyntheticKeyboardEvent<HTMLAnchorElement>
      | SyntheticKeyboardEvent<HTMLButtonElement>,
    dangerouslyDisableOnNavigation: () => void,
  |}) => void,
  rel?: "none" | "nofollow",
  target?: null | "self" | "blank",
|}
-

Main action for users to take on SlimBanner. If href is supplied, the action will serve as a link. See OnLinkNavigationProvider to learn more about link navigation.
If no href is supplied, the action will be a button.
The accessibilityLabel should follow the Accessibility guidelines.
See the Primary action variant to learn more.

Note that actions are not available on compact ("___Bare" type) SlimBanners.

type
"neutral"
| "error"
| "info"
| "warning"
| "success"
| "recommendation"
| "errorBare"
| "infoBare"
| "warningBare"
| "successBare"
| "recommendationBare"
-

The type of SlimBanner. See the variants to learn more.

Usage guidelines

When to use
  • 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 not to use
  • 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

Do

Use for messages generated by the system that stay persistent on a surface

Don't

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.

Do

Place SlimBanner near elements of a section that it most relates to

Don't

Place SlimBanner at the top of a page and use them for highest-priority messaging. Use Callout instead

Do

Use "bare" SlimBanners for dense interfaces where space is an issue.

Don't

Use a regular SlimBanner with a background for dense interfaces where space is an issue.

Do

Strive for using one SlimBanner per section instead of stacking. If SlimBanner must stack, errors and warnings take precedence.

Don't

Combine SlimBanners with other components like Callouts or Upsells.

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 accessibilityLabels 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.

Info

Info SlimBanners communicate helpful messages or guidance to users about a feature or section.

Recommendation

Recommendation SlimBanners inform people of quick things they can do to improve their experience.

Success

Success SlimBanners communicate confirmation regarding an action within a larger flow.

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.

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.

Compact

For dense interfaces and placement inline, next to blocks of text, set SlimBanner to its compact type: “infoBare”, “successBare”, “warningBare”, “errorBare”, “recommendationBare“.

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.

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 OnLinkNavigationProvider. See OnLinkNavigationProvider 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.

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.

Responsive

SlimBanner is responsive to different viewport breakpoints.

import React from 'react';
import { Box, SlimBanner } from 'gestalt';

export default function ResponsiveExample() {
  return (
    <Box padding={4}>
      <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: () => {},
        }}
      />
    </Box>
  );
}

Writing

Do
  • 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
Don't
  • 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

Component quality checklist
Quality item
Status
Status description
Figma Library
Partially ready
Component is live in Figma, however may not be available for all platforms.
Responsive Web
Ready
Component is available in code for web and mobile web.
iOS
Component is not currently available in code for iOS.
Android
Component is not currently available in code for Android.

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.