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-floater

v1.0.6

Published

Float label pattern for Vue.js

Downloads

6

Readme

vue-floater

This is a fork of brtjkzl/vue-floater

Float label pattern for Vue.js. Cross-browser compatible and easy to customize with CSS.

intro

<floater>
  <input type="text" placeholder="Label">
</floater>

Installation

npm / yarn

Install package using npm or yarn:

$ npm install --save vue-floater

# or

$ yarn add vue-floater

Global

Load the plugin by calling Vue.use():

import Vue from "vue";
import VueFloater from "vue-floater";

Vue.use(VueFloater);

Now you have access in your templates to the <floater> component.

Local

You may prefer to explicitly import the plugin and use it inside your components:

<template>
  <floater>
    ...
  </floater>
</template>

<script>
import floater from "vue-floater/components/Floater";

export default {
  components: {
    floater
  }
};
</script>

Usage

Wrap input, textarea or select with <floater>:

<floater>
  <input type="email" placeholder="E-mail">
</floater>

<floater>
  <textarea placeholder="Comment"></textarea>
</floater>

<floater :dispatch="false">
  <select>
    <option disabled selected>Framework</option>
    <option>Vue</option>
    <option>React</option>
    <option>Angular</option>
    <option>Ember</option>
  </select>
</floater>

See more examples at Demo.vue.

Customization

Design

Style .vfl-label, .vfl-label-on-input and .vfl-label-on-focus to meet your design requirements:

example

.vfl-label {
  text-transform: uppercase;
}

.vfl-label-on-input {
  top: -1em;
}

.vfl-label-on-focus {
  color: #ff851b;
}

.vfl-label + input {
  padding-left: 0;
  font-size: 100%;
  border: 0;
  border-bottom: 2px solid #aaa;
  transition: border 0.2s;
}

.vfl-label-on-focus + input {
  border-bottom: 2px solid #ff851b;
}

Props

Set :on prop to add an additional condition for label activation:

<template>
  <floater :on="isActive">
    <input type="text" placeholder="Inactive">
  </floater>
</template>

<script>
export default {
  computed: {
    isActive() {
      return false;
    }
  },
  components: {
    floater
  }
};
</script>

Set :label prop to override placeholder attribute for input/textarea or option[disabled][selected] for select:

<floater label="Last name">
  <input type="text" placeholder="Surname">
</floater>
<template>
  <floater label="Version">
    <select v-model="version">
      <option v-for="option in options" :value="option.value">
        {{ option.text }}
      </option>
    </select>
  </floater>
</template>

<script>
export default {
  data() {
    return {
      version: "beta",
      options: [
        { value: "alpha", text: "Alpha" },
        { value: "beta", text: "Beta" },
        { value: "stable", text: "Stable" }
      ]
    };
  },
  components: {
    floater
  }
};
</script>

Set :fixed to true to make label permanently active:

<template>
  <floater fixed>
    <input type="text" placeholder="Fixed">
  </floater>
</template>

Set :dispatch to false to disable triggering input event once the component is mounted:

By default it's set to true to activate label when form element has value.

<template>
  <floater :dispatch="false">
    <input type="email" placeholder="Email" v-model="email">
  </floater>
</template>

<script>
export default {
  data() {
    return {
      email: "[email protected]"
    };
  },
  components: {
    floater
  }
};
</script>

Development

  1. Clone the repository:

    $ git clone [email protected]:urbantrout/vue-floater.git
  2. Install dependencies:

    $ npm install
  3. Start development:

    $ npm start

Code is open sourced on GitHub. Up to date changelog is available under the releases section.