Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


<template id="tagsInput-template">
	<div class="tags">
		<span class="asInput" v-for="(tag, index) in tags1" :class="{ deleting: confirmWaiting && position==index+1 }">{{tag}}</span>
		<input v-model="newTag" placeholder="Add" @keyup.enter="add()" @keyup.backspace="checkIfRemove()" @keyup.left="left()" @keyup.right="right()" :readonly="readonly"/>
		<span class="asInput" v-for="(tag, index) in tags2">{{tag}}</span>

<div id="app">
	<!--<div class="my-control"
         v-for="input in inputs"
         :class="{active: input.isActive}">
    <div class="form-label" 
         :class="{active: input.isActive || input.value}">
	<h1>Very simple tags-input with VueJS 2</h1>
	<tags-input :tags="tags" :readonly="readonly"></tags-input>
		<input type="checkbox" v-model="readonly" /> Readonly
		<li>Write and press enter to add a new tag.</li>
		<li>Press left (it needs to be at position 0 in the input value) or right key (it needs to be at last position in the input value) in order to change position of the input in the list.</li>
		<li>Press backspace twice (within a second and a half) aimed at deleting previous tag.</li>


.tags {
	display: flex;
	flex-direction: row;
	flex-shrink: 0;
	.asInput {
		width: auto;
		padding-right: 1rem;
		background: rgba($cyan, 0.2);
		margin: 0 .2rem;
		&.deleting {
			background: $red;
	input {
		margin: 0 .2rem;
		max-width: 15rem;
		opacity: 1;
		transition: all .3s ease-in-out;
	input[readonly] {
		max-width: 0;
		padding-left: 0;
		padding-right: 0;
		opacity: 0;
		margin-left: 0;
		margin-right: 0;
		pointer-events: none;

label {
	margin: 1rem 0;

#app {
	padding: 2rem;
	h1 {
		margin-bottom: 1rem;


                Vue.config.keyCodes.backspace = 8

var tagsInput = Vue.component('tagsInput', Vue.extend({
	template: '#tagsInput-template',
	props: ['tags', 'readonly'],
			newTag: '',
			confirmWaiting: false,
			position: 1
	computed: {
		tags1: function() {
			return this.tags.slice(0, this.position)
		tags2: function() {
			return this.tags.slice(this.position, this.tags.length)
	methods: {
		add() {
			this.tags.splice(this.position, 0, this.newTag)
			this.position += 1
			this.newTag = ''
		checkIfRemove() {
			if(this.confirmWaiting) {
				if(this.newTag.length===0) {
					this.tags.splice(this.position-1, 1)
					this.position -= 1
					this.confirmWaiting = false
			} else {
				//this.confirmWaiting = true
				var _this = this
				this.confirmWaiting = setTimeout(function(){
					_this.confirmWaiting = false;
				}, 1500)
		left() {
			var pos =;
			if(pos===0) {
				this.position = Math.max(0, this.position-1);
			var evt = event
			setTimeout(function() {
			}, 1300)
		right() {
			var pos =;
			if(pos===this.newTag.length) {
				this.position = Math.min(this.tags.length, this.position+1);
			var evt = event
			setTimeout(function() {
			}, 200)

var app = new Vue({
			tags: ['Aurora', 'Hannah', 'John', 'Simone'],
			readonly: false