To add the Spinner
component to your app:
1 2import { Spinner } from '@forge/react';
A spinner is an animated spinning icon that lets users know that content is being loaded.
Name | Type | Required | Description |
---|---|---|---|
appearance | "inherit" | "invert" | No | You can use this to invert the current theme. This is useful when you are displaying a spinner on a background that is not the same background color scheme as the main content. |
delay | number | No | Delay the intro animation of the spinner. This is not to be used to avoid quick flickering of the spinner. The spinner will automatically fade in and takes ~200ms to become partially visible. This prop can be helpful for long delays such as 500-1000ms for when you want to not show a spinner until some longer period of time has elapsed. |
label | string | No | Describes what the spinner is doing for assistive technologies. For example, "loading", "submitting", or "processing". |
size | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | number | No | Size of the spinner. The available sizes are xsmall , small , medium , large , and xlarge . For most use cases, we recommend medium . |
The default form of the spinner.
1 2const SpinnerExample = () => <Spinner label="loading" />
Use the invert
appearance when using the spinner on a dark background.
1 2const SpinnerInvertExample = () => <Spinner label="loading" appearance="invert" />
The spinner can be set to different sizes. medium
is the default size and is recommended for most use cases.
1 2const SpinnerSizeExample = () => { return ( <Inline> <Spinner size="xsmall" /> <Spinner size="small" /> <Spinner size="medium" /> <Spinner size="large" /> <Spinner size="xlarge" /> <Spinner size={80} /> </Inline> ); }
When using the Spinner
component, we recommend keeping the following accessibility considerations in mind:
Rate this page: