Skip to content
Paste
UX Platform
Change the site theme
GitHub

Spinner

Twilio's Spinner component

Status
production
Version
7.0.2
Sources
Import from
@twilio-paste/core/spinner — or — @twilio-paste/spinner

Guidelines#

About Spinner#

The spinner is an icon component that can be used in situations where you would like to communicate a loading state to the user. It inherits a lot of properties from the Icon component.

Accessible animation

The spinner animation will automatically respect user preferences set at the operating system level via the prefers reduced motion API.

Examples#

Default#

The default Spinner settings are using the default icon size and color, which is designed to match our default text size and color.

Accessibility

You are required to set whether the Spinner is decorative or not, please follow the icon accessibility guidelines.

Loading

Sizing#

To resize the Spinner set a size prop. It will accept any valid icon size token as it's value. These are conveniently designed to be 1:1 to font sizing, e.g. font-size-40 can be paired with icon-size-40.

Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

Setting a color#

The Spinner, like any other icon, can be re-colored to meet your needs. Set an color in the same way you would with an icon.

Loading

Usage Guide#

API#

Installation#

yarn add @twilio-paste/spinner - or - yarn add @twilio-paste/core

Usage#

import {Spinner} from '@twilio-paste/spinner';
const Component = () => {
return <Spinner decorative={false} title="Loading" />;
};

Spinner Props#

as?: keyof JSX.IntrinsicElements

Changes the sematic element of the spinner wrapper.

decorative?: boolean

Whether or not the SVG is just visual flair or adds meaning to the page. Specifically for screenreaders to know whether to read out the title or not.

title?: string

The accessibility text that is read when screenreaders get to this component.

size?: IconSize

Used to change the size of the Spinner.

color?: TextColor

Sets the icon color to any of our text color tokens or currentColor, which inherits text color from the parent element.

delay?: number

Time delay in milliseconds of the animation.


Black lives matter.