-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
demo.html
139 lines (136 loc) · 3.81 KB
/
demo.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script src="https://unpkg.com/@mayank1513/vue-tag-input"></script>
<link
rel="stylesheet"
href="https://unpkg.com/@mayank1513/[email protected]/style.css"
/>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
max-width: 1400px;
margin: auto;
}
.main {
text-align: start;
}
</style>
</head>
<body>
<div id="app">
<img
class="logo"
alt="Krishna Apps logo"
src="https://raw.githubusercontent.com/mayank1513/tag-input/master/src/assets/logo.png"
/>
<br />
<h2>Presents</h2>
<h1>Vue Tag Input</h1>
<hr />
<div class="main">
<h1>Default options</h1>
<tag-input v-model="tags"></tag-input>
<br />
<span
>Use <code>enter</code> key or <code>tab</code> key to create a new
tag.</span
>
<h1>With custom delimiter and colors</h1>
<tag-input
tag-bg-color="lightgreen"
tag-text-color="darkgreen"
:custom-delimiter="customDelimiter"
v-model="tags"
></tag-input>
<br />
<span
>Use <code>enter</code> key or <code>tab</code> key or any of the
custom delimeters to create a new tag.</span
>
<p>
Custom delimiters:
<code v-for="delim in customDelimiter" :key="delim">
"{{delim}}"</code
>
</p>
<br />
<h1>Do not allow custom tags</h1>
<tag-input
:options="options"
:allow-custom="false"
tag-bg-color="blue"
tag-text-color="lightblue"
:custom-delimiter="customDelimiter"
v-model="tags"
></tag-input>
<br />
Try entering tag that is not in options and hit <code>enter</code>
<br />
<span
>Use <code>enter</code> key or <code>tab</code> key or any of the
custom delimeters to create a new tag.</span
>
<p>
Allowed Tags:
<code v-for="tag in options" :key="tag"> "{{tag}}"</code>
</p>
<p>
Custom delimiters:
<code v-for="delim in customDelimiter" :key="delim">
"{{delim}}"</code
>
</p>
<br />
<h1>Provide options for autofill but also allow custom tags</h1>
<tag-input
:options="options"
tag-bg-color="blue"
tag-text-color="lightblue"
:custom-delimiter="customDelimiter"
v-model="tags"
/>
<br />
<span
>Use <code>enter</code> key or <code>tab</code> key or any of the
custom delimeters to create a new tag.</span
>
<p>
Allowed Tags:
<code v-for="tag in options" :key="tag"> "{{tag}}"</code>
</p>
<p>
Custom delimiters:
<code v-for="delim in customDelimiter" :key="delim">
"{{delim}}"</code
>
</p>
<br />
</div>
</div>
<script>
Vue.createApp({
data() {
return {
tags: [],
customDelimiter: [",", " "],
options: ["vue", "composition", "js", "mytag1", "mayank1513"],
};
},
components: {
TagInput,
},
}).mount("#app");
</script>
</body>
</html>