1.0.11 • Published 12 months ago

vue-input-autowidth v1.0.11

Weekly downloads
2,842
License
MIT
Repository
github
Last release
12 months ago

vue-input-autowidth

A Vue.js directive for adjusting a text input's width to fit its content.

Installation

npm install vue-input-autowidth@next --save
# or...
yarn add vue-input-autowidth@next

or

Use the UMD build from Unpkg, available as VueInputAutowidth in the global scope.

<script src="/vendor/vue.js" />
<script src="https://unpkg.com/vue-input-autowidth" />

Usage

Globally

Import and register the directive in your app's entrypoint.

import { createApp } from "vue";
import App from "./App.vue";
import { plugin as VueInputAutowidth } from "vue-input-autowidth";

createApp(App).use(VueInputAutowidth).mount("#app");

Per-component

<script>
import { directive as VueInputAutowidth } from "vue-input-autowidth"

export default {
  directives: { autowidth: VueInputAutowidth },
  setup() {
    ...
  },
}
</script>

...and in your template:

<template>
  <input type="text" placeholder="First Name" v-model="msg" v-autowidth />
</template>

You can also pass some options:

<template>
  <input
    type="text"
    placeholder="First Name"
    v-model="msg"
    v-autowidth="{
      minWidth: '75px',
      maxWidth: '75%',
      comfortZone: '1ch',
    }"
  />
</template>

License

MIT © Collin Henderson

2.2.1

12 months ago

2.2.0

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.0.11

3 years ago

1.0.10

4 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

6 years ago

1.0.1

7 years ago