-
Notifications
You must be signed in to change notification settings - Fork 13
/
index.html
279 lines (256 loc) · 12.2 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
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/github.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/highlight.min.js"></script>
<script src='//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js'></script>
<script src='dist/js/inputs.js'></script>
<script>
hljs.initHighlightingOnLoad();
$(document).on('click', '#framework a', function() {
$('#framework link').remove();
if ($(this).data('framework')) {
$('#framework').append("<link href='" + $(this).data('framework') + "' rel='stylesheet'>");
}
$('#framework').append("<link href='" + $(this).data('css') + "' rel='stylesheet'>");
});
$(window).on('load', function() {
if(___browserSync___ && ___browserSync___.socket) {
___browserSync___.socket.on('input:text', function(e){
$($(e.tagName)[e.index]).val(e.value).refresh();
})
}
});
</script>
</head>
<body>
<div class='container'>
<a href="https://github.com/anjlab/inputs"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/652c5b9acfaddf3a9c326fa6bde407b87f7be0f4/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6f72616e67655f6666373630302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png"></a>
<br>
<div class="jumbotron">
<h1>Inputs 0.9.2</h1>
<p>HTML form inputs with pure CSS and a little bit JS magic.</p>
<ul class='list-inline'>
<li>
<a class="btn btn-primary" href="https://github.com/anjlab/inputs/" role="button">Source code</a>
</li>
<li>
<iframe src="http://ghbtns.com/github-btn.html?user=anjlab&repo=inputs&type=watch&size=large"
allowtransparency="true" frameborder="0" scrolling="0" width="75" height="30" style='vertical-align:middle;'></iframe>
</li>
<li>
<iframe src="http://ghbtns.com/github-btn.html?user=anjlab&repo=inputs&type=fork&count=true&size=large"
allowtransparency="true" frameborder="0" scrolling="0" width="75" height="30" style='vertical-align:middle;'></iframe>
</li>
<li>
<iframe src="http://ghbtns.com/github-btn.html?user=anjlab&type=follow&count=true&size=large"
allowtransparency="true" frameborder="0" scrolling="0" width="155" height="30" style='vertical-align:middle;'></iframe>
</li>
</ul>
</div>
<p>
Current CSS styles was inspired by Google Material designs. It uses pure CSS with a minimum number of HTML elements and has size less than 8 kB! The projects uses LESS and have a structured set of HTML input styles. So you can easy use 'standalone' <code>radio</code>/<code>checkbox</code> or <code>select</code> styles in your project. Supports all modern desktop and mobile browsers including IE9+.
</p>
<h3>How to use it</h3>
<p>Just include <code><framework>-inputs-min.css</code> and <code>inputs-min.js</code> to your project and wrap your inputs with <code>.input</code> element.</p>
<form class='form-inputs' role='form'>
<h4>Inputs with <code>text</code> type support.</h4>
<br>
<div class='row pure-g'>
<div class='col-sm-3 pure-u-1-3 large-3 columns'>
<div class='input'>
<input type='text' id="input1" placeholder='Type your first name'>
<label for="input1">First Name</label>
</div>
<div class='input'>
<input type='text' id="input2" value='tests'>
<label for="input2">Last Name or Surname</label>
</div>
</div>
<div class='col-sm-9 pure-u-1-3 large-9 columns'>
<p>You can use <code>placeholder</code> attribute to set placeholder. <strong>Warning:</strong> You must place <code>label</code> element right after <code>input</code> element.</p>
<pre><code class="html"><div class='input'>
<input type='text' id="input1" placeholder='Type your first name'>
<label for="input1">First Name</label>
</div>
</code></pre>
</div>
</div>
<div class='row pure-g'>
<div class='col-sm-3 pure-u-1-3 large-3 columns'>
<div class='input'>
<input type='text' id="input11" class='error'>
<label for="input11">Birtday</label>
<span class='help-block'>MM/DD/YYYY</span>
</div>
<div class='input'>
<input type='text' id="input12" value='Disabled Field' disabled="disabled">
<label for="input12">Disabled</label>
</div>
</div>
<div class='col-sm-9 pure-u-1-3 large-9 columns'>
<p>You can add <code>.error</code> class to input to show error state. Add <code>.help-block</code> element to show error message.</p>
<pre><code class="html"><div class='input'>
<input type='text' id="input2" class='error'>
<label for="input2">Birtday</label>
<span class='help-block'>MM/DD/YYYY</span>
</div>
</code></pre>
</div>
</div>
<h4>Inputs with <code>email</code>, <code>password</code> type support.</h4>
<br>
<div class='row pure-g'>
<div class='col-sm-3 pure-u-1-3 large-3 columns'>
<div class='input'>
<input type='email' id="email1">
<label for="email1">Email</label>
</div>
<div class='input'>
<input type='password' id="password1">
<label for="password1">Password</label>
<span class='help-block'>Enter at least 8 symbols</span>
</div>
</div>
<div class='col-sm-9 pure-u-1-3 large-9 columns'>
<p>Use <code>.help-block</code> element to show hints.</p>
<pre><code class="html"><div class='input'>
<input type='password' id="password1">
<label for="password1">Password</label>
<span class='help-block'>Enter at least 8 symbols</span>
</div>
</code></pre>
</div>
</div>
<h4><code>Textarea</code> input support.</h4>
<div class='row pure-g'>
<div class='col-sm-3 pure-u-1-3 large-3 columns'>
<div class='input'>
<textarea id="input3" rows=3>Looks good</textarea>
<label for="input3">Describe Youself</label>
</div>
</div>
<div class='col-sm-9 pure-u-1-3 large-9 columns'>
<pre><code class="html"><div class='input'>
<textarea id="input3" rows=3></textarea>
<label for="input3">Describe Youself</label>
</div>
</code></pre>
</div>
</div>
<h4><code>Select</code> input support.</h4>
<br>
<div class='row pure-g'>
<div class='col-sm-3 pure-u-1-3 large-3 columns'>
<div class="input select">
<select id='select1'>
<option value="1">Custom</option>
<option value="2">Foundation</option>
<option value="3">Pure</option>
<option value="4">UIKit</option>
</select>
<label for='select1'>Best CSS framework</label>
</div>
</div>
<div class='col-sm-9 pure-u-1-3 large-9 columns'>
<p>You should add <code>.select</code> class to parent element.</p>
<pre><code class="html"><div class="input select">
<select id='select1'>
<option>...</option>
</select>
<label for='select1'>Best CSS framework</label>
</div>
</code></pre>
</div>
</div>
<h4>Inputs with <code>checkbox</code> type support.</h4>
<br>
<div class='row pure-g'>
<div class='col-sm-3 pure-u-1-3 large-3 columns'>
<div class='input'>
<input type='checkbox' id='input4'>
<label for="input4">Check if you like it</label>
</div>
<div class='input'>
<input type='checkbox' id='input41' checked>
<label for="input41">Check if you impressed</label>
</div>
</div>
<div class='col-sm-9 pure-u-1-3 large-9 columns'>
<pre><code class="html"><div class='input'>
<input type='checkbox' id='input4'>
<label for="input4">Check if you like it</label>
</div>
</code></pre>
</div>
</div>
<h4>Inputs with <code>radio</code> type support.</h4>
<br>
<div class='row pure-g'>
<div class='col-sm-3 pure-u-1-3 large-3 columns'>
<div class='input'>
<input type='radio' id='input5' name='radio' checked>
<label for="input5">Option one is for serious guys</label>
</div>
<div class='input'>
<input type='radio' id='input6' name='radio'>
<label for="input6">Option two is for not serious guys</label>
</div>
<div class='input'>
<input type='radio' id='input7' name='radio'>
<label for="input7">Option three is for crazy guys</label>
</div>
</div>
<div class='col-sm-9 pure-u-1-3 large-9 columns'>
<p>You can make inline radio/checkboxes by removing <code>.input</code> wrapper.</p>
<pre><code class="html"><div class='input'>
<input type='radio' id='input5' name='radio' checked>
<label for="input5">Option one is for serious guys</label>
</div>
...
</code></pre>
</div>
</div>
</form>
<h3>Javascript functions</h3>
<p>If you change input value programaticaly you run into problem that label is freezes. To fix it run <code>refresh()</code> method on the input:</p>
<pre><code class="js">$('#input1').val('new value').refresh();
</code></pre>
<h3>Customization</h3>
<p>You can customize controls using overriding the following LESS variables:</p>
<pre><code class="less">@label-color: #555;
@label-font: 'Helvetica Neue';
@input-font: 'Helvetica Neue';
@placeholder-font: normal 300 100% 'Helvetica Neue';
@placeholder-color: #999;
@help-color: #999;
@error-color: #a94442;
@input-border: #ccc;
@input-bg: #fff;
@input-color: #555;
@input-focus-color: #66afe9;
@checkbox-color: #666;
@checkbox-checked-color: #5cb85c;
@checkbox-border-width: 2px;
@checkbox-mark-width: 2px;
@radio-color: #666;
@radio-border-width: 2px;
@radio-checked-color: #5bc0de;
</code></pre>
<p>You can get package via Bower: <code>bower install inputs --save-dev</code>
<h3>CSS Frameworks Support</h3>
<p>Inputs doesn't rely on some specific CSS framework so you can easily use it in any CSS framework as you like. For example:</p>
<div id='framework' style="margin: 15px 0">
<link href='//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.1/css/bootstrap.min.css' rel='stylesheet'>
<link href='dist/css/bootstrap-inputs.css' rel='stylesheet'>
<a href='#generic' data-framework='' data-css='dist/css/generic-inputs.css' class='button btn btn-primary pure-button'>Use without any CSS framework</a>
<a href='#bootstrap' data-framework='//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.1/css/bootstrap.min.css' data-css='dist/css/bootstrap-inputs.css' class='button btn btn-warning pure-button'>Use with Bootstrap</a>
<a href='#pure' data-framework='//cdnjs.cloudflare.com/ajax/libs/pure/0.5.0/pure-min.css' data-css='dist/css/generic-inputs.css' class='button btn btn-default pure-button'>Use with Pure CSS</a>
</div>
<hr>
<p>Coded by Nick Zhebrun. <a href='anjlab.com'>AnjLab</a>, 2014.</p>
<br>
</div>
</div>
</body>
</html>