-
Notifications
You must be signed in to change notification settings - Fork 46
/
components_chips.html
275 lines (236 loc) · 6.61 KB
/
components_chips.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
---
layout: admin
title: Components - Chips
section: components
module: components_chips
header:
icon: face
title: Chips
description: Chips can be used to represent small blocks of information. They are most commonly used either for contacts or for tags.
javascripts:
- js/pages/components_chips.js
---
<section id="components_chips">
<!-- ############ -->
<!-- Introduction -->
<!-- ############ -->
<div class="row">
<div class="col s12">
<h4 class="main-text lighten-1">Introduction</h4>
<div class="chip">
<img src="img/yuna.jpg" alt="Contact Person">
Jane Doe
</div>
<div class="chip">
Tag
<i class="close material-icons">close</i>
</div>
</div>
</div>
<!-- ######## -->
<!-- Contacts -->
<!-- ######## -->
<div class="row">
<div class="col s12">
<h4 class="main-text lighten-1">Contacts</h4>
<p>To create a contact chip just add an img inside.</p>
<pre>
<code class="language-markup">
<div class="chip">
<img src="img/yuna.jpg" alt="Contact Person">
Jane Doe
</div>
</code>
</pre>
</div>
</div>
<!-- #### -->
<!-- Tags -->
<!-- #### -->
<div class="row">
<div class="col s12">
<h4 class="main-text lighten-1">Tags</h4>
<p>To create a tag chip just add an close icon inside with the class <code class="language-markup">close</code></p>
<pre>
<code class="language-markup">
<div class="chip">
Tag
<i class="close material-icons">close</i>
</div>
</code>
</pre>
</div>
</div>
<!-- ####################### -->
<!-- Javascript Plugin Usage -->
<!-- ####################### -->
<div class="row">
<div class="col s12">
<h4 class="main-text lighten-1">Javascript Plugin Usage</h4>
<p class="caption">To add tags, just enter your tag text and press enter. You can delete them by clicking on the close icon or by using your delete button.</p>
<div class="chips"></div>
<p class="caption">Set initial tags.</p>
<div class="chips chips-initial"></div>
<p class="caption">Use placeholders and override hint texts.</p>
<div class="chips chips-placeholder"></div>
</div>
</div>
<!-- ###### -->
<!-- Markup -->
<!-- ###### -->
<div class="row">
<div class="col s12">
<h4 class="main-text lighten-1">Markup</h4>
<pre>
<code class="language-markup">
<div class="chips"></div>
<div class="chips chips-initial"></div>
<div class="chips chips-placeholder"></div>
</code>
</pre>
</div>
</div>
<!-- ##################### -->
<!-- jQuery Initialization -->
<!-- ##################### -->
<div class="row">
<div class="col s12">
<h4 class="main-text lighten-1">jQuery Initialization</h4>
<pre>
<code class="language-javascript">
$('.chips').material_chip();
$('.chips-initial').material_chip({
data: [{
tag: 'Apple',
}, {
tag: 'Microsoft',
}, {
tag: 'Google',
}],
});
$('.chips-placeholder').material_chip({
placeholder: 'Enter a tag',
secondaryPlaceholder: '+Tag',
});
</code>
</pre>
<p>Chip data object</p>
<pre>
<code class="language-javascript">
var chip = {
tag: 'chip content',
image: '', //optional
id: 1, //optional
};
</code>
</pre>
</div>
</div>
<!-- ##################### -->
<!-- jQuery Plugin Options -->
<!-- ##################### -->
<div class="row">
<div class="col s12">
<h4 class="main-text lighten-1">jQuery Plugin Options</h4>
<table class="highlight">
<thead>
<tr>
<th>Option Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>data</td>
<td>array</td>
<td>Set the chip data (look at the Chip data object)</td>
</tr>
<tr>
<td>placeholder</td>
<td>string</td>
<td>Set first placeholder when there are no tags.</td>
</tr>
<tr>
<td>secondaryPlaceholder</td>
<td>string</td>
<td>Set second placeholder when adding additional tags.</td>
</tr>
<tr>
</tbody>
</table>
</div>
</div>
<!-- ###### -->
<!-- Events -->
<!-- ###### -->
<div class="row">
<div class="col s12">
<h4 class="main-text lighten-1">Events</h4>
<p>Material chips exposes a few events for hooking into chips functionality.</p>
<table class="highlight">
<thead>
<tr>
<th>Event</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>chips.add</td>
<td>this method is triggered when a chip is <strong>added</strong>.</td>
</tr>
<tr>
<td>chips.delete</td>
<td>this method is triggered when a chip is <strong>deleted</strong>.</td>
</tr>
<tr>
<td>chips.select</td>
<td>this method is triggered when a chip is <strong>selected</strong>.</td>
</tr>
</tbody>
</table>
<pre>
<code class="language-javascript">
$('.chips').on('chip.add', function(e, chip){
// you have the added chip here
});
$('.chips').on('chip.delete', function(e, chip){
// you have the deleted chip here
});
$('.chips').on('chip.select', function(e, chip){
// you have the selected chip here
});
</code>
</pre>
</div>
</div>
<!-- ####### -->
<!-- Methods -->
<!-- ####### -->
<div class="row">
<div class="col s12">
<h4 class="main-text lighten-1">Methods</h4>
<p>Use these methods to access the chip data.</p>
<table class="table highlight">
<thead>
<tr>
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>data</td>
<td>It returns the stored data.</td>
</tr>
</tbody>
</table>
<pre>
<code class="language-javascript">
$('.chips-initial').material_chip('data');
</code>
</pre>
</div>
</div>
</section>