This repository has been archived by the owner on Sep 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 238
/
index.html
661 lines (576 loc) · 33.1 KB
/
index.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
---
title: Tokenfield for Bootstrap
---
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<title>Tokenfield for Bootstrap</title>
<!-- Bootstrap core CSS -->
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet">
<!-- jQuery UI CSS -->
<link href="//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" type="text/css" rel="stylesheet">
<!-- Bootstrap styling for Typeahead -->
<link href="dist/css/tokenfield-typeahead.css" type="text/css" rel="stylesheet">
<!-- Tokenfield CSS -->
<link href="dist/css/bootstrap-tokenfield.css" type="text/css" rel="stylesheet">
<!-- Docs CSS -->
<link href="docs-assets/css/pygments-manni.css" type="text/css" rel="stylesheet">
<link href="docs-assets/css/docs.css" type="text/css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/respond.js/1.2.0/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="bs-header" id="content">
<div class="container">
<h1>Tokenfield for Bootstrap</h1>
<p>Advanced tagging/tokenizing plugin for jQuery and Twitter Bootstrap with a focus on keyboard and copy-paste support.</p>
<ul id="feature-highlights">
<li>Copy & paste support</li>
<li>Keyboard navigation</li>
<li>Edit existing tokens</li>
<li>Multiple lines of tokens</li>
<li>Responsive</li>
</ul>
<div id="main-links">
<a id="download-master" href="https://github.com/sliptree/bootstrap-tokenfield/zipball/master" class="btn btn-primary">Download Development</a>
</div>
</div>
</div>
<div class="container bs-docs-container">
<div class="row">
<div class="col-md-3">
<div class="bs-sidebar hidden-print affix-top" role="complementary">
<ul class="nav bs-sidenav">
<li><a href="#examples">Examples</a></li>
<li><a href="#usage">Usage</a></li>
<li><a href="#options">Options</a></li>
<li><a href="#methods">Methods</a></li>
<li><a href="#events">Events</a></li>
<li><a href="#keyboard">Keyboard support</a></li>
<li><a href="#copy-paste">Copy & paste support</a></li>
<li><a href="#validation-states">Validation states</a></li>
<li><a href="#various-examples">Various examples</a></li>
</ul>
</div>
</div>
<div class="col-md-9" role="main">
<!-- Glyphicons
================================================== -->
<div class="bs-docs-section">
<div class="page-header">
<h1 id="tokenfield">Tokenfield <small>%VERSION%</small></h1>
</div>
<h2 id="examples">Examples</h2>
<p>Create elegant taggable fields with copy/paste and keyboard support.</p>
<p><strong>Using jQuery UI Autocomplete</strong></p>
<div class="bs-example">
<div class="form-group">
<input type="text" class="form-control" id="tokenfield-1" value="red,green,blue" placeholder="Type something and hit enter" />
</div>
</div>
{% highlight html %}
<input type="text" class="form-control" id="tokenfield" value="red,green,blue" />
{% endhighlight %}
{% highlight js %}
$('#tokenfield').tokenfield({
autocomplete: {
source: ['red','blue','green','yellow','violet','brown','purple','black','white'],
delay: 100
},
showAutocompleteOnFocus: true
})
{% endhighlight %}
<p><strong>Using Twitter Typeahead</strong></p>
<div class="bs-example">
<div class="form-group">
<input type="text" class="form-control" id="tokenfield-typeahead" value="red,green,blue" placeholder="Type something and hit enter" />
</div>
</div>
{% highlight html %}
<input type="text" class="form-control" id="tokenfield-typeahead" value="red,green,blue" />
{% endhighlight %}
{% highlight js %}
var engine = new Bloodhound({
local: [{value: 'red'}, {value: 'blue'}, {value: 'green'} , {value: 'yellow'}, {value: 'violet'}, {value: 'brown'}, {value: 'purple'}, {value: 'black'}, {value: 'white'}],
datumTokenizer: function(d) {
return Bloodhound.tokenizers.whitespace(d.value);
},
queryTokenizer: Bloodhound.tokenizers.whitespace
});
engine.initialize();
$('#tokenfield-typeahead').tokenfield({
typeahead: [null, { source: engine.ttAdapter() }]
});
{% endhighlight %}
<h2 id="usage">Usage</h2>
<h3>Trigger tokenfield via JavaScript:</h3>
{% highlight js %}
$('.tokenfield').tokenfield()
{% endhighlight %}
<h3 id="options">Options</h3>
<p>Options can be passed via data attributes or JavaScript. For data attributes, append the option name to <code>data-</code>, as in <code>data-minLength=""</code>.</p>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 50px;">type</th>
<th style="width: 100px;">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>tokens</td>
<td>string, array</td>
<td><code>[]</code></td>
<td>Tokens (or tags). Can be a string with comma-separated values (<code>"one,two,three"</code>), an array of strings (<code>["one","two","three"]</code>), or an array of objects (<code>[{ value: "one", label: "Einz" }, { value: "two", label: "Zwei" }]</code>)</td>
</tr>
<tr>
<td>limit</td>
<td>int</td>
<td><code>0</code></td>
<td>Maximum number of tokens allowed. 0 = unlimited.</td>
</tr>
<tr>
<td>minLength</td>
<td>int</td>
<td><code>0</code></td>
<td>Minimum length required for token value.</td>
</tr>
<tr>
<td>minWidth</td>
<td>int</td>
<td><code>60</code></td>
<td>Minimum input field width. In pixels.</td>
</tr>
<tr>
<td>autocomplete</td>
<td>object</td>
<td><code>{}</code></td>
<td>jQuery UI Autocomplete options</td>
</tr>
<tr>
<td>showAutocompleteOnFocus</td>
<td>boolean</td>
<td><code>false</code></td>
<td>Whether to show autocomplete suggestions menu on focus or not. Works only for jQuery UI Autocomplete, as Typeahead has no support for this kind of behavior.</td>
</tr>
<tr>
<td>typeahead</td>
<td>array</td>
<td><code>[]</code></td>
<td>Arguments for Twitter Typeahead. The first argument should be an options hash (or <code>null</code> if you want to use the defaults). The second argument should be a dataset. You can add multiple datasets: <code>typeahead: [options, dataset1, dataset2]</code></td>
</tr>
<tr>
<td>createTokensOnBlur</td>
<td>boolean</td>
<td><code>false</code></td>
<td>Whether to turn input into tokens when tokenfield loses focus or not.</td>
</tr>
<tr>
<td>delimiter</td>
<td>string, array</td>
<td><code>','</code></td>
<td>A character or an array of characters that will trigger token creation on keypress event. Defaults to ',' (comma). Note - this does not affect Enter or Tab keys, as they are handled in the keydown event. The first delimiter will be used as a separator when getting the list of tokens or copy-pasting tokens.</td>
</tr>
<tr>
<td>beautify</td>
<td>boolean</td>
<td><code>true</code></td>
<td>Whether to insert spaces after each token when getting a comma-separated list of tokens. This affects both value returned by <code>getTokensList()<code> and the value of the original input field.</td>
</tr>
<tr>
<td>inputType</td>
<td>string</td>
<td><code>'text'</code></td>
<td>HTML type attribute for the token input. This is useful for specifying an HTML5 input type like <code>'email'</code>, <code>'url'</code> or <code>'tel'</code> which allows mobile browsers to show a specialized virtual keyboard optimized for different types of input. This only sets the type of the visible token input but does not touch the original input field. So you may set the original input to have <code>type="text"</code> but set this inputType option to <code>'email'</code> if you only want to take advantage of the email style keyboard on mobile, but don't want to enable HTML5 native email validation on the original hidden input.</td>
</tr>
</tbody>
</table>
</div>
<div class="bs-callout bs-callout-info">
<h4>Data attributes for individual tokenfields</h4>
<p>Options for individual tokenfields can alternatively be specified through the use of data attributes, as explained above.</p>
</div>
<div class="bs-callout bs-callout-info">
<h4>Styling Twitter Typeahead </h4>
<p>Twitter Typeahead comes with no default styling. Make sure to include <a href="https://gist.github.com/ragulka/6388201">tokenfield-typeahead.css</a> on your page.</p>
</div>
<h3 id="methods">Methods</h3>
<h4>.tokenfield(options)</h4>
<p>Initializes an input with a tokenfield.</p>
{% highlight js %}
$('#myField').tokenfield();
{% endhighlight %}
<h4>.tokenfield('setTokens', tokens)</h4>
<p>Manually set the tokenfield content (replacing the old content)</p>
{% highlight js %}
$('#myField').tokenfield('setTokens', 'blue,red,white');
$('#myField').tokenfield('setTokens', ['blue','red','white']);
$('#myField').tokenfield('setTokens', [{ value: "blue", label: "Blau" }, { value: "red", label: "Rot" }]);
{% endhighlight %}
<h4>.tokenfield('createToken', token)</h4>
<p>Manually create a token and append it to the input</p>
{% highlight js %}
$('#myField').tokenfield('createToken', 'purple');
$('#myField').tokenfield('createToken', { value: 'violet', label: 'Violet' });
{% endhighlight %}
<h4>.tokenfield('getTokens', active)</h4>
<p>Get an array of tokens from the input. Set <code>active</code> to true to return only selected tokens.</p>
{% highlight js %}
$('#myField').tokenfield('getTokens');
{% endhighlight %}
<h4>.tokenfield('getTokensList', delimiter, beautify, active)</h4>
<p>Get a comma-separated list of the tokens from the input. You can use an alternative separator by supplying also a <code>delimiter</code> argument. Setting <code>beautify</code> to false will prevent adding a space after each token. Set <code>active</code> to true to return only selected tokens.</p>
{% highlight js %}
$('#myField').tokenfield('getTokensList');
$('#myField').tokenfield('getTokensList', '; ');
{% endhighlight %}
<h4>.tokenfield('disable')</h4>
<p>Disable tokenfield (just like a normal input field)</p>
{% highlight js %}
$('#myField').tokenfield('disable');
{% endhighlight %}
<h4>.tokenfield('enable')</h4>
<p>Enable tokenfield (just like a normal input field)</p>
{% highlight js %}
$('#myField').tokenfield('enable');
{% endhighlight %}
<h4>.tokenfield('readonly')</h4>
<p>Make tokenfield a readonly field (just like a normal input field)</p>
{% highlight js %}
$('#myField').tokenfield('readonly');
{% endhighlight %}
<h4>.tokenfield('writeable')</h4>
<p>Make tokenfield writeable (just like a normal input field)</p>
{% highlight js %}
$('#myField').tokenfield('writeable');
{% endhighlight %}
<h4>.tokenfield('destroy')</h4>
<p>Destroy tokenfield and restore original input</p>
{% highlight js %}
$('#myField').tokenfield('destroy');
{% endhighlight %}
<div class="bs-callout bs-callout-info">
<h4>Accessing original input</h4>
<p>Though not recommended, you can access the original input field like so: <code>$('#tokenfield').data('bs.tokenfield').$input</code></p>
<p>You can also set new options for the autocomplete or typehead objects from the original input above like so: <code>$('#tokenfield').data('bs.tokenfield').$input.autocomplete({source: new_array})</code></p>
</div>
<h3 id="events">Events</h3>
<p>Tokenfield exposes a few events for hooking into it's functionality.</p>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 150px;">Event</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>tokenfield:initialize</td>
<td>Fires after Tokenfield has been initialized.</td>
</tr>
<tr>
<td>tokenfield:createtoken</td>
<td>This event fires when a token is all set up to be created, but before it is inserted into the DOM and event listeners are attached. You can use this event to manipulate token value and label by changing the appropriate values of <code>attrs</code> property of the event. See below for an example. Calling <code>event.preventDefault()</code> or doing <code>return false</code> in the event handler will prevent the token from being created.</td>
</tr>
<tr>
<td>tokenfield:createdtoken</td>
<td>This event is fired after the token has been created. Here, <code>attrs</code> property of the event is also available, but is basically read-only. You can also get a direct reference to the token DOM object via <code>e.relatedTarget</code>. The example below uses this to set an 'invalid' class on the newly created token if it does not pass validation.</td>
</tr>
<tr>
<td>tokenfield:edittoken</td>
<td>This event is fired just before a token is about to be edited. This allows you to manipluate the input field value before it is created. Again, to do this, manipluate the <code>attrs</code> property of the event. Here you can also access the token DOM object with <code>e.relatedTarget</code>. Calling <code>event.preventDefault()</code> or doing <code>return false</code> in the event handler will prevent the token from being edited.</td>
</tr>
<tr>
<td>tokenfield:editedtoken</td>
<td>This event is fired when a token is ready for being edited. It means that the token has been replaced by an input field.</td>
</tr>
<tr>
<td>tokenfield:removetoken</td>
<td>This event is fired right before a token is removed. Here you can also access the token DOM object with <code>e.relatedTarget</code>. Calling <code>event.preventDefault()</code> or doing <code>return false</code> in the event handler will prevent the token from being removed. You can access token label and value by checking the <code>attrs</code> property of the event. Also, <code>e.relatedTarget</code> is a reference to the token DOM object.</td>
</tr>
<tr>
<td>tokenfield:removedtoken</td>
<td>This event is fired right after a token is removed from the DOM. You can access token label and value by checking the <code>attrs</code> property of the event.</td>
</tr>
</tbody>
</table>
</div>
<p>The example below is pretty comprehensive. Here, we split user input into two parts: name and email. Then, we validate the email and if it is not valid, we add an <code>invalid</code> class to the token.</p>
<p>When the user starts to edit the token, we merge token value and label together again.</p>
<div class="bs-example">
<input type="text" class="form-control" id="tokenfield-2" data-tokens="me|[email protected],[email protected],not really an email" />
</div>
{% highlight js %}
$('#tokenfield')
.on('tokenfield:createtoken', function (e) {
var data = e.attrs.value.split('|')
e.attrs.value = data[1] || data[0]
e.attrs.label = data[1] ? data[0] + ' (' + data[1] + ')' : data[0]
})
.on('tokenfield:createdtoken', function (e) {
// Über-simplistic e-mail validation
var re = /\S+@\S+\.\S+/
var valid = re.test(e.attrs.value)
if (!valid) {
$(e.relatedTarget).addClass('invalid')
}
})
.on('tokenfield:edittoken', function (e) {
if (e.attrs.label !== e.attrs.value) {
var label = e.attrs.label.split(' (')
e.attrs.value = label[0] + '|' + e.attrs.value
}
})
.on('tokenfield:removedtoken', function (e) {
alert('Token removed! Token value was: ' + e.attrs.value)
})
.tokenfield()
{% endhighlight %}
<h3 id="keyboard">Keyboard support</h3>
<p>Tokenfield includes support for manipulating tokens via keyboard</p>
<h4>left, right arrow keys</h4>
<p>Arrow keys will move between active tokens. Try it out: click on one of the tokens and press left and right arrow keys</p>
<h4>Backspace and delete</h4>
<p>You can delete a selected token with backspace or delete keys. Try it out now:</p>
<h4>Ctrl + A / Cmd + A, Ctrl + C / Cmd + C, Ctrl + V, Cmd + V</h4>
<p>If You have one token selected, you can select all tokens with the keyboard. Then, you can copy the tokens using keyboard. You can also paste tokens to another field.</p>
<div class="bs-example">
<input type="text" class="form-control token-example-field" value="try,pressing,backspace" />
</div>
<h3 id="copy-paste">Copy & paste support</h3>
<p>You can copy tokens from a tokenfield and paste them to any other field as comma-separated values. When you paste to another tokenfield, they will become tokens there, aswell!</p>
<p>Try it out, copy the following to the field below: violet,yellow,brown</p>
<div class="bs-example">
<input type="text" class="form-control token-example-field" value="copy,and,paste" />
</div>
<h3 id="validation-states">Validation states</h3>
<p>Tokenfield also supports all the default validation states from Bootstrap</p>
<form class="bs-example">
<div class="form-group has-success">
<label class="control-label" for="inputSuccess">Input with success</label>
<input type="text" class="form-control token-example-field" id="inputSuccess" value="red,green,blue" />
</div>
<div class="form-group has-warning">
<label class="control-label" for="inputWarning">Input with warning</label>
<input type="text" class="form-control token-example-field" id="inputWarning" value="red,green,blue">
</div>
<div class="form-group has-error">
<label class="control-label" for="inputError">Input with error</label>
<input type="text" class="form-control token-example-field" id="inputError" value="red,green,blue">
</div>
</form>
<h3 id="various-examples">Various examples of using tokenfield</h3>
<p>Using tokenfield with input groups</p>
<form class="bs-example bs-example-form" role="form">
<div class="input-group">
<span class="input-group-addon">Tags:</span>
<input type="text" class="form-control token-example-field" value="cool,nice,great" />
</div>
<br>
<div class="input-group">
<input type="text" class="form-control token-example-field" value="red,green,blue" />
<span class="input-group-addon"><span class="glyphicon glyphicon-star"></span></span>
</div>
<br>
<div class="input-group">
<span class="input-group-addon">Tags:</span>
<input type="text" class="form-control token-example-field" value="red,green,blue" />
<span class="input-group-addon"><span class="glyphicon glyphicon-star"></span></span>
</div>
</form>
<p>Using tokenfield with input group checkboxes and radio buttons</p>
<form class="bs-example bs-example-form" role="form">
<div class="row">
<div class="col-lg-6">
<div class="input-group">
<span class="input-group-addon">
<input type="checkbox">
</span>
<input type="text" class="form-control token-example-field" value="red,green,blue" />
</div><!-- /input-group -->
</div><!-- /.col-lg-6 -->
<div class="col-lg-6">
<div class="input-group">
<span class="input-group-addon">
<input type="radio">
</span>
<input type="text" class="form-control token-example-field" value="red,green,blue" />
</div><!-- /input-group -->
</div><!-- /.col-lg-6 -->
</div>
</form>
<p>Using tokenfield with buttons in input groups</p>
<form class="bs-example bs-example-form" role="form">
<div class="input-group">
<input type="text" class="form-control token-example-field" value="red,green,blue" />
<span class="input-group-btn">
<button class="btn btn-default" type="button">Go!</button>
</span>
</div>
<br>
<div class="input-group">
<input type="text" class="form-control token-example-field" value="red,green,blue" />
<div class="input-group-btn">
<button type="button" class="btn btn-default" tabindex="-1">Action</button>
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" tabindex="-1">
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div>
</div>
</form>
<p>Using tokenfield with different sizes</p>
<form class="bs-example bs-example-form" role="form">
<input type="text" class="form-control input-lg token-example-field" value="red,green,blue" />
<input type="text" class="form-control token-example-field" value="red,green,blue" />
<input type="text" class="form-control input-sm token-example-field" value="red,green,blue" />
<br>
<div class="input-group input-group-lg">
<span class="input-group-addon">@</span>
<input type="text" class="form-control token-example-field" value="red,green,blue" />
</div>
<div class="input-group">
<span class="input-group-addon">@</span>
<input type="text" class="form-control token-example-field" value="red,green,blue" />
</div>
<div class="input-group input-group-sm">
<span class="input-group-addon">@</span>
<input type="text" class="form-control token-example-field" value="red,green,blue" />
</div>
</form>
<p>Disabled tokenfield</p>
<form class="bs-example bs-example-form" role="form">
<input type="text" class="form-control token-example-field" value="red,green,blue" disabled="disabled" />
</form>
<p>Disabled fieldset with tokenfield</p>
<form class="bs-example bs-example-form" role="form">
<fieldset disabled>
<div class="form-group">
<label for="disabledTextInput">Disabled input</label>
<input type="text" id="disabledTextInput" class="form-control" placeholder="Disabled input">
</div>
<div class="form-group">
<label for="disabledTokenfield">Disabled tokenfield</label>
<input type="text" id="disabledTokenfield" class="form-control token-example-field" value="red,green,blue" />
</div>
</fieldset>
</form>
<p>Tokenfield in inline form</p>
<form class="bs-example form-inline" role="form">
<div class="form-group">
<label class="sr-only" for="exampleInlineTags">Tags</label>
<input type="text" id="exampleInlineTags" class="form-control token-example-field" value="red,green,blue" placeholder="Enter tags" />
</div>
<button type="submit" class="btn btn-default">Search</button>
</form>
<p>Tokenfield in horizontal form</p>
<form class="bs-example form-horizontal">
<div class="form-group">
<label for="inputEmail1" class="col-lg-2 control-label">Email</label>
<div class="col-lg-10">
<input type="email" class="form-control" id="inputEmail1" placeholder="Email">
</div>
</div>
<div class="form-group">
<label for="inputPassword1" class="col-lg-2 control-label">Password</label>
<div class="col-lg-10">
<input type="password" class="form-control" id="inputPassword1" placeholder="Password">
</div>
</div>
<div class="form-group">
<label for="inputTags1" class="col-lg-2 control-label">Tags</label>
<div class="col-lg-10">
<input type="text" class="form-control token-example-field" id="inputTags1" placeholder="Tags" value="some,tags">
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button type="submit" class="btn btn-default">Sign in</button>
</div>
</div>
</form>
<p>Tokenfield with fluid and fixed widths (50%, 300px, etc...)</p>
<form class="bs-example bs-example-form" role="form">
<div class="form-group">
<label for="example-fluid-tokenfield">Width: 50% (from stylesheet)</label>
<input type="text" id="example-fluid-tokenfield" class="form-control token-example-field fluid-tokenfield" value="red,green,blue" />
</div>
<div class="form-group">
<label for="example-fixed-tokenfield">Width: 300px (from stylesheet)</label>
<input type="text" id="example-fixed-tokenfield" class="form-control token-example-field fixed-tokenfield" value="red,green,blue" />
</div>
<div class="form-group">
<label for="example-fixed-tokenfield-2">Width: 400px (inline)</label>
<input type="text" id="example-fixed-tokenfield-2" class="form-control token-example-field" value="red,green,blue" style="width:400px;" />
</div>
</form>
<p>Tokenfield with RTL direction</p>
<form class="bs-example bs-example-form" role="form">
<input type="text" class="form-control token-example-field" value="red,green,blue" style="direction:rtl" />
</form>
</div>
</div><!-- // row -->
</div><!-- //container -->
<footer class="bs-footer" role="contentinfo">
<div class="container">
<div class="bs-social">
<ul class="bs-social-buttons">
<li>
<iframe class="github-btn" src="http://ghbtns.com/github-btn.html?user=sliptree&repo=bootstrap-tokenfield&type=watch&count=true" width="100" height="20" title="Star on GitHub"></iframe>
</li>
<li>
<iframe class="github-btn" src="http://ghbtns.com/github-btn.html?user=sliptree&repo=bootstrap-tokenfield&type=fork&count=true" width="102" height="20" title="Fork on GitHub"></iframe>
</li>
<li class="follow-btn">
<a href="https://twitter.com/sliptree" class="twitter-follow-button" data-show-count="false">Follow @sliptree</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
</li>
<li class="tweet-btn">
<a href="https://twitter.com/share" class="twitter-share-button" data-via="sliptree" data-hashtags="bootstrap-tokenfield">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
</li>
</ul>
</div>
<p>Built by <a href="https://github.com/ragulka" target="_blank">@ragulka</a> from <a href="https://sliptree.com" target="_blank">Sliptree</a>
<p>Sliptree 2013</p>
<ul class="footer-links">
<li><a href="https://github.com/sliptree/bootstrap-tokenfield/issues?state=open">Issues</a></li>
<li class="muted">·</li>
<li><a href="https://github.com/sliptree/bootstrap-tokenfield">Fork</a></li>
</ul>
</div>
</footer>
<script type="text/javascript" src="//code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript" src="//code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript" src="dist/bootstrap-tokenfield.js" charset="UTF-8"></script>
<script type="text/javascript" src="docs-assets/js/scrollspy.js" charset="UTF-8"></script>
<script type="text/javascript" src="docs-assets/js/affix.js" charset="UTF-8"></script>
<script type="text/javascript" src="docs-assets/js/typeahead.bundle.min.js" charset="UTF-8"></script>
<script type="text/javascript" src="docs-assets/js/docs.min.js" charset="UTF-8"></script>
<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-22737379-5', 'sliptree.github.io');
ga('send', 'pageview');
</script>
</body>
</html>