Anchor Design System

Spinner3.0

Spinner express an unspecified wait time or display the length of a process.

Installation

npm i @tryg/ui-library

Usage

Individual only imports the desired component, and only needs to be included once within the application. Which is beneficial to keep the application size small.

Webcomponent
<script type="module">
  import { defineCustomElement } from '@tryg/ui-library/dist/components/anchor-spinner';
  defineCustomElement();
</script>
<anchor-spinner />

Global only needs to be defined once in the application, but it will import all components even the ones that are not in use..

Webcomponent
<script type="module">
  import { defineCustomElements } from '@tryg/ui-library/dist/loader';
  defineCustomElements();
</script>
<anchor-spinner />

Note: Spinner adds Loading as aria-label by default. This is required for accessibility. You can change it by passing a label or aria-label prop.

Sizes

Pass the size prop with value xsmall. small. medium, large or xlarge to display the spinner with different sizes.

Webcomponent
<anchor-spinner size="xsmall"></anchor-spinner>
<anchor-spinner size="small"></anchor-spinner>
<anchor-spinner size="medium"></anchor-spinner>
<anchor-spinner size="large"></anchor-spinner>
<anchor-spinner size="xlarge"></anchor-spinner>

Colors

The spinner will be colored by 'currentColor' of its parent element. If you want to set the color of the spinner specifically, you can set the text color of the parent element or directly for the Spinner.

Webcomponent
<style>
  body > :nth-child(1) {color:red;}
  body > :nth-child(2) {color:green;}
  body > :nth-child(3) {color:blue;}
  body > :nth-child(4) {color:yellow;}
  body > :nth-child(5) {color:fuchsia;}
</style>
<anchor-spinner size="xsmall"></anchor-spinner>
<anchor-spinner size="small"></anchor-spinner>
<anchor-spinner size="medium"></anchor-spinner>
<anchor-spinner size="large"></anchor-spinner>
<anchor-spinner size="xlarge"></anchor-spinner>

Stroke width

Webcomponent
<anchor-spinner stroke-width="20" />

You shouldn't change this from it's default but we've included the option for the sake of flexibility.

API

Spinner

Properties

PropertyAttributeDescriptionTypeDefault
sizesizeWe recommend controlling the size of the Spinner with the parent container. Size option included for the sake of flexibility."large" | "medium" | "small" | "xlarge" | "xsmall"undefined
strokeWidthstroke-widthYou shouldn't change this from it's default but we've included the option for the sake of flexibilitynumber7

CSS Custom Properties

NameDescription
--animationDEPRECATED: kept for backwards compatibility, but will be removed by April 2024
--durationDEPRECATED: kept for backwards compatibility, but will be removed by April 2024
--end-rotationDEPRECATED: kept for backwards compatibility, but will be removed by April 2024
--pathDEPRECATED: kept for backwards compatibility, but will be removed by April 2024
--spinner-animationSet the animation properties of the spinner.
--spinner-colorSet the path color of the spinner.
--spinner-durationSet the duration of the spinner animation.
--spinner-end-rotationSet the ending rotation of the spinner.
--spinner-start-rotationSet the starting rotation of the spinner.
--start-rotationDEPRECATED: kept for backwards compatibility, but will be removed by April 2024

Dependencies

Used by

Graph


Built with StencilJS

On this page