# @anypoint-web-components/anypoint-switch

> A toggle button styled for Material Design and Anypoint platform.

Latest version **0.1.13** (published 2023-06-16) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @anypoint-web-components/anypoint-switch
pnpm add @anypoint-web-components/anypoint-switch
yarn add @anypoint-web-components/anypoint-switch
bun add @anypoint-web-components/anypoint-switch
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.13 |
| Published | 2023-06-16 |
| First published | 2019-09-11 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 23.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Pawel Uchida-Psztyc |
| Maintainers | jarrodek, twoplustwoone, lbauret, carowright |
| Keywords | api-components, anypoint-elements, switch, ui-components |

## Links

- npm: https://www.npmjs.com/package/@anypoint-web-components/anypoint-switch
- Repository: https://github.com/anypoint-web-components/anypoint-switch
- Homepage: https://github.com/anypoint-web-components/anypoint-switch#readme
- Issues: https://github.com/anypoint-web-components/anypoint-switch/issues
- npm.io page: https://npm.io/package/@anypoint-web-components/anypoint-switch

## Dependencies (3)

- [lit-element](https://npm.io/package/lit-element.md) ^2.5.1
- [@anypoint-web-components/anypoint-form-mixins](https://npm.io/package/@anypoint-web-components/anypoint-form-mixins.md) ^1.3.1
- [@anypoint-web-components/anypoint-control-mixins](https://npm.io/package/@anypoint-web-components/anypoint-control-mixins.md) ^1.2.0

## Alternatives

- [@progress/kendo-ooxml](https://npm.io/package/@progress/kendo-ooxml.md) — 152.1K weekly downloads
- [@progress/kendo-react-ripple](https://npm.io/package/@progress/kendo-react-ripple.md) — 8.0K weekly downloads
- [@progress/kendo-react-orgchart](https://npm.io/package/@progress/kendo-react-orgchart.md) — 4.3K weekly downloads
- [@praxisui/dynamic-fields](https://npm.io/package/@praxisui/dynamic-fields.md) — 2.4K weekly downloads
- [@progress/kendo-vue-listbox](https://npm.io/package/@progress/kendo-vue-listbox.md) — 932 weekly downloads

## Recent versions

- 0.1.13 (latest) — 2023-06-16
- 0.1.12 — 2021-11-23
- 0.1.11 — 2021-10-15
- 0.1.10 — 2021-05-31
- 0.1.9 — 2021-05-10
- 0.1.8 — 2021-05-10
- 0.1.7 — 2021-05-06
- 0.1.6 — 2021-03-30
- 0.1.5 — 2021-03-02
- 0.1.4 — 2020-05-29
- 0.1.3 — 2019-09-17
- 0.1.2 — 2019-09-12
- 0.1.1 — 2019-09-12
- 0.1.0 — 2019-09-11

## README

# Deprecated

This component has been moved to `anypoint-web-components/awc`.

-----

Switches toggle the state of a single setting on or off. They are the preferred way to adjust settings on mobile.

This component is based on Material Design switch and adjusted for Anypoint platform components.

Anypoint web components are set of components that allows to build Anypoint enabled UI in open source projects.

[![Published on NPM](https://img.shields.io/npm/v/@anypoint-web-components/anypoint-switch.svg)](https://www.npmjs.com/package/@anypoint-web-components/anypoint-switch)

[![tests](https://github.com/anypoint-web-components/anypoint-switch/actions/workflows/deployment.yml/badge.svg)](https://github.com/anypoint-web-components/anypoint-switch/actions/workflows/deployment.yml)

## Usage

### Installation

```sh
npm install --save @anypoint-web-components/anypoint-switch
```

### In an html file

```html
<html>
  <head>
    <script type="module">
      import './node_modules/@anypoint-web-components/anypoint-switch/anypoint-switch.js';
    </script>
  </head>
  <body>
    <anypoint-switch>on/of</anypoint-switch>
    <script>
    {
      document.querySelector('anypoint-switch').onchange = () => {
        // ...
      };
    }
    </script>
  </body>
</html>
```

### In a LitElement

```js
import { LitElement, html } from 'lit-element';
import '@anypoint-web-components/anypoint-switch/anypoint-switch.js';

class SampleElement extends PolymerElement {
  render() {
    return html`
    <anypoint-switch
      .checked="${this.checked}"
      @change="${this._switchHandler}">on/off</anypoint-switch>
    `;
  }

  _switchHandler(e) {
    this.checked = e.detail.value;
  }
}
customElements.define('sample-element', SampleElement);
```

## Development

```sh
git clone https://github.com/anypoint-web-components/anypoint-switch
cd anypoint-switch
npm install
```

### Running the demo locally

```sh
npm start
```

### Running the tests

```sh
npm test
```

---
_Source: https://npm.io/package/@anypoint-web-components/anypoint-switch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
