spin.js

  • Version 4.1.2
  • Published
  • 11.9 kB
  • No dependencies
  • MIT license

Install

npm i spin.js
yarn add spin.js
pnpm add spin.js

Overview

A spinning activity indicator

Index

Classes

class Spinner

class Spinner {}

    constructor

    constructor(opts?: SpinnerOptions);

      property el

      el: HTMLElement;
      • The Spinner's HTML element - can be used to manually insert the spinner into the DOM

      method spin

      spin: (target?: HTMLElement) => this;
      • Adds the spinner to the given target element. If this instance is already spinning, it is automatically removed from its previous target by calling stop() internally.

      method stop

      stop: () => this;
      • Stops and removes the Spinner. Stopped spinners may be reused by calling spin() again.

      Interfaces

      interface SpinnerOptions

      interface SpinnerOptions {}

        property animation

        animation?: string;
        • The animation name used for the spinner lines. Defaults to 'spinner-line-fade-default'.

        property className

        className?: string;
        • The CSS class to assign to the spinner

        property color

        color?: string | string[];
        • A CSS color string, or array of strings to set the line color

        property corners

        corners?: number;
        • Corner roundness (0..1)

        property direction

        direction?: number;
        • 1: clockwise, -1: counterclockwise

        property fadeColor

        fadeColor?: string | string[];
        • A CSS color string, or array of strings to set the color that lines will fade to. Defaults to transparent.

        property left

        left?: string;
        • Left position relative to parent (defaults to 50%)

        property length

        length?: number;
        • The length of each line

        property lines

        lines?: number;
        • The number of lines to draw

        property position

        position?: string;
        • Element positioning

        property radius

        radius?: number;
        • The radius of the inner circle

        property rotate

        rotate?: number;
        • The rotation offset

        property scale

        scale?: number;
        • Scales overall size of the spinner

        property shadow

        shadow?: boolean | string;
        • Whether to render the default shadow (boolean). A string can be used to set a custom box-shadow value.

        property speed

        speed?: number;
        • Rounds per second

        property top

        top?: string;
        • Top position relative to parent (defaults to 50%)

        property width

        width?: number;
        • The line thickness

        property zIndex

        zIndex?: number;
        • The z-index (defaults to 2000000000)

        Package Files (2)

        Dependencies (0)

        No dependencies.

        Dev Dependencies (6)

        Peer Dependencies (0)

        No peer dependencies.

        Badge

        To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

        You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/spin.js.

        • Markdown
          [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/spin.js)
        • HTML
          <a href="https://www.jsdocs.io/package/spin.js"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>