The Backdrop component provides a clean and efficient way to overlay a backdrop layer to indicate that the background content is temporarily inactive or inaccessible. This component is primarily used in conjunction with modals, loading indicators, or popovers.

Function

The Backdrop component helps achieve the following functions:

  • Modal Backdrop: Provides a visual overlay when a modal is open, dimming the background and focusing attention on the modal.
  • Loading Indicator: Can be used with a loading spinner or indicator to notify users that content is being processed.
  • Popover or Custom Select: Useful for making a popover or custom select component more noticeable by blocking interaction with the background.

Props

Props of the Fade component are also available.

NameTypeDefaultDescription
open*bool-If true, the component is shown.
childrennode-The content of the component.
classesobject-Override or extend the styles applied to the component. See CSS classes API below for more details.
componentelementType-The component used for the root node. Either a string to use an HTML element or a component.
componentsRoot?: elementType The components used for each slot inside.Deprecated — Use the slots prop instead. This prop will be removed in v7. See Migrating from deprecated APIs for more details.
componentsPropsroot?: object The extra props for the slot components. You can override the existing props or add new ones.Deprecated — Use the slotProps prop instead. This prop will be removed in v7.
invisibleboolfalseIf true, the backdrop is invisible, useful for popovers or custom selects.
slotPropsroot?: func | object, transition?: func | objectThe props used for each slot inside the component.
slotsroot?: elementType, transition?: elementTypeThe components used for each slot inside.
sxArray<func | object | bool> | func | object-The system prop for defining system overrides and additional CSS styles. See the sx page for more details.
TransitionComponentelementTypeFadeThe component used for the transition. Refer to the guide for component requirements.
transitionDurationnumber | appear?: number, enter?: number, exit?: number -Duration for the transition, in milliseconds. Specify a single timeout or individual times.

Labeling

The Backdrop component provides a clear visual indication that content is temporarily inaccessible. It is typically used for displaying temporary UI elements, such as dialogs or loading indicators. It's important to ensure that the backdrop is not intrusive and is used in the appropriate context.

It is also essential to consider accessibility and usability when implementing a backdrop. Ensure that users can interact with the content behind the backdrop when it is dismissed or closed, and ensure proper keyboard and screen reader support.

Responsive Design

The Backdrop component can be easily integrated into responsive designs, ensuring that it adapts to different screen sizes and layouts. It should be used in a way that works well on mobile devices, tablets, and desktops. Consider the size of the overlay and how it impacts the user experience across devices.

You can adjust the backdrop's visibility, duration, and animation to suit different screen sizes and provide a smooth user experience on all devices.