Socket
Socket
Sign inDemoInstall

@maqe-vue/text-input

Package Overview
Dependencies
11
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @maqe-vue/text-input

The Vue2 component for text input


Version published
Maintainers
1
Created

Readme

Source

@maqe-vue/text-input

The Vue2 component for text-input

label-insde label-insde label-insde label-insde

See demo on: Storybook


Installation

NPM

Install the npm package.

npm install @maqe-vue/text-input --save
Register the component
import VmqInput from '@maqe-vue/text-input'
import '@maqe-vue/text-input/dist/style.css'

Vue.component('vmq-input', VmqInput)

Usage

Basic
<vmq-input v-model="input" type="text"/>

Lable style

<vmq-input
    v-model="input"
    type="text"
    label-style="label-inside"
/>

<vmq-input
    v-model="input"
    type="text"
    label-style="label-border"
/>

State

<vmq-input
    v-model="email"
    label-style="label-inside"
    :state="true"
    state-valid-text="You can use this email"
/>
<vmq-input
    v-model="email"
    label-style="label-inside"
    :state="false"
>
    <template v-slot:state-invalid-text>
        <span>
            Invalid
            <u>email</u>
        </span>
    </template>
</vmq-input>

API

Props
NameTypeDescriptiondefault
v-modelbind
typestring`textpassword`
containerClassstring
colorstring`namehex
label-stylestring`label-inside
labelstring
placeholderstring
state`booleannull`
state-valid-textstring
state-invalid-textstring
helper-textstring
icon-prepend`stringarray`
icon-append`stringarray`
disabledbooleanfalse
loadingbooleanfalse
clearablebooleanfalse
autofocusbooleanfalse
readonlybooleanfalse
trimbooleanfalse
timeoutnumberTimeout to trigger parent component in millisecond ex. 30000
regexstring`ENGLISH_ALPHABET_ONLYENGLISH_AND_NUMBER_ONLY
Slot
NameTypeDescriptiondefault
state-valid-text
state-invalid-text
icon-prependleft side icon
icon-appendright side icon
helper-text
Slot Example
<vmq-input v-model="input">
    <!-- custom icon-prepend -->
    <template v-slot:icon-prepend>
        <i class="fa fas-user"></i>
    </template>
</vmq-input>

<vmq-input v-model="input">
    <!-- custom helper text -->
    <template v-slot:helper-text>
        <span>
            Helper
            <u>Text</u>
        </span>
    </template>
</vmq-input>
Event
NameTypeDescriptiondefault
select(value, event)functionInvoked when input is selected.
focus(value, event)functionInvoked when input gains focus.
blur(value, event)functionInvoked when input loses focus.
change(value, event)functionInvoked when input changes.
keyup(value, event)functionInvoked when a key is released.
keydown(value, event)functionInvoked when the user presses a keyboard key.
keypress(value, event)functionInvoked when the user presses a key on the keyboard.
Event Example
<vmq-input
    type="text"
    label-style="label-border"
    @change="handleChange"
/>

methods: {
    handleChange(value, event) {
        // code here
    }
}

Style

Classes
.vmq-input-wrapper
.vmq-input-textfield
.vmq-input-label
.vmq-input-state
.vmq-input-icon-prepend
.vmq-input-icon-append
.vmq-input-helper
.vmq-input-clear
Custom Style

Custom input style with css variable

<vmq-input
    v-model="input"
    label-style="label-inside"
/>

// for example to set as a global
<style>
    :root {
        --vmq-text-input-colo: tan;
        --vmq-text-input-border-width 1px;
    }
</style>

Custom for dark mode. label-insde

<vmq-input 
    v-model="input"
    type="text"
    label-style="label-border"
    containerClass="custom-text-input"
/>
<vmq-input 
    v-model="input"
    type="password"
    label-style="label-border"
    containerClass="custom-text-input"
/>

<style lang="scss">
    body {
        background: #252524;
    }
    
    .custom-text-input {
        .vmq-input-textfield {
            color: #fff;
        }

        .vmq-input-label, .vmq-input-helper {
            color: rgba(255,255,255,.7);
        }
    }
</style>

Keywords

FAQs

Last updated on 21 Aug 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc