# @uxland/uxl-switch

> UXLand - Switch component

Latest version **2.0.0** (published 2019-08-16) · 0 weekly downloads

## Install

```sh
npm install @uxland/uxl-switch
pnpm add @uxland/uxl-switch
yarn add @uxland/uxl-switch
bun add @uxland/uxl-switch
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2019-08-16 |
| First published | 2019-02-27 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 23.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | UXLand |
| Maintainers | avizcaino, uxland-admin |
| Keywords | polymer, web components |

## Links

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

## Dependencies (2)

- [lit-element](https://npm.io/package/lit-element.md) ^2.0.1
- [@polymer/polymer](https://npm.io/package/@polymer/polymer.md) ^3.0.0

## Recent versions

- 2.0.0 (latest) — 2019-08-16
- 2.0.0-beta.1 (beta) — 2019-08-14
- 1.0.11 — 2019-07-26
- 1.0.10 — 2019-07-12
- 1.0.9 — 2019-03-21
- 1.0.8 — 2019-03-20
- 1.0.7 — 2019-03-20
- 1.0.6 — 2019-03-20
- 1.0.5 — 2019-03-15
- 1.0.4 — 2019-03-15
- 1.0.3 — 2019-03-15
- 1.0.2 — 2019-02-27
- 1.0.1 — 2019-02-27
- 1.0.0 — 2019-02-27

## README

# \<uxl-switch\>

##### What is?

It is a web component that allows you to create a toggle switch input.

##### How Install

```
npm i --save @uxland/uxl-switch
```

##### How to use?

import the component and use it in the html with the `uxl-switch` tag

```
import "@uxland/uxl-switch";

<body>
    <uxl-switch></uxl-switch>
</body>
```

### Attributes availables

| Attribute      | Description                                                                        | Default               |
| -------------- | ---------------------------------------------------------------------------------- | --------------------- |
| `active`       | Status of the switch                                                               | `false` (boolean)     |
| `activeName`   | Value of active text label                                                         | `"Active"` (string)   |
| `inactiveName` | Value of inactive text label                                                       | `"Inactive"` (string) |
| `enabled`      | If true, the uxl-switch is enable to change, otherwhise the uxl-switch is disabled | `true` (boolean)      |

### Styling

The following custom properties and mixins are available for styling:

| Custom property                                   | Description                                          | Default   |
| ------------------------------------------------- | ---------------------------------------------------- | --------- |
| `--uxl-switch-width`                              | Width of the uxl-switch                              | `200px`   |
| `--uxl-switch-border-color`                       | Border color of component wrapper                    | `#e0e0e0` |
| `--uxl-switch-option-background-color`            | Background color of the options                      | `#ffffff` |
| `--uxl-switch-option-padding`                     | Padding of the options                               | `8px`     |
| `--uxl-switch-text-color`                         | Default text color when option is not selected       | `#616161` |
| `--uxl-switch-font-size`                          | Font size of text options                            | `16px`    |
| `--uxl-switch-active-selected-background-color`   | Background color of active option when is selected   | `#81c784` |
| `--uxl-switch-inactive-selected-background-color` | Background color of inactive option when is selected | `#ef5350` |
| `--uxl-switch-selected-text-color`                | Text when any option is selected                     | `#ffffff` |
| `--uxl-switch-active-border`                      | Border of active option                              | `0` |
| `--uxl-switch-active-border-selected`             | Border of active option when is selected             | `0` |
| `--uxl-switch-inactive-border`                    | Border of inactive option                            | `0` |
| `--uxl-switch-inactive-border-selected`           | Border of active option when is selected             | `0` |


### Events

| Events               | Description   |
| -------------------- | ------------- |
| `uxl-switch-changed` | Value changed |

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