# @ayunoshev/spinner-button

> Spinner button web component

Latest version **0.1.15** (published 2020-01-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ayunoshev/spinner-button
pnpm add @ayunoshev/spinner-button
yarn add @ayunoshev/spinner-button
bun add @ayunoshev/spinner-button
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.15 |
| Published | 2020-01-02 |
| First published | 2019-10-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 408 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Alexey Yunoshev |
| Maintainers | ayunoshev |
| Keywords | spinner, button, web-component |

## Links

- npm: https://www.npmjs.com/package/@ayunoshev/spinner-button
- Repository: https://github.com/alexey-yunoshev/spinner-button
- Homepage: https://github.com/alexey-yunoshev/spinner-button#readme
- Issues: https://github.com/alexey-yunoshev/spinner-button/issues
- npm.io page: https://npm.io/package/@ayunoshev/spinner-button

## Recent versions

- 0.1.15 (latest) — 2020-01-02
- 0.1.14 — 2019-11-02
- 0.1.13 — 2019-10-31
- 0.1.12 — 2019-10-30
- 0.1.11 — 2019-10-29
- 0.1.10 — 2019-10-29
- 0.1.10-beta.0 — 2019-10-29
- 0.1.9 — 2019-10-29
- 0.1.8 — 2019-10-29
- 0.1.6 — 2019-10-29
- 0.1.5 — 2019-10-29
- 0.1.4 — 2019-10-28
- 0.1.3 — 2019-10-28
- 0.1.2 — 2019-10-28
- 0.1.1 — 2019-10-28
- … 1 more at https://npm.io/package/@ayunoshev/spinner-button/versions

## README

# Spinner button web component

![Spinner demo](demo/demo.gif)

[Codepen](https://codepen.io/alexey-yunoshev/pen/ZEEJmKJ)


### Installation
```shell script
$ npm install @ayunoshev/spinner-button
```

### Usage
To stylize, pass some or all of the custom properties from the first example.
To activate spinner programmatically, use method `activate()`, to stop spinning -
`disactivate()`. See [Codepen](https://codepen.io/alexey-yunoshev/pen/ZEEJmKJ)


#### With ES modules
```html
<!doctype html>
<html>
<head>
  <title>Example</title>
  <script type="module">
      import {registerSpinnerButtonComponent} from "./node_modules/@ayunoshev/spinner-button/dist/index.js";

      registerSpinnerButtonComponent();
      registerSpinnerButtonComponent('spinner-button');
  </script>
  <style>
    .my-style {
      --spinner-button-background-color: black;
      --spinner-button-background-color--disabled: black;
      --spinner-button-border-color: #FF1569;
      --spinner-button-text-color: #FF1569;
      --spinner-button-text-color--disabled: #1F1F1F;
      --spinner-button-inner-spinner-color: #FF1569;
      --spinner-button-outer-spinner-color: #FF1569;
    }
  </style>
</head>
<body
    style="background-color:black;
           display: grid;
           grid-template-columns: repeat(3, max-content);
           grid-gap: 20px">

<app-spinner-button id="btn">Call api</app-spinner-button>
<spinner-button class="my-style">Submit</spinner-button>

<script>
    document.getElementById('btn').addEventListener('click', () => {
        console.log('doing something async...')
    });
</script>

</body>
</html>
```

#### With Angular
In `main.ts`: 
```typescript
import {registerSpinnerButtonComponent} from '@ayunoshev/spinner-button';

registerSpinnerButtonComponent();
```

And then in the module in which you're going to use the component:
```typescript
import {CUSTOM_ELEMENTS_SCHEMA, NgModule} from '@angular/core';
@NgModule({
  schemas: [
    CUSTOM_ELEMENTS_SCHEMA,
  ]
})
export class SomeModule {
}
```

Inside some component template of that module:
```html
<app-spinner-button [attr.disabled]="!form.valid">Submit
</app-spinner-button>
```

---
_Source: https://npm.io/package/@ayunoshev/spinner-button · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
