npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-3-mask-updated

v0.0.12

Published

An updated package to create masks on input fields for Vue3

Downloads

565

Readme

vue-3-mask-updated

A simple input mask library for Vue.js 3, inspired by vue-3-mask by Alisson Ryan. This library allows you to create input masks for fields in your Vue.js 3 application easily.

For the original version, Go to

https://www.npmjs.com/~alissonrayan

Installation

Install the library using npm or yarn:

npm install vue-3-mask-updated

or

yarn add vue-3-mask-updated

Usage

Global registration

In your Vue 3 application, open the main.js (or main.ts) file and import the MaskInput component from the vue-3-mask library. Register it globally:

import { createApp } from 'vue';
import App from './App.vue';
import { MaskInput } from 'vue-3-mask';

const app = createApp(App);

app.component('MaskInput', MaskInput);

app.mount('#app');

Now you can use the MaskInput component throughout your application.

Local registration

If you prefer to register the component locally, you can do so in the components section of your Vue component:

import { MaskInput } from 'vue-3-mask';

export default {
  components: {
    MaskInput,
  },
};

Using MaskInput in your components

Using MaskInput in your components To use the MaskInput component in your Vue components, simply include it in your template and provide a mask prop with the desired pattern. The following mask patterns are supported:

#: Any digit (0-9)
X: Any alphanumeric character (0-9, a-z, A-Z)
S: Any alphabetic character (a-z, A-Z)
A: Any uppercase alphabetic character (A-Z)
a: Any lowercase alphabetic character (a-z)
!: Escape character (use the next character in the mask as a literal)

Attribute description

| Attribute | Required | Default | Values | Description | |-----------|--------- |---------|--------|-------------| | mask | Yes | None |As given in the above table | This is the most important attribute without which the mask will not work. Please follow the above guidelines to create a mask. | | class | No | None | - | You can assign classes to the input field. | | id | No | None | - | You can assign an ID to the input field. | | placeholder | No | empty | - | You can assign a placeholder to the input field. | | readonly | No | false/empty | - | You can make the field read only. | | v-model | Yes | None | - | You can set the v-model of the input element. | | textmode | No | empty | uppercase - If the text should be converted to upppercase. Eg. NEW YORKlowercase - If the text should be converted to lowercase. Eg. new yorksentencecase - If the text should be converted to sentence case. Eg. New york |

Here's an example of using the MaskInput component with a phone number mask:

<template>
  <div>
    <h1>Phone number input example</h1>
    <MaskInput v-model="phoneNumber" mask="(##) ####-####" class="form-control"/>
  </div>
</template>

<script>
export default {
  data() {
    return {
      phoneNumber: '',
    };
  },
};
</script>

In this example, the MaskInput component will enforce the provided phone number mask as the user types, and the masked value will be stored in the phoneNumber data property.

You will be able to assign classes to the component.

Contributing

We welcome contributions to the vue-3-mask-updated library. If you find a bug or have an idea for a new feature, please feel free to open an issue.