# vue2-input

> Vue2Input: Vue2 component

Latest version **0.0.14** (published 2018-11-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install vue2-input
pnpm add vue2-input
yarn add vue2-input
bun add vue2-input
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.14 |
| Published | 2018-11-30 |
| First published | 2018-07-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 4.2.0 |
| Dependencies | 0 |
| Unpacked size | 96.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | sanchit |
| Maintainers | san-kumar |
| Keywords | vue, bootstrap, Vue2Input, vue2-input |

## Links

- npm: https://www.npmjs.com/package/vue2-input
- Repository: https://github.com/san-kumar/vue2-input
- Issues: https://github.com/san-kumar/vue2-input/issues
- npm.io page: https://npm.io/package/vue2-input

## Alternatives

- [@sveltejs/kit](https://npm.io/package/@sveltejs/kit.md) — 2.2M weekly downloads
- [@atlaskit/theme](https://npm.io/package/@atlaskit/theme.md) — 402.0K weekly downloads
- [@tangle-network/brand](https://npm.io/package/@tangle-network/brand.md) — 10.0K weekly downloads
- [seneca](https://npm.io/package/seneca.md) — 7.4K weekly downloads
- [@bsb/base](https://npm.io/package/@bsb/base.md) — 7.2K weekly downloads

## Recent versions

- 0.0.14 (latest) — 2018-11-30
- 0.0.13 — 2018-11-10
- 0.0.12 — 2018-11-10
- 0.0.11 — 2018-11-10
- 0.0.10 — 2018-11-10
- 0.0.9 — 2018-11-10
- 0.0.8 — 2018-09-20
- 0.0.7 — 2018-09-01
- 0.0.4 — 2018-07-24
- 0.0.3 — 2018-07-21
- 0.0.2 — 2018-07-21
- 0.0.1 — 2018-07-21

## README

# Vue2Input
> Vue2Input Component for Vue 2.x

## Install

``` bash
    npm install vue2-input --save
```

## Demo

### For demo, please [see this fiddle](https://jsfiddle.net/superasn/8xqc21nd/) 

## Usage

*1\. Import the component*

```
import Vue2Input from 'vue2-input';
import {Vue2InputGroup} from 'vue2-input';
```

*2\.1 Use it globally*

```
Vue.use(Vue2Input);
```

*2\.2 Or use it locally*

```
components: {
    'vue2-input': Vue2Input,
    'vue2-input-group': Vue2InputGroup,
},
```

*3\. Update your app or template:*
```
<div>
...
<vue2-input></vue2-input>
...
</div>
```

## Properties / Methods

#### Vue2Input

- Properties   

     - **type:** text, email, url, textarea, select, checkbox, radio, ...
     
     - **label:** field caption
     
     - **name:** optional (for validation)
     
     - **placeholder**
     
     - **required**
     
     - **horizontal:** col-sm-2 col-md-3, etc for horiz layout
     
     - **help:** help text underneath
     
     - **min:** min length
     
     - **max:** max length
     
     - **scope:** scope for vee-validate (if two fields have same name)
     
     - **rows:** textarea
     
     - **options:** checkbox, select, radio (options => [{label: label, value: value}, ..] or ['val', 'val'..]
     
     - **inline:** true (place checkbox, radios horizontally)
     
     - **fixed:** fixed checkbox fields (array)
     
     - **readonly**
     
     - **labelClass**, inputClass, controlClass:
     
     - **size:** sm, lg (for form-control-sm)
     
     - **yes**-no: radio, select ['enabled', 'disabled'] => `options => [{label: 'enabled', value: true}, {label: 'disabled', value: false}]` 
     
     - **default:** sets defaults value of model
     
     - **prepend:** prepends text in front of text, textarea
     
     - **append:** appends text in after of text, textarea
     
     - **disabled**

- Methods:
    
    - **validate:** returns promise
     
#### Vue2InputGroup:

- Properties

    - **disabled:** Disables entire group of fields by putting a white overlay on top
    
- Methods:
    
    - **validate:** returns promise after validating all fields contained inside group
    
    - **getAllChildren:** returns array with all vue2-input fields (even nested)
            
## Example

    <template>
        <div>
            <form @submit.prevent="check('step1')" novalidate>
                <vue2-input type="textarea" rows="3" v-model="value.text" label="Your site name:" placeholder="My site" required min="3" help="(this is a test)" scope="step1"></vue2-input>
                <vue2-input type="email" v-model="value.email" label="Your email:" placeholder="My email" required help="(this is a test)" scope="step1"></vue2-input>
                <vue2-input type="password" v-model="value.password" label="Your password:" placeholder="Strict" required help="(this is a test)" scope="step1" :strict-password="true"></vue2-input>
    
                <vue2-input type="radio" required name="ok" v-model="value.radio" scope="step1"></vue2-input>
                <vue2-input type="checkbox" required :options="[{label: 'one', value: 1},{label: 'two', value: 2},]" v-model="value.checkbox" label="sure?" scope="step1"></vue2-input>
                <vue2-input type="checkbox" required :options="[{label: 'yes', value: true}]" v-model="value.agree" label="agree?" scope="step1"></vue2-input>
                <vue2-input type="select" required :options="[{label: 'one', value: 1},{label: 'two', value: 2},]" v-model="value.select" scope="step1"></vue2-input>
    
    
                <div class="card card-body">
                    <p>Horizontal</p>
    
                    <vue2-input type="text" horizontal="col-sm-3" v-model="value.text1" label="Your site name 2:" placeholder="My site" required min="3" help="(this is a test)" scope="step1"></vue2-input>
                    <vue2-input type="radio" :inline="false" required="" horizontal="col-sm-3" v-model="value.radio1" label="Yes or no?" scope="step1" help="that is the question"></vue2-input>
                </div>
    
                <hr>
    
                <button class="btn btn-primary" :disabledd="errors.any('step1')">btn</button>
    
            </form>
    
            <pre>value: {{value}}</pre>
        </div>
    </template>
    
    <script>
        import Vue from 'vue';
        import VeeValidate from 'vee-validate';
        import Vue2Input from '../src/index';
    
        Vue.use(VeeValidate);
    
        import './validator';
    
        export default {
            name: 'app',
            data() {
                return {
                    value: {}
                }
            },
            components: {
                Vue2Input
            },
            methods: {
                check() {
                    this.$validator.validateAll('step1')
                        .then((obj) => console.log("result: ", obj))
                        .catch((err) => console.log("error: ", err));
                }
            },
        }
    </script>
    

## Contributing
Contributions are welcome

## Build Setup

``` bash
# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build
```

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