All Projects → bartkozal → Vue Float Label

bartkozal / Vue Float Label

Licence: mit
Float label pattern

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Vue Float Label

Chartjs Plugin Datalabels
Chart.js plugin to display labels on data elements
Stars: ✭ 545 (+207.91%)
Mutual labels:  label
Blabel
🏷 Python label/sticker PDF generation. HTML templates, built-in barcodes, qr codes, and other goodies
Stars: ✭ 63 (-64.41%)
Mutual labels:  label
Cjlabel
A drop-in replacement for UILabel that supports NSAttributedString, rich text, display any view, links, select copy and more
Stars: ✭ 140 (-20.9%)
Mutual labels:  label
Imglab
To speedup and simplify image labeling/ annotation process with multiple supported formats.
Stars: ✭ 723 (+308.47%)
Mutual labels:  label
Trescope
Trescope is a comprehensive 3D machine learning development tool devoted to improve developing experience and speed in 3D field, which helps researchers and developers to label, debug, visualize various 3D data
Stars: ✭ 49 (-72.32%)
Mutual labels:  label
Fsdairportfliplabel
UILabel like old Airport flipping labels
Stars: ✭ 79 (-55.37%)
Mutual labels:  label
Ybattributetexttapaction
一行代码添加文本点击事件/a fast way to implement click event text
Stars: ✭ 430 (+142.94%)
Mutual labels:  label
Cdmarkdownkit
An extensive Swift framework providing simple and customizable markdown parsing.
Stars: ✭ 158 (-10.73%)
Mutual labels:  label
Dzhtmltext
Delphi and Lazarus HTML Label component
Stars: ✭ 60 (-66.1%)
Mutual labels:  label
Widgetlayout
自定义ViewGroup的集合(有 kotlin 实现分支):提高编写效率和 UI 绘制性能,少嵌套,易用易扩展。
Stars: ✭ 130 (-26.55%)
Mutual labels:  label
Ruby Gem Downloads Badge
Clean and simple gem downloads count badge, courtesy of http://shields.io/. You can checkout the application directly at the following URL:
Stars: ✭ 29 (-83.62%)
Mutual labels:  label
Ybattributetexttapforswfit
一行代码添加文本点击事件(swfit4.2版本)/a fast way to implement click event text(for swfit4.2)
Stars: ✭ 47 (-73.45%)
Mutual labels:  label
Github Label Setup
📦 Setup GitHub label without configuration.
Stars: ✭ 107 (-39.55%)
Mutual labels:  label
Txscrolllabelview
🌭TXScrollLabelView, the best way to show & display information such as adverts / boardcast / onsale e.g. with a customView.
Stars: ✭ 714 (+303.39%)
Mutual labels:  label
Bmw Labeltool Lite
This repository provides you with a easy to use labeling tool for State-of-the-art Deep Learning training purposes.
Stars: ✭ 145 (-18.08%)
Mutual labels:  label
Stacklabel
🔥空祖家的堆叠标签(以下碎念:一开始起名字“StackLabel”没想太多结果被人吐槽Stack是整齐堆叠的意思...........好吧这是我的锅不过现在要改也来不及了,好用就行了...吧?
Stars: ✭ 471 (+166.1%)
Mutual labels:  label
Coco Annotator
✏️ Web-based image segmentation tool for object detection, localization, and keypoints
Stars: ✭ 1,138 (+542.94%)
Mutual labels:  label
Movingnumbersview
Moving numbers effect in SwiftUI
Stars: ✭ 175 (-1.13%)
Mutual labels:  label
Zswtappablelabel
UILabel subclass for links which are tappable, long-pressable, 3D Touchable, and VoiceOverable.
Stars: ✭ 148 (-16.38%)
Mutual labels:  label
Tytext
text asynchronous rendering by TextKit for iOS
Stars: ✭ 127 (-28.25%)
Mutual labels:  label

vue-float-label

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

intro

<float-label>
  <input type="text" placeholder="Label">
</float-label>

Installation

yarn / npm

Install package using yarn or npm:

$ yarn add vue-float-label

# or

$ npm install --save vue-float-label

Global

Load the plugin by calling Vue.use():

import Vue from "vue";
import VueFloatLabel from "vue-float-label";

Vue.use(VueFloatLabel);

Now you have access in your templates to the <float-label> component.

Local

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

<template>
  <float-label>
    ...
  </float-label>
</template>

<script>
import FloatLabel from "vue-float-label/components/FloatLabel";

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

CDN

Load the script file from CDN:

<div id="root"></div>
<script src="//cdnjs.cloudflare.com/ajax/libs/vue/2.2.1/vue.min.js"></script>
<script src="//unpkg.com/vue-float-label"></script>
<script>
  new Vue({
    el: '#root',
    template: '<float-label>...</float-label>'
  })
</script>

Usage

Wrap input, textarea or select with <float-label>:

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

<float-label>
  <textarea placeholder="Comment"></textarea>
</float-label>

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

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>
  <float-label :on="isActive">
    <input type="text" placeholder="Inactive">
  </float-label>
</template>

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

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

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

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

Set :fixed to true to make label permanently active:

<template>
  <float-label fixed>
    <input type="text" placeholder="Fixed">
  </float-label>
</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>
  <float-label :dispatch="false">
    <input type="email" placeholder="Email" v-model="email">
  </float-label>
</template>

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

Development

  1. Clone the repository:

    $ git clone [email protected]:bkzl/vue-float-label.git
    
  2. Install dependencies:

    $ yarn install
    
  3. Start development:

    $ yarn start
    

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].