Loading

The loading component is used to indicate to merchants that a page is loading or an upload is processing.

Examples

Use to indicate that the page is loading.

Drag to resize example

Required components

The loading component must be wrapped in the frame component or used in an embedded application.


Use in an embedded application

Passing an API key to the app provider component causes the loading component to delegate to the Shopify App Bridge instead of rendering as it would in a stand-alone application.

class EmbeddedAppLoadingExample extends React.Component {
  state = {
    loading: false,
  };

  render() {
    const loadingMarkup = this.state.loading && <Loading />;

    return <AppProvider apiKey="YOUR_API_KEY">{loadingMarkup}</AppProvider>;
  }
}

Best practices

The loading component should:

  • Indicate that the page requested is loading.
  • Indicate that an upload has started and the action will soon complete.
  • Be used to give feedback for an entire page load or a page mutation like saving a product.
  • Be used alongside a component or page element that contains aria-busy to represent what is loading.

Content guidelines

Accessibility label

The loading accessibility label should:

  • Accurately explain the state of the requested action. For example, “Loading your search results”.
  • Use as few words as possible to describe the state.