# @ppci-mock/custom-input

> Custom Input

Latest version **1.4.24** (published 2019-12-17) · ISC license · 0 weekly downloads

## Install

```sh
npm install @ppci-mock/custom-input
pnpm add @ppci-mock/custom-input
yarn add @ppci-mock/custom-input
bun add @ppci-mock/custom-input
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.24 |
| Published | 2019-12-17 |
| First published | 2019-12-04 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 8.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Powerpeers |
| Maintainers | borai, franksevenhuysen |
| Keywords | custom, input |

## Links

- npm: https://www.npmjs.com/package/@ppci-mock/custom-input
- npm.io page: https://npm.io/package/@ppci-mock/custom-input

## Dependencies (3)

- [lit-element](https://npm.io/package/lit-element.md) ^2.1.0
- [@ppci-mock/styles](https://npm.io/package/@ppci-mock/styles.md) ^1.5.18
- [@open-wc/demoing-storybook](https://npm.io/package/@open-wc/demoing-storybook.md) ^0.3.0

## Recent versions

- 1.4.24 (latest) — 2019-12-17
- 1.4.22 — 2019-12-09
- 1.4.21 — 2019-12-09
- 1.4.20 — 2019-12-09
- 1.4.19 — 2019-12-05
- 1.4.18 — 2019-12-05
- 1.4.17 — 2019-12-05
- 1.4.16 — 2019-12-04
- 1.4.15 — 2019-12-04
- 1.4.14 — 2019-12-04
- 1.4.13 — 2019-12-04
- 1.4.12 — 2019-12-04
- 1.4.11 — 2019-12-04
- 1.4.9 — 2019-12-04

## README

# Input
### Table of contents
<ol>
  <li>
    <a href="#installation">Installation</a>
  </li>
  <li>
    <a href="#usage">Usage</a>
  </li>
   <li>
    <a href="#styling">Styling</a>
  </li>
  <li>
    <a href="#properties">Properties</a>
  </li>
   <li>
    <a href="#events">Events</a>
  </li>
</ol>

### Installation
#### NPM
```javascript
npm i @ppci-mock/custom-input

// Polyfill: https://lit-element.polymer-project.org/guide/use#polyfills
npm i --save-dev @webcomponents/webcomponentsjs
```

### Usage
#### Javascript
```javascript
import '@ppci-mock/custom-input'
```

#### Browser
```html
<!-- Default -->
<script type="module" src="https://cdn.jsdelivr.net/npm/@ppci-mock/custom-input/builds/index.min.js" />

<!-- Legacy -->
<script type="module" src="https://cdn.jsdelivr.net/npm/@ppci-mock/custom-input/builds/legacy.min.js" />

<!-- Component -->
<custom-input
  type=${String}
  name=${String}
  label=${String}
  placeholder=${String}
  @change=${Function}
  @change-delayed=${Function}
  ?checked=${Boolean}
></custom-input>
```

### Styling
We have a predefined powerpeers theme ready for you! Just add the
theme-powerpeers boolean attribute to your custom-button.

```html
<custom-input
  theme-powerpeers>
</custom-input>
```

Not completely satisfied with our powerpeers theme? Well you can do it yourself. We have
a set of css variables available for you. 

```css
custom-input {
  --input-padding: 8px 16px;
  --input-border: 1px solid #eeee;
  --input-border-radius: 8px;
  --input-color: gray;
  --input-background: white;
  --input-placeholder-color: gray;
  --input-focus-border: 1px solid blue;
}
```

### Properties
<table width="100%">
  <thead>
    <tr>
      <td>Property</td>
      <td>Type</td>
      <td>Description</td>
      <td>Possible Values</td>
    </tr>
  </thead>
  <tr>
    <td>type</td>
    <td>string</td>
    <td>Type of input field</td>
    <td>text, number, checkbox, etc.</td>
  </tr>
  <tr>
    <td>name</td>
    <td>string</td>
    <td>Name of the input field. Which could be used in a form as field identifier.</td>
    <td>first name, surname, email, etc.</td>
  </tr>
  <tr>
    <td>label</td>
    <td>string</td>
    <td>Label of the input field. Which is placed above the input field itself.</td>
    <td></td>
  </tr>
  <tr>
    <td>value</td>
    <td>string</td>
    <td>The value of the input field.</td>
    <td></td>
  </tr>
  <tr>
    <td>placeholder</td>
    <td>string</td>
    <td>Placeholder value. Visible when the input field is empty.</td>
    <td></td>
  </tr>
  <tr>
    <td>checked</td>
    <td>boolean</td>
    <td>If the checkbox is checked</td>
    <td>true/false</td>
  </tr>
</table>

### Events
<table width="100%">
  <thead>
    <tr>
      <td>Name</td>
      <td>Description</td>
      <td>Payload</td>
    </tr>
  </thead>
  <tr>
    <td>@change</td>
    <td>
      Every time something changes on the input field this event is triggered. 
      The name and value of the input field are passed in the detail section of the event. 
      
      The value in the response reflects the current state of the input field.
    </td>
    <td>```{ name: 'firstname', value: 'p' }```</td>
  </tr>
  <tr>
    <td>@change-delayed</td>
    <td>
      This is exactly like the change event. However, it's not triggered immediately after every 
      key change. It's delayed so that it is possible to capture more than one key change at once.
      
      This could be useful to prevent too many network requests on a search box.
    </td>
    <td>```{ name: 'firstname', value: 'powerpeers' }```</td>
  </tr>
</table>

---
_Source: https://npm.io/package/@ppci-mock/custom-input · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
