Sheets are surfaces that allow users to view optional information or complete sub-tasks in a workflow while keeping the context of the current page. The most common example of Sheet displays content in a panel that opens from the side of the screen for the user to read or input information. Sheets have default, internal padding for content.

Props

Name
Type
Default
accessibilityDismissButtonLabel
Required
string
-

Supply a short, descriptive label for screen-readers as a text alternative to the Dismiss button. See the Accessibility section for more info.

accessibilitySheetLabel
Required
string
-

Supply a short, descriptive label for screen-readers to contextualize the purpose of Sheet. See the Accessibility section for more info.

onDismiss
Required
() => void
-

Callback fired when the Sheet is dismissed by clicking on the Dismiss button, pressing the ESC key, or clicking on the backdrop outside of the Sheet (if closeOnOutsideClick is true).

children
React.Node | (({| onDismissStart: () => void |}) => React.Node)
-

Supply the container element(s) or render prop that will be used as Sheet's main content. See the animation variant for info on how to add exit animations to Sheet content.

closeOnOutsideClick
boolean
true

Indicate whether clicking on the backdrop (gray area) outside of Sheet will automatically close it. See the outside click variant for more info.

React.Node | (({| onDismissStart: () => void |}) => React.Node)
-

Supply the container element(s) or render prop that will be used as Sheet's custom footer. See the footer variant for more info.

heading
string
-

The text used for Sheet's heading. Be sure to localize this text. See the heading variant for more info.

onAnimationEnd
({ animationState: "in" | "out" }) => void
-

Callback fired when the Sheet in/out animations end. See the animation variant to learn more.

size
"sm" | "md" | "lg"
"sm"

Determine the width of the Sheet component. See the size variant for more info.

subHeading
React.Node | (({| onDismissStart: () => void |}) => React.Node)
-

Supply the container element(s) or render prop that will be used as Sheet's sub-heading docked under the heading. See the sub-heading variant for more info.

Usage guidelines

When to Use
  • Performing an optional sub-task within a larger task.
  • Quick bulk edits on info from a Table.
  • Presenting help info while maintaining the current page and its context.
When Not to Use
  • Getting user confirmation on an action. Use a Modal instead.
  • Displaying system errors or notices. Consider a Callout instead.
  • Any time a separate, designated URL is desired.

Best practices

Do

Use Sheet for sub-tasks within a large workflow that are optional, like creating a new audience list while creating a campaign.

Do

Use Sheet for quick edits within libraries or tables of content where you expect users to be making multiple edits in one session.

Do

Use the same size Sheet on a product surface. For example, if filling out a form requires multiple Sheets to be opened to complete different subtasks, then all Sheets in that form should be the same width. When in doubt, pick the widest size needed for the entire flow.

Don't

Use Sheet for required tasks or main tasks, like logging in. Put those tasks within the content of the page instead.

Don't

Use Sheet if edits or sub-tasks require more than two steps. Bring users to a full page experience or consider using Modules to section out content.

Don't

Use Sheet to confirm actions or display alerts. Use a Modal or Toast instead.

Accessibility

Labels

  • accessibilityDismissButtonLabel: provides a short, descriptive label for screen readers as a text alternative to the Dismiss button. Populates the aria-label attribute on the Dismiss button.
  • accessibilitySheetLabel: provides a short, descriptive label for screen readers to contextualize the purpose of Sheet. Please don’t repeat the same text being passed in the heading prop, but instead provide something that summarizes the Sheet’s purpose. For instance, if the heading is "Pin Builder", the accessibilitySheetLabel can be "Create a new Pin". Populates the aria-label attribute on the entire dialog.
Edits made below will not be reflected in the example above, open the sandbox instead.

Focus management

When Sheet opens, focus should be placed on the first interactive element within the Sheet. When Sheet is closed, focus should be placed back on the button that triggered the Sheet.

Localization

Be sure to localize the heading, accessibilityDismissButtonLabel and accessibilitySheetLabel props. Note that localization can lengthen text by 20 to 30 percent.

Variants

Heading

As a default, Sheet consists of a heading and content passed as children. The heading of Sheet will have a drop shadow when content scrolls under it.

Edits made below will not be reflected in the example above, open the sandbox instead.

Sub-heading

A subHeading is a container that can be used for additional navigation or sub-text. The sub-heading sits at the top under the heading, and will always remain visible if the content scrolls.

Edits made below will not be reflected in the example above, open the sandbox instead.

The footer is used for Sheet tasks that require additional actions, such as submitting or deleting information.

Edits made below will not be reflected in the example above, open the sandbox instead.

Sizes

Sheet comes in 3 sizes: small (sm), medium (md), and large (lg).

  • Small Sheets (540px) are primarily used for displaying information or acting as a point to link to other content. They are the least commonly used.
  • Medium Sheets (720px) are the standard size offered for content.
  • Large Sheets (900px) should be used in cases where there may be columns of content or navigation where the additional space is required to keep the content at a comfortable reading width.

Preventing close on outside click

By default, users can click outside Sheet (on the overlay) to close it. This can be disabled by setting closeOnOutsideClick to false. This may be implemented in order to prevent users from accidentally clicking out of the Sheet and losing information they’ve entered. The ESC key can still be used to close the Sheet.

Animation

By default, Sheet animates in, with the initial render process from the entry-point, and out, when the ESC key is pressed, the header close button is pressed, or the user clicks outside of the Sheet. However, to trigger the exit-animation from other elements within the children or footer, the following render prop can be used:

({ onDismissStart }) => ( ... )

When using this render prop, just pass the argument onDismissStart to your exit-point action elements. In the example below, we've added the exit animation to the:

  • Close button (subHeading)
  • Right arrow icon red button (children)
  • Done red button (children)
  • Left arrow red icon button (children)
  • Close button (footer)

Sheet also provides onAnimationEnd, a callback that gets triggered at the end of each animation. The callback has access to animationState to identify the end of each 'in' and 'out' animation for cases where the two events trigger different responses..

Modal
For alerts, actions or acknowledgments that should block the user’s current flow, use Modal.

Toast
Toast provides feedback on an interaction. Toasts appear at the bottom of a desktop screen or top of a mobile screen, instead of being attached to any particular element on the interface.