semantic-forms 5.3.5 → 5.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/CONTRIBUTING.md +39 -7
- package/dist/semantic-forms.cjs +119 -52
- package/dist/semantic-forms.cjs.map +1 -1
- package/dist/semantic-forms.css +498 -178
- package/dist/semantic-forms.css.map +1 -1
- package/dist/semantic-forms.js +153 -80
- package/dist/semantic-forms.js.map +1 -1
- package/dist/semantic-forms.min.js +1 -1
- package/dist/semantic-forms.min.js.map +1 -1
- package/dist/semantic-forms.min.mjs +1 -1
- package/dist/semantic-forms.min.mjs.map +1 -1
- package/dist/semantic-forms.mjs +120 -53
- package/dist/semantic-forms.mjs.map +1 -1
- package/docs/statics/css/semantic-forms-styles.scss +14 -1
- package/docs/statics/js/semantic-forms-demo.js +16 -0
- package/docs/statics/js/semantic-forms-main.js +3 -2
- package/docs/statics/pages/buttons.html +98 -0
- package/docs/statics/pages/checkboxes.html +130 -0
- package/docs/statics/pages/fullDemo.html +1078 -821
- package/docs/statics/pages/inputs.html +384 -0
- package/docs/statics/pages/layout.html +521 -0
- package/docs/statics/pages/layouts/main.html +9 -1
- package/docs/statics/pages/theming.html +39 -0
- package/docs/statics/pages/usage.html +17 -799
- package/package.json +27 -13
- package/semanticForms.js +33 -8
- package/semanticForms.scss +15 -5
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
<ul>
|
|
12
12
|
<li><code>dist/semantic-forms.cjs</code>: CommonJS bundle: <code>const semanticForms = require('semantic-forms')</code></li>
|
|
13
13
|
<li><code>dist/semantic-forms.js</code>: Standalone bundle that can be included via <code><!--#<script>--></code> tags. Declares a global variable called: <code>semanticForms</code></li>
|
|
14
|
-
<li><code>dist/semantic-forms.min.js</code>: Minified standalone bundle that can be included via <code><!--#<
|
|
14
|
+
<li><code>dist/semantic-forms.min.js</code>: Minified standalone bundle that can be included via <code><!--#<script>--></code> tags. Declares a global variable called: <code>semanticForms</code></li>
|
|
15
15
|
<li><code>dist/semantic-forms.mjs</code>: ES module: <code>import semanticForms from 'semantic-forms'</code></li>
|
|
16
16
|
<li><code>dist/semantic-forms.min.mjs</code>: Minified ES module: <code>import semanticForms from 'semantic-forms/min'</code></li>
|
|
17
17
|
</ul>
|
|
18
18
|
|
|
19
19
|
<h2 id="use">Use</h2>
|
|
20
20
|
|
|
21
|
-
<p>Include
|
|
21
|
+
<p>Include <code>dist/semantic-forms.css</code> and whichever of the above versions of the JS file you prefer into your project. Both ship in the npm package, and can also be loaded from any CDN that serves npm, for example <code>https://cdn.jsdelivr.net/npm/semantic-forms/dist/semantic-forms.js</code>. The <code>dist</code> folder is built from source, so it is not checked into the git repository.</p>
|
|
22
22
|
|
|
23
23
|
<p>Then apply the <code>semanticForms</code> class to your <code><!--#<form>--></code> elements:</p>
|
|
24
24
|
|
|
@@ -36,798 +36,33 @@
|
|
|
36
36
|
|
|
37
37
|
<p>If you make changes to the DOM after Semantic Forms is activated and want to activate any additional <code>semanticForms</code> forms you insert, you can re-scan for new forms by calling <code>semanticForms.reinitialize()</code> again. If you only want to reinitialize one form instead of all of them, call <code>semanticForms.reinitialize(formElement)</code>.</p>
|
|
38
38
|
|
|
39
|
-
<h3 id="
|
|
40
|
-
|
|
41
|
-
<h4 id="floatlabel">Float label inputs</h4>
|
|
42
|
-
|
|
43
|
-
<p>The float label input pattern is notoriously difficult to implement in a fashion that doesn't degrade HTML semantics or accessibility. This pattern library implements a solution that solves that problem. Your label doesn't need to be a sibling of your input like with other implementations. This implementation also has a custom clear button for each input.</p>
|
|
44
|
-
|
|
45
|
-
<p>Note: Although wrapping the input and label elements in a <code><!--#<div>--></code> is not required, it is highly recommended as it reduces <a href="https://en.wikipedia.org/wiki/Flash_of_unstyled_content"><abbr>FOUC</abbr></a>.</p>
|
|
46
|
-
|
|
47
|
-
<h5 id="floatlabelex">Example</h5>
|
|
48
|
-
|
|
49
|
-
<pre><code class='language-html' lang='html'><escape>
|
|
50
|
-
<form class="semanticForms">
|
|
51
|
-
<dl>
|
|
52
|
-
<div>
|
|
53
|
-
<dd><input id="name" name="name" type="text" placeholder="e.g. John Smith"></dd>
|
|
54
|
-
<dt><label for="name">Name</label></dt>
|
|
55
|
-
</div>
|
|
56
|
-
</dl>
|
|
57
|
-
</form>
|
|
58
|
-
</escape></code></pre>
|
|
59
|
-
|
|
60
|
-
<form class="semanticForms">
|
|
61
|
-
<dl>
|
|
62
|
-
<div>
|
|
63
|
-
<dt><label for="name">Name</label></dt>
|
|
64
|
-
<dd><input id="name" name="name" type="text" placeholder="e.g. John Smith"></dd>
|
|
65
|
-
</div>
|
|
66
|
-
</dl>
|
|
67
|
-
</form>
|
|
68
|
-
|
|
69
|
-
<h5 id="floatlabelextextarea">Or with a <code><!--#<textarea>--></code></h5>
|
|
39
|
+
<h3 id="shadowdom">Forms inside a shadow root</h3>
|
|
70
40
|
|
|
71
|
-
<
|
|
72
|
-
<form class="semanticForms">
|
|
73
|
-
<dl>
|
|
74
|
-
<div>
|
|
75
|
-
<dt><label for="textarea">Textarea</label></dt>
|
|
76
|
-
<dd><textarea id="textarea" name="textarea" rows="5" cols="50" placeholder="e.g. Long string of text"></textarea></dd>
|
|
77
|
-
</div>
|
|
78
|
-
</dl>
|
|
79
|
-
</form>
|
|
80
|
-
</escape></code></pre>
|
|
41
|
+
<p>A shadow root is a separate tree, so <code>semanticForms()</code> cannot see into one by default. Pass the root to enhance the forms inside it:</p>
|
|
81
42
|
|
|
82
|
-
<
|
|
83
|
-
<dl>
|
|
84
|
-
<div>
|
|
85
|
-
<dt><label for="textarea">Textarea</label></dt>
|
|
86
|
-
<dd><textarea id="textarea" name="textarea" rows="5" cols="50" placeholder="e.g. Long string of text"></textarea></dd>
|
|
87
|
-
</div>
|
|
88
|
-
</dl>
|
|
89
|
-
</form>
|
|
43
|
+
<pre><code class='language-javascript'>semanticForms(myElement.shadowRoot)</code></pre>
|
|
90
44
|
|
|
91
|
-
<p>
|
|
45
|
+
<p>Each tree you pass gets watched separately, so calling it for the document and for one or more shadow roots is fine and they do not interfere with each other. <code>semanticForms.reinitialize(formElement)</code> works out which tree the form belongs to on its own.</p>
|
|
92
46
|
|
|
93
|
-
<
|
|
47
|
+
<p>Shadow roots do not inherit the page's stylesheets, so the shadow root needs its own copy of the CSS, either through a <code><!--#<link>--></code> inside it or by adopting a stylesheet:</p>
|
|
94
48
|
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
<form class="semanticForms" method="post">
|
|
99
|
-
<dl>
|
|
100
|
-
<div>
|
|
101
|
-
<dt><label for="password">Password</label></dt>
|
|
102
|
-
<dd>
|
|
103
|
-
<input id="password" name="password" type="password" placeholder="Enter a password" minlength="8" required autocomplete="off">
|
|
104
|
-
<label for="password">Must be at least 8 characters long.</label>
|
|
105
|
-
</dd>
|
|
106
|
-
</div>
|
|
107
|
-
</dl>
|
|
108
|
-
</form>
|
|
109
|
-
</escape></code></pre>
|
|
110
|
-
|
|
111
|
-
<form class="semanticForms" method="post">
|
|
112
|
-
<dl>
|
|
113
|
-
<div>
|
|
114
|
-
<dt><label for="password">Password</label></dt>
|
|
115
|
-
<dd>
|
|
116
|
-
<input id="password" name="password" type="password" placeholder="Enter a password" minlength="8" required autocomplete="off">
|
|
117
|
-
<label for="password">Must be at least 8 characters long.</label>
|
|
118
|
-
</dd>
|
|
119
|
-
</div>
|
|
120
|
-
</dl>
|
|
121
|
-
</form>
|
|
122
|
-
|
|
123
|
-
<h5>Add inline buttons</h5>
|
|
124
|
-
|
|
125
|
-
<p>Include a button or input with the type "submit" in the <code><!--#<dd>--></code> element to place it next to the input:</p>
|
|
126
|
-
|
|
127
|
-
<pre><code class='language-html' lang='html'><escape>
|
|
128
|
-
<form class="semanticForms" method="post">
|
|
129
|
-
<dl>
|
|
130
|
-
<div>
|
|
131
|
-
<dt><label for="email">Email address</label></dt>
|
|
132
|
-
<dd>
|
|
133
|
-
<input id="email" name="email" type="email" placeholder="Enter an email address" autocomplete="off">
|
|
134
|
-
<button type="submit">Sign up</button>
|
|
135
|
-
</dd>
|
|
136
|
-
</div>
|
|
137
|
-
</dl>
|
|
138
|
-
</form>
|
|
49
|
+
<pre><code class='language-javascript'><escape>const sheet = new CSSStyleSheet()
|
|
50
|
+
await sheet.replace(await (await fetch('/path/to/semantic-forms.css')).text())
|
|
51
|
+
myElement.shadowRoot.adoptedStyleSheets = [sheet]
|
|
139
52
|
</escape></code></pre>
|
|
140
|
-
|
|
141
|
-
<form class="semanticForms" method="post">
|
|
142
|
-
<dl>
|
|
143
|
-
<div>
|
|
144
|
-
<dt><label for="email">Email address</label></dt>
|
|
145
|
-
<dd>
|
|
146
|
-
<input id="email" name="email" type="email" placeholder="Enter an email address" autocomplete="off">
|
|
147
|
-
<button type="submit">Sign up!</button>
|
|
148
|
-
</dd>
|
|
149
|
-
</div>
|
|
150
|
-
</dl>
|
|
151
|
-
</form>
|
|
152
53
|
|
|
153
|
-
<
|
|
154
|
-
|
|
155
|
-
<p>Add keyboard shortcuts on specific inputs to focus them by adding a <code>data-focus-key</code> attribute and optional <code>data-focus-modifier</code> attribute.</p>
|
|
156
|
-
|
|
157
|
-
<pre><code class='language-html' lang='html'><escape>
|
|
158
|
-
<form class="semanticForms" method="post">
|
|
159
|
-
<dl>
|
|
160
|
-
<div>
|
|
161
|
-
<dt><label for="focus-1">Focus me!</label></dt>
|
|
162
|
-
<dd><input id="focus-1" name="focus-1" type="text" data-focus-key="Y"></dd>
|
|
163
|
-
</div>
|
|
164
|
-
|
|
165
|
-
<!-- change the modifier -->
|
|
166
|
-
<div>
|
|
167
|
-
<dt><label for="focus-2">Focus me!</label></dt>
|
|
168
|
-
<dd><input id="focus-2" name="focus-2" type="text" data-focus-key="Y" data-focus-modifier="alt"></dd>
|
|
169
|
-
</div>
|
|
170
|
-
|
|
171
|
-
<!-- specify modifier by OS -->
|
|
172
|
-
<div>
|
|
173
|
-
<dt><label for="focus-2">Focus me!</label></dt>
|
|
174
|
-
<dd><input id="focus-2" name="focus-2" type="text" data-focus-key="Z" data-focus-modifier-win="alt" data-focus-modifier-linux="meta" data-focus-modifier-mac="cmd"></dd>
|
|
175
|
-
</div>
|
|
176
|
-
</dl>
|
|
177
|
-
</form>
|
|
178
|
-
</escape></code></pre>
|
|
179
|
-
|
|
180
|
-
<form class="semanticForms" method="post">
|
|
181
|
-
<dl>
|
|
182
|
-
<div>
|
|
183
|
-
<dt><label for="focus-1">Focus me!</label></dt>
|
|
184
|
-
<dd><input id="focus-1" name="focus-1" type="text" data-focus-key="Y"></dd>
|
|
185
|
-
</div>
|
|
186
|
-
|
|
187
|
-
<!-- change the modifier -->
|
|
188
|
-
<div>
|
|
189
|
-
<dt><label for="focus-2">Focus me!</label></dt>
|
|
190
|
-
<dd><input id="focus-2" name="focus-2" type="text" data-focus-key="Y" data-focus-modifier="alt"></dd>
|
|
191
|
-
</div>
|
|
192
|
-
|
|
193
|
-
<!-- specify modifier by OS -->
|
|
194
|
-
<div>
|
|
195
|
-
<dt><label for="focus-3">Focus me!</label></dt>
|
|
196
|
-
<dd><input id="focus-3" name="focus-3" type="text" data-focus-key="Z" data-focus-modifier-win="alt" data-focus-modifier-linux="meta" data-focus-modifier-max="cmd"></dd>
|
|
197
|
-
</div>
|
|
198
|
-
</dl>
|
|
199
|
-
</form>
|
|
200
|
-
|
|
201
|
-
<ul>
|
|
202
|
-
<li><p>The focus key should be a single character, and is not case-sensitive. If multiple characters are detected, only the first one will be used. Special characters (!, @, #, etc.) will require <kbd>Shift</kbd> to be pressed with the keyboard shortcut.</p></li>
|
|
203
|
-
<li>
|
|
204
|
-
<p>The modifier key value may be "metactrl," "ctrl," "cmd," "meta," or "alt." The default value is "metactrl" and will automatically be applied if the <code>data-focus-modifier</code> attribute is not present.</p>
|
|
205
|
-
<ul>
|
|
206
|
-
<li>Some combinations are unable to be used due to conflicts with browser and OS keyboard shortcuts. See <a href="https://rooseveltframework.org/docs/semantic-forms/latest/reservedKeyboardShortcuts">reserved keyboard shortcuts</a> for a full overview.</li>
|
|
207
|
-
<li><p>OS-specific modifier keys can be set with <code>data-focus-modifier-win</code> (Windows), <code>data-focus-modifier-linux</code> (Linux) and <code>data-focus-modifier-mac</code> (Mac).</p></li>
|
|
208
|
-
<li><p>Due to a limited range of available shortcuts, the "Start" (win) key on Windows will be replaced with "Ctrl."</p></li>
|
|
209
|
-
</ul>
|
|
210
|
-
</li>
|
|
211
|
-
</ul>
|
|
212
|
-
|
|
213
|
-
<h5 id="custominputfields">Customizing input fields</h5>
|
|
54
|
+
<h3 id="features">Features</h3>
|
|
214
55
|
|
|
215
|
-
<p>
|
|
56
|
+
<p>Each of these has a page of its own:</p>
|
|
216
57
|
|
|
217
58
|
<ul>
|
|
218
|
-
<li><
|
|
219
|
-
<li><
|
|
220
|
-
<li><
|
|
221
|
-
<li><
|
|
222
|
-
<li>
|
|
223
|
-
<p>Show a help text icon next to labels of inputs that contain a <code>title</code> attribute by applying a <code>data-show-help-icon</code> attribute to the label.</p>
|
|
224
|
-
<ul>
|
|
225
|
-
<li>Note that checkboxes and radios should have a <code>title</code> attribute on the label instead of the inputs.</li>
|
|
226
|
-
</ul>
|
|
227
|
-
</li>
|
|
228
|
-
<li><p>Allow fixed-width inputs to grow/shrink to their longest content by applying a <code>data-max-content</code> attribute to the input.</p></li>
|
|
229
|
-
<li>
|
|
230
|
-
<p>Create a one-line text input that grows in height by applying a <code>data-auto-grow</code> attribute to a <code>textarea</code> or <code>input</code> (with type "text") element.</p>
|
|
231
|
-
<ul>
|
|
232
|
-
<li>Note that pressing <kbd>Enter</kbd> with this attribute will attempt to submit the form. Use <kbd>Shift + Enter</kbd> to add new lines.</li>
|
|
233
|
-
</ul>
|
|
234
|
-
</li>
|
|
59
|
+
<li><a href="/inputs.html">Inputs</a></li>
|
|
60
|
+
<li><a href="/checkboxes.html">Checkboxes, radios and switches</a></li>
|
|
61
|
+
<li><a href="/buttons.html">Buttons</a></li>
|
|
62
|
+
<li><a href="/layout.html">Layout</a></li>
|
|
63
|
+
<li><a href="/theming.html">Theming</a></li>
|
|
235
64
|
</ul>
|
|
236
65
|
|
|
237
|
-
<p>You can also disable float labels on a per-field basis with the <code>no-float-label</code> class:</p>
|
|
238
|
-
|
|
239
|
-
<pre><code class='language-html' lang='html'><escape>
|
|
240
|
-
<form class="semanticForms">
|
|
241
|
-
<dl>
|
|
242
|
-
<div>
|
|
243
|
-
<dt><label for="search-field">Search</label></dt>
|
|
244
|
-
<dd><input id="search-field" name="search-field" type="search" placeholder="e.g. cool stuff" class="no-float-label"></dd>
|
|
245
|
-
</div>
|
|
246
|
-
</dl>
|
|
247
|
-
</form>
|
|
248
|
-
</escape></code></pre>
|
|
249
|
-
|
|
250
|
-
<form class="semanticForms">
|
|
251
|
-
<dl>
|
|
252
|
-
<div>
|
|
253
|
-
<dt><label for="search-field">Search</label></dt>
|
|
254
|
-
<dd><input id="search-field" name="search-field" type="search" placeholder="e.g. cool stuff" class="no-float-label"></dd>
|
|
255
|
-
</div>
|
|
256
|
-
</dl>
|
|
257
|
-
</form>
|
|
258
|
-
|
|
259
|
-
<h4 id="responsivecolumns">Responsive columns</h4>
|
|
260
|
-
|
|
261
|
-
<p>This feature makes it so the form fields will grow, shrink, expand the number of columns, or reduce the number of columns based on how much space exists in the container. You can customize it by applying various <code>colspan-#</code> classes to various elements in the form markup structure.</p>
|
|
262
|
-
|
|
263
|
-
<h5 id="colspan">Set number of columns for a group of forms</h5>
|
|
264
|
-
|
|
265
|
-
<p>You can limit the number of columns on your forms using the <code>colspan-#</code> class on a <code><!--#<dl>--></code> element:</p>
|
|
266
|
-
|
|
267
|
-
<pre><code class='language-html' lang='html'><escape>
|
|
268
|
-
<form class="semanticForms">
|
|
269
|
-
<dl class="colspan-2">
|
|
270
|
-
<div>
|
|
271
|
-
<dt><label for="input-a">Input A</label></dt>
|
|
272
|
-
<dd><input type="text" id="input-a" name="input-a"></dd>
|
|
273
|
-
</div>
|
|
274
|
-
|
|
275
|
-
<div>
|
|
276
|
-
<dt><label for="input-b">Input B</label></dt>
|
|
277
|
-
<dd><input type="text" id="input-b" name="input-b"></dd>
|
|
278
|
-
</div>
|
|
279
|
-
|
|
280
|
-
<!-- wraps to the next row -->
|
|
281
|
-
<div>
|
|
282
|
-
<dt><label for="input-c">Input C</label></dt>
|
|
283
|
-
<dd><input type="text" id="input-c" name="input-c"></dd>
|
|
284
|
-
</div>
|
|
285
|
-
</dl>
|
|
286
|
-
</form>
|
|
287
|
-
</escape></code></pre>
|
|
288
|
-
|
|
289
|
-
<form class="semanticForms">
|
|
290
|
-
<dl class="colspan-2">
|
|
291
|
-
<div>
|
|
292
|
-
<dt><label for="input-a">Input A</label></dt>
|
|
293
|
-
<dd><input type="text" id="input-a" name="input-a"></dd>
|
|
294
|
-
</div>
|
|
295
|
-
|
|
296
|
-
<div>
|
|
297
|
-
<dt><label for="input-b">Input B</label></dt>
|
|
298
|
-
<dd><input type="text" id="input-b" name="input-b"></dd>
|
|
299
|
-
</div>
|
|
300
|
-
|
|
301
|
-
<!-- wraps to the next row -->
|
|
302
|
-
<div>
|
|
303
|
-
<dt><label for="input-c">Input C</label></dt>
|
|
304
|
-
<dd><input type="text" id="input-c" name="input-c"></dd>
|
|
305
|
-
</div>
|
|
306
|
-
</dl>
|
|
307
|
-
</form>
|
|
308
|
-
|
|
309
|
-
<p>You can also apply the class to a <code><!--#<fieldset>--></code> which will apply that styling to all nested <code><!--#<dl>--></code> elements:</p>
|
|
310
|
-
|
|
311
|
-
<pre><code class='language-html' lang='html'><escape>
|
|
312
|
-
<form class="semanticForms">
|
|
313
|
-
<fieldset class="colspan-3">
|
|
314
|
-
<!-- inherits 3 column class -->
|
|
315
|
-
<dl>
|
|
316
|
-
<div>
|
|
317
|
-
<dt><label for="f-ex-input-a">Input A</label></dt>
|
|
318
|
-
<dd><input type="text" id="f-ex-input-a" name="f-ex-input-a"></dd>
|
|
319
|
-
</div>
|
|
320
|
-
|
|
321
|
-
<div>
|
|
322
|
-
<dt><label for="f-ex-input-b">Input B</label></dt>
|
|
323
|
-
<dd><input type="text" id="f-ex-input-b" name="f-ex-input-b"></dd>
|
|
324
|
-
</div>
|
|
325
|
-
|
|
326
|
-
<div>
|
|
327
|
-
<dt><label for="f-ex-input-c">Input C</label></dt>
|
|
328
|
-
<dd><input type="text" id="f-ex-input-c" name="f-ex-input-c"></dd>
|
|
329
|
-
</div>
|
|
330
|
-
</dl>
|
|
331
|
-
|
|
332
|
-
<!-- has 4 columns -->
|
|
333
|
-
<dl class="colspan-4">
|
|
334
|
-
<div>
|
|
335
|
-
<dt><label for="f-ex-input-d">Input D</label></dt>
|
|
336
|
-
<dd><input type="text" id="f-ex-input-d" name="f-ex-input-d"></dd>
|
|
337
|
-
</div>
|
|
338
|
-
|
|
339
|
-
<div>
|
|
340
|
-
<dt><label for="f-ex-input-e">Input E</label></dt>
|
|
341
|
-
<dd><input type="text" id="f-ex-input-e" name="f-ex-input-e"></dd>
|
|
342
|
-
</div>
|
|
343
|
-
|
|
344
|
-
<div>
|
|
345
|
-
<dt><label for="f-ex-input-f">Input F</label></dt>
|
|
346
|
-
<dd><input type="text" id="f-ex-input-f" name="f-ex-input-f"></dd>
|
|
347
|
-
</div>
|
|
348
|
-
</dl>
|
|
349
|
-
</fieldset>
|
|
350
|
-
</form>
|
|
351
|
-
</escape></code></pre>
|
|
352
|
-
|
|
353
|
-
<form class="semanticForms">
|
|
354
|
-
<fieldset class="colspan-3">
|
|
355
|
-
<!-- inherits 3 column class -->
|
|
356
|
-
<dl>
|
|
357
|
-
<div>
|
|
358
|
-
<dt><label for="f-ex-input-a">Input A</label></dt>
|
|
359
|
-
<dd><input type="text" id="f-ex-input-a" name="f-ex-input-a"></dd>
|
|
360
|
-
</div>
|
|
361
|
-
|
|
362
|
-
<div>
|
|
363
|
-
<dt><label for="f-ex-input-b">Input B</label></dt>
|
|
364
|
-
<dd><input type="text" id="f-ex-input-b" name="f-ex-input-b"></dd>
|
|
365
|
-
</div>
|
|
366
|
-
|
|
367
|
-
<div>
|
|
368
|
-
<dt><label for="f-ex-input-c">Input C</label></dt>
|
|
369
|
-
<dd><input type="text" id="f-ex-input-c" name="f-ex-input-c"></dd>
|
|
370
|
-
</div>
|
|
371
|
-
</dl>
|
|
372
|
-
|
|
373
|
-
<!-- has 4 columns -->
|
|
374
|
-
<dl class="colspan-4">
|
|
375
|
-
<div>
|
|
376
|
-
<dt><label for="f-ex-input-d">Input D</label></dt>
|
|
377
|
-
<dd><input type="text" id="f-ex-input-d" name="f-ex-input-d"></dd>
|
|
378
|
-
</div>
|
|
379
|
-
|
|
380
|
-
<div>
|
|
381
|
-
<dt><label for="f-ex-input-e">Input E</label></dt>
|
|
382
|
-
<dd><input type="text" id="f-ex-input-e" name="f-ex-input-e"></dd>
|
|
383
|
-
</div>
|
|
384
|
-
|
|
385
|
-
<div>
|
|
386
|
-
<dt><label for="f-ex-input-f">Input F</label></dt>
|
|
387
|
-
<dd><input type="text" id="f-ex-input-f" name="f-ex-input-f"></dd>
|
|
388
|
-
</div>
|
|
389
|
-
</dl>
|
|
390
|
-
</fieldset>
|
|
391
|
-
</form>
|
|
392
|
-
|
|
393
|
-
<h5 id="setcolspannumber">Set number of columns a single input field takes up</h5>
|
|
394
|
-
|
|
395
|
-
<p>You can specify the number of columns an input will span using the <code>colspan-#</code> class on the <code><!--#<dd>--></code> element. The inputs are responsive and will shrink according to available space. Available numbered classes are <code>colspan-1</code> through <code>colspan-5</code>:</p>
|
|
396
|
-
|
|
397
|
-
<pre><code class='language-html' lang='html'><escape>
|
|
398
|
-
<form class="semanticForms">
|
|
399
|
-
<fieldset>
|
|
400
|
-
<dl>
|
|
401
|
-
<div>
|
|
402
|
-
<dt><label for="cspan-ex-input-a">Input A</label></dt>
|
|
403
|
-
<!-- 1 column -->
|
|
404
|
-
<dd class="colspan-1"><input type="text" id="cspan-ex-input-a" name="cspan-ex-input-a"></dd>
|
|
405
|
-
</div>
|
|
406
|
-
|
|
407
|
-
<div>
|
|
408
|
-
<dt><label for="cspan-ex-input-b">Input B</label></dt>
|
|
409
|
-
<!-- 2 columns -->
|
|
410
|
-
<dd class="colspan-2"><input type="text" id="cspan-ex-input-b" name="cspan-ex-input-b"></dd>
|
|
411
|
-
</div>
|
|
412
|
-
|
|
413
|
-
<div>
|
|
414
|
-
<dt><label for="cspan-ex-input-c">Input C</label></dt>
|
|
415
|
-
<!-- 5 columns (max) -->
|
|
416
|
-
<dd class="colspan-5"><input type="text" id="cspan-ex-input-c" name="cspan-ex-input-c"></dd>
|
|
417
|
-
</div>
|
|
418
|
-
</dl>
|
|
419
|
-
</fieldset>
|
|
420
|
-
</form>
|
|
421
|
-
</escape></code></pre>
|
|
422
|
-
|
|
423
|
-
<form class="semanticForms">
|
|
424
|
-
<fieldset>
|
|
425
|
-
<dl>
|
|
426
|
-
<div>
|
|
427
|
-
<dt><label for="cspan-ex-input-a">Input A</label></dt>
|
|
428
|
-
<!-- 1 column -->
|
|
429
|
-
<dd class="colspan-1"><input type="text" id="cspan-ex-input-a" name="cspan-ex-input-a"></dd>
|
|
430
|
-
</div>
|
|
431
|
-
|
|
432
|
-
<div>
|
|
433
|
-
<dt><label for="cspan-ex-input-b">Input B</label></dt>
|
|
434
|
-
<!-- 2 columns -->
|
|
435
|
-
<dd class="colspan-2"><input type="text" id="cspan-ex-input-b" name="cspan-ex-input-b"></dd>
|
|
436
|
-
</div>
|
|
437
|
-
|
|
438
|
-
<div>
|
|
439
|
-
<dt><label for="cspan-ex-input-c">Input C</label></dt>
|
|
440
|
-
<!-- 5 columns (max) -->
|
|
441
|
-
<dd class="colspan-5"><input type="text" id="cspan-ex-input-c" name="cspan-ex-input-c"></dd>
|
|
442
|
-
</div>
|
|
443
|
-
</dl>
|
|
444
|
-
</fieldset>
|
|
445
|
-
</form>
|
|
446
|
-
|
|
447
|
-
<p><code>colspan-full</code> can also be used to force an input to take up the entire width of a form:</p>
|
|
448
|
-
|
|
449
|
-
<pre><code class='language-html' lang='html'><escape>
|
|
450
|
-
<form class="semanticForms">
|
|
451
|
-
<fieldset>
|
|
452
|
-
<dl>
|
|
453
|
-
<div>
|
|
454
|
-
<dt><label for="cspanfull-ex-input-a">Input A</label></dt>
|
|
455
|
-
<!-- this spans 2 columns on row 1 -->
|
|
456
|
-
<dd class="colspan-2"><input type="text" id="cspanfull-ex-input-a" name="cspanfull-ex-input-a"></dd>
|
|
457
|
-
</div>
|
|
458
|
-
|
|
459
|
-
<div>
|
|
460
|
-
<dt><label for="cspanfull-ex-input-b">Input B</label></dt>
|
|
461
|
-
<!-- this spans the full width of row 2 -->
|
|
462
|
-
<dd class="colspan-full"><input type="text" id="cspanfull-ex-input-b" name="cspanfull-ex-input-b"></dd>
|
|
463
|
-
</div>
|
|
464
|
-
|
|
465
|
-
<div>
|
|
466
|
-
<!-- this spans 1 column on row 3 -->
|
|
467
|
-
<dt><label for="cspanfull-ex-input-c">Input C</label></dt>
|
|
468
|
-
<dd><input type="text" id="cspanfull-ex-input-c" name="cspanfull-ex-input-c"></dd>
|
|
469
|
-
</div>
|
|
470
|
-
</dl>
|
|
471
|
-
</fieldset>
|
|
472
|
-
</form>
|
|
473
|
-
</escape></code></pre>
|
|
474
|
-
|
|
475
|
-
<form class="semanticForms">
|
|
476
|
-
<fieldset>
|
|
477
|
-
<dl>
|
|
478
|
-
<div>
|
|
479
|
-
<dt><label for="cspanfull-ex-input-a">Input A</label></dt>
|
|
480
|
-
<!-- this spans 2 columns on row 1 -->
|
|
481
|
-
<dd class="colspan-2"><input type="text" id="cspanfull-ex-input-a" name="cspanfull-ex-input-a"></dd>
|
|
482
|
-
</div>
|
|
483
|
-
|
|
484
|
-
<div>
|
|
485
|
-
<dt><label for="cspanfull-ex-input-b">Input B</label></dt>
|
|
486
|
-
<!-- this spans the full width of row 2 -->
|
|
487
|
-
<dd class="colspan-full"><input type="text" id="cspanfull-ex-input-b" name="cspanfull-ex-input-b"></dd>
|
|
488
|
-
</div>
|
|
489
|
-
|
|
490
|
-
<div>
|
|
491
|
-
<!-- this spans 1 column on row 3 -->
|
|
492
|
-
<dt><label for="cspanfull-ex-input-c">Input C</label></dt>
|
|
493
|
-
<dd><input type="text" id="cspanfull-ex-input-c" name="cspanfull-ex-input-c"></dd>
|
|
494
|
-
</div>
|
|
495
|
-
</dl>
|
|
496
|
-
</fieldset>
|
|
497
|
-
</form>
|
|
498
|
-
|
|
499
|
-
<h5>Align elements within the responsive grid</h5>
|
|
500
|
-
|
|
501
|
-
<p>Use classes to align an element at the start, center, or end of its available space. Available classes are <code>align-start</code>, <code>align-center</code>, and <code>align-end</code>.</p>
|
|
502
|
-
|
|
503
|
-
<pre><code class='language-html' lang='html'><escape>
|
|
504
|
-
<form class="semanticForms" method="post">
|
|
505
|
-
<dl class="colspan-3">
|
|
506
|
-
<div>
|
|
507
|
-
<dt><label for="align-start">align-start</label></dt>
|
|
508
|
-
<dd class="align-start"><input id="align-start" name="align-start" type="text"></dd>
|
|
509
|
-
</div>
|
|
510
|
-
|
|
511
|
-
<div>
|
|
512
|
-
<dt><label for="align-center">align-center</label></dt>
|
|
513
|
-
<dd class="align-center"><input id="align-center" name="align-center" type="text"></dd>
|
|
514
|
-
</div>
|
|
515
|
-
|
|
516
|
-
<div>
|
|
517
|
-
<dt><label for="align-end">align-end</label></dt>
|
|
518
|
-
<dd class="align-end"><input id="align-end" name="align-end" type="text"></dd>
|
|
519
|
-
</div>
|
|
520
|
-
</dl>
|
|
521
|
-
</form>
|
|
522
|
-
</escape></code></pre>
|
|
523
|
-
|
|
524
|
-
<form class="semanticForms" method="post">
|
|
525
|
-
<dl class="colspan-3">
|
|
526
|
-
<div>
|
|
527
|
-
<dt><label for="align-start">align-start</label></dt>
|
|
528
|
-
<dd class="align-start"><input id="align-start" name="align-start" type="text"></dd>
|
|
529
|
-
</div>
|
|
530
|
-
|
|
531
|
-
<div>
|
|
532
|
-
<dt><label for="align-center">align-center</label></dt>
|
|
533
|
-
<dd class="align-center"><input id="align-center" name="align-center" type="text"></dd>
|
|
534
|
-
</div>
|
|
535
|
-
|
|
536
|
-
<div>
|
|
537
|
-
<dt><label for="align-end">align-end</label></dt>
|
|
538
|
-
<dd class="align-end"><input id="align-end" name="align-end" type="text"></dd>
|
|
539
|
-
</div>
|
|
540
|
-
</dl>
|
|
541
|
-
</form>
|
|
542
|
-
|
|
543
|
-
<h4 id="buttongroups">Button groups</h4>
|
|
544
|
-
|
|
545
|
-
<p>You can align buttons side-by-side, or in left/right/center groups.</p>
|
|
546
|
-
|
|
547
|
-
<h5 id="nongroupedbuttons">Non-grouped example</h5>
|
|
548
|
-
|
|
549
|
-
<p>Nothing fancy here:</p>
|
|
550
|
-
|
|
551
|
-
<pre><code class='language-html' lang='html'><escape>
|
|
552
|
-
<form class="semanticForms" method="post">
|
|
553
|
-
<button type="submit" name="submit">Non-grouped submit button</button>
|
|
554
|
-
<button type="submit" name="submit">Another one</button>
|
|
555
|
-
</form>
|
|
556
|
-
</escape></code></pre>
|
|
557
|
-
|
|
558
|
-
<form class="semanticForms" method="post">
|
|
559
|
-
<button type="submit" name="submit">Non-grouped submit button</button>
|
|
560
|
-
<button type="submit" name="submit">Another one</button>
|
|
561
|
-
</form>
|
|
562
|
-
|
|
563
|
-
<h6 id="buttongroupex">Button groups</h6>
|
|
564
|
-
|
|
565
|
-
<p>Driven by flexbox to intelligently align the buttons based on how many are in the group:</p>
|
|
566
|
-
|
|
567
|
-
<pre><code class='language-html' lang='html'><escape>
|
|
568
|
-
<form class="semanticForms" method="post">
|
|
569
|
-
<!-- aligns left/right -->
|
|
570
|
-
<menu>
|
|
571
|
-
<li><button type="submit" name="submit">Button 1</button></li>
|
|
572
|
-
<li><button type="submit" name="submit">Button 2</button></li>
|
|
573
|
-
</menu>
|
|
574
|
-
|
|
575
|
-
<!-- aligns left/center/right -->
|
|
576
|
-
<menu>
|
|
577
|
-
<li><button type="submit" name="submit">Button 1</button></li>
|
|
578
|
-
<li><button type="submit" name="submit">Button 2</button></li>
|
|
579
|
-
<li><button type="submit" name="submit">Button 3</button></li>
|
|
580
|
-
</menu>
|
|
581
|
-
</form>
|
|
582
|
-
</escape></code></pre>
|
|
583
|
-
|
|
584
|
-
<form class="semanticForms" method="post">
|
|
585
|
-
<!-- aligns left/right -->
|
|
586
|
-
<menu>
|
|
587
|
-
<li><button type="submit" name="submit">Button 1</button></li>
|
|
588
|
-
<li><button type="submit" name="submit">Button 2</button></li>
|
|
589
|
-
</menu>
|
|
590
|
-
|
|
591
|
-
<!-- aligns left/center/right -->
|
|
592
|
-
<menu>
|
|
593
|
-
<li><button type="submit" name="submit">Button 1</button></li>
|
|
594
|
-
<li><button type="submit" name="submit">Button 2</button></li>
|
|
595
|
-
<li><button type="submit" name="submit">Button 3</button></li>
|
|
596
|
-
</menu>
|
|
597
|
-
</form>
|
|
598
|
-
|
|
599
|
-
<p>Buttons may also be integrated into the responsive grid by treating it like a standard form input.</p>
|
|
600
|
-
|
|
601
|
-
<pre><code class='language-html' lang='html'><escape>
|
|
602
|
-
<form class="semanticForms" method="post">
|
|
603
|
-
<dl>
|
|
604
|
-
<div>
|
|
605
|
-
<dt><label for="inline-btn-input">Some input</label></dt>
|
|
606
|
-
<dd><input type="text" name="inline-btn-input" id="inline-btn-input"></dd>
|
|
607
|
-
</div>
|
|
608
|
-
|
|
609
|
-
<div>
|
|
610
|
-
<dt><label for="inline-btn">Inline button</label></dt>
|
|
611
|
-
<dd><button id="inline-btn">Inline button</button></dd>
|
|
612
|
-
</div>
|
|
613
|
-
</dl>
|
|
614
|
-
</form>
|
|
615
|
-
</escape></code></pre>
|
|
616
|
-
|
|
617
|
-
<form class="semanticForms" method="post">
|
|
618
|
-
<dl>
|
|
619
|
-
<div>
|
|
620
|
-
<dt><label for="inline-btn-input">Some input</label></dt>
|
|
621
|
-
<dd><input type="text" name="inline-btn-input" id="inline-btn-input"></dd>
|
|
622
|
-
</div>
|
|
623
|
-
|
|
624
|
-
<div>
|
|
625
|
-
<dt><label for="inline-btn">Inline button</label></dt>
|
|
626
|
-
<dd><button id="inline-btn">Inline button</button></dd>
|
|
627
|
-
</div>
|
|
628
|
-
</dl>
|
|
629
|
-
</form>
|
|
630
|
-
|
|
631
|
-
<p>You can also style a link like a Semantic Forms button by applying a class of <code>button-link</code> to it.</p>
|
|
632
|
-
|
|
633
|
-
<h4 id="checkboxesandradios">Checkboxes and radio buttons</h4>
|
|
634
|
-
|
|
635
|
-
<p>Checkboxes and radio buttons need to follow the following markup structure:</p>
|
|
636
|
-
|
|
637
|
-
<h5 id="singlecheckbox">A single checkbox</h5>
|
|
638
|
-
|
|
639
|
-
<p>Not too different than other inputs:</p>
|
|
640
|
-
|
|
641
|
-
<pre><code class='language-html' lang='html'><escape>
|
|
642
|
-
<form class="semanticForms">
|
|
643
|
-
<dl>
|
|
644
|
-
<div>
|
|
645
|
-
<dt><label for="some_field_name">Single checkbox</label></dt>
|
|
646
|
-
<dd><input type="checkbox" name="some_field_name" id="some_field_name"></dd>
|
|
647
|
-
</div>
|
|
648
|
-
</dl>
|
|
649
|
-
</form>
|
|
650
|
-
</escape></code></pre>
|
|
651
|
-
|
|
652
|
-
<form class="semanticForms">
|
|
653
|
-
<dl>
|
|
654
|
-
<div>
|
|
655
|
-
<dt><label for="some_field_name">Single checkbox</label></dt>
|
|
656
|
-
<dd><input type="checkbox" name="some_field_name" id="some_field_name"></dd>
|
|
657
|
-
</div>
|
|
658
|
-
</dl>
|
|
659
|
-
</form>
|
|
660
|
-
|
|
661
|
-
<h5 id="checkboxgroup">Checkbox group</h5>
|
|
662
|
-
|
|
663
|
-
<pre><code class='language-html' lang='html'><escape>
|
|
664
|
-
<form class="semanticForms">
|
|
665
|
-
<dl>
|
|
666
|
-
<div>
|
|
667
|
-
<dt><label data-for="some_checkboxes">Checkboxes:</label></dt>
|
|
668
|
-
<dd class="checkboxes">
|
|
669
|
-
<ul id="some_checkboxes">
|
|
670
|
-
<li><input type="checkbox" name="some_field_name" id="some_field_name_checkboxes_one"> <label for="some_field_name_checkboxes_one">One</label></li>
|
|
671
|
-
<li><input type="checkbox" name="some_field_name" id="some_field_name_checkboxes_two"> <label for="some_field_name_checkboxes_two">Two</label></li>
|
|
672
|
-
<li><input type="checkbox" name="some_field_name" id="some_field_name_checkboxes_three"> <label for="some_field_name_checkboxes_three">Three</label></li>
|
|
673
|
-
</ul>
|
|
674
|
-
</dd>
|
|
675
|
-
</div>
|
|
676
|
-
</dl>
|
|
677
|
-
</form>
|
|
678
|
-
</escape></code></pre>
|
|
679
|
-
|
|
680
|
-
<form class="semanticForms">
|
|
681
|
-
<dl>
|
|
682
|
-
<div>
|
|
683
|
-
<dt><label data-for="some_checkboxes">Checkboxes:</label></dt>
|
|
684
|
-
<dd class="checkboxes">
|
|
685
|
-
<ul id="some_checkboxes">
|
|
686
|
-
<li><input type="checkbox" name="some_field_name" id="some_field_name_checkboxes_one"> <label for="some_field_name_checkboxes_one">One</label></li>
|
|
687
|
-
<li><input type="checkbox" name="some_field_name" id="some_field_name_checkboxes_two"> <label for="some_field_name_checkboxes_two">Two</label></li>
|
|
688
|
-
<li><input type="checkbox" name="some_field_name" id="some_field_name_checkboxes_three"> <label for="some_field_name_checkboxes_three">Three</label></li>
|
|
689
|
-
</ul>
|
|
690
|
-
</dd>
|
|
691
|
-
</div>
|
|
692
|
-
</dl>
|
|
693
|
-
</form>
|
|
694
|
-
|
|
695
|
-
<h5 id="radiobuttons">Radio buttons</h5>
|
|
696
|
-
|
|
697
|
-
<pre><code class='language-html' lang='html'><escape>
|
|
698
|
-
<form class="semanticForms">
|
|
699
|
-
<dl>
|
|
700
|
-
<div>
|
|
701
|
-
<dt><label data-for="some_radios">Radios:</label></dt>
|
|
702
|
-
<dd class="radios">
|
|
703
|
-
<ul id="some_radios">
|
|
704
|
-
<li><input type="radio" name="some_field_name" id="some_field_name_radios_one"> <label for="some_field_name_radios_one">One</label></li>
|
|
705
|
-
<li><input type="radio" name="some_field_name" id="some_field_name_radios_two"> <label for="some_field_name_radios_two">Two</label></li>
|
|
706
|
-
<li><input type="radio" name="some_field_name" id="some_field_name_radios_three"> <label for="some_field_name_radios_three">Three</label></li>
|
|
707
|
-
</ul>
|
|
708
|
-
</dd>
|
|
709
|
-
</div>
|
|
710
|
-
</dl>
|
|
711
|
-
</form>
|
|
712
|
-
</escape></code></pre>
|
|
713
|
-
|
|
714
|
-
<form class="semanticForms">
|
|
715
|
-
<dl>
|
|
716
|
-
<div>
|
|
717
|
-
<dt><label data-for="some_radios">Radios:</label></dt>
|
|
718
|
-
<dd class="radios">
|
|
719
|
-
<ul id="some_radios">
|
|
720
|
-
<li><input type="radio" name="some_field_name" id="some_field_name_radios_one"> <label for="some_field_name_radios_one">One</label></li>
|
|
721
|
-
<li><input type="radio" name="some_field_name" id="some_field_name_radios_two"> <label for="some_field_name_radios_two">Two</label></li>
|
|
722
|
-
<li><input type="radio" name="some_field_name" id="some_field_name_radios_three"> <label for="some_field_name_radios_three">Three</label></li>
|
|
723
|
-
</ul>
|
|
724
|
-
</dd>
|
|
725
|
-
</div>
|
|
726
|
-
</dl>
|
|
727
|
-
</form>
|
|
728
|
-
|
|
729
|
-
<h4 id="validationstyles">Validation styles</h4>
|
|
730
|
-
|
|
731
|
-
<p>Inputs with the <code>required</code> attribute will result in a visual indicator (*) being added to its label. You can disable this indicator with the <code>data-no-asterisk</code> attribute on the label element:</p>
|
|
732
|
-
|
|
733
|
-
<pre><code class='language-html' lang='html'><escape>
|
|
734
|
-
<form class="semanticForms">
|
|
735
|
-
<dl>
|
|
736
|
-
<div>
|
|
737
|
-
<dt><label for="input" data-no-asterisk>Input label</label></dt>
|
|
738
|
-
<dd><input type="text" name="input" id="input" required>
|
|
739
|
-
</div>
|
|
740
|
-
</dl>
|
|
741
|
-
</form>
|
|
742
|
-
</escape></code></pre>
|
|
743
|
-
|
|
744
|
-
<form class="semanticForms">
|
|
745
|
-
<dl>
|
|
746
|
-
<div>
|
|
747
|
-
<dt><label for="input" data-no-asterisk>Input label</label></dt>
|
|
748
|
-
<dd><input type="text" name="input" id="input" required>
|
|
749
|
-
</div>
|
|
750
|
-
</dl>
|
|
751
|
-
</form>
|
|
752
|
-
|
|
753
|
-
<p>You can set a paragraph of text below a field to only appear when a field is invalid with the <code>data-invalid-text</code> attribute:</p>
|
|
754
|
-
|
|
755
|
-
<pre><code class='language-html' lang='html'><escape>
|
|
756
|
-
<form class="semanticForms" method="post">
|
|
757
|
-
<dl>
|
|
758
|
-
<div>
|
|
759
|
-
<dt><label for="password_validation">Password label</label></dt>
|
|
760
|
-
<dd>
|
|
761
|
-
<input type="password" name="password" id="password_validation" minlength="8" autocomplete="off">
|
|
762
|
-
<p data-invalid-text>Password must be at least 8 characters long.</p>
|
|
763
|
-
</dd>
|
|
764
|
-
</div>
|
|
765
|
-
</dl>
|
|
766
|
-
</form>
|
|
767
|
-
</escape></code></pre>
|
|
768
|
-
|
|
769
|
-
<form class="semanticForms" method="post">
|
|
770
|
-
<dl>
|
|
771
|
-
<div>
|
|
772
|
-
<dt><label for="password_validation">Password label</label></dt>
|
|
773
|
-
<dd>
|
|
774
|
-
<input type="password" name="password" id="password_validation" minlength="8" autocomplete="off">
|
|
775
|
-
<p data-invalid-text>Password must be at least 8 characters long.</p>
|
|
776
|
-
</dd>
|
|
777
|
-
</div>
|
|
778
|
-
</dl>
|
|
779
|
-
</form>
|
|
780
|
-
|
|
781
|
-
<p>You can adjust the tooltip text of the asterisk with the <code>data-asterisk-text</code> attribute:</p>
|
|
782
|
-
|
|
783
|
-
<pre><code class='language-html' lang='html'><escape>
|
|
784
|
-
<form class="semanticForms">
|
|
785
|
-
<dl>
|
|
786
|
-
<div>
|
|
787
|
-
<dt><label for="input_validation" data-asterisk-text="This is a custom tooltip.">Input label</label></dt>
|
|
788
|
-
<dd><input type="text" name="input" id="input_validation" required>
|
|
789
|
-
</div>
|
|
790
|
-
</dl>
|
|
791
|
-
</form>
|
|
792
|
-
</escape></code></pre>
|
|
793
|
-
|
|
794
|
-
<form class="semanticForms">
|
|
795
|
-
<dl>
|
|
796
|
-
<div>
|
|
797
|
-
<dt><label for="input_validation" data-asterisk-text="This is a custom tooltip.">Input label</label></dt>
|
|
798
|
-
<dd><input type="text" name="input" id="input_validation" required>
|
|
799
|
-
</div>
|
|
800
|
-
</dl>
|
|
801
|
-
</form>
|
|
802
|
-
|
|
803
|
-
<h4 id="rangeInputsThatDisplayValues">Range inputs that display values</h4>
|
|
804
|
-
|
|
805
|
-
<p>Add a class of <code>displayValue</code> to any <code><!--#<input type="range">--></code> element to make its value display on the label:</p>
|
|
806
|
-
|
|
807
|
-
<pre><code class='language-html' lang='html'><escape>
|
|
808
|
-
<form class="semanticForms">
|
|
809
|
-
<dl>
|
|
810
|
-
<div>
|
|
811
|
-
<dt><label for="rangeValue">Range value</label></dt>
|
|
812
|
-
<dd><input id="rangeValue" name="rangeValue" type="range" class="displayValue"></dd>
|
|
813
|
-
</div>
|
|
814
|
-
</dl>
|
|
815
|
-
</form>
|
|
816
|
-
</escape></code></pre>
|
|
817
|
-
|
|
818
|
-
<form class="semanticForms">
|
|
819
|
-
<dl>
|
|
820
|
-
<div>
|
|
821
|
-
<dt><label for="rangeValue">Range value</label></dt>
|
|
822
|
-
<dd><input id="rangeValue" name="rangeValue" type="range" class="displayValue"></dd>
|
|
823
|
-
</div>
|
|
824
|
-
</dl>
|
|
825
|
-
</form>
|
|
826
|
-
|
|
827
|
-
<h3 id="lightanddarkmode">Light mode and dark mode</h3>
|
|
828
|
-
|
|
829
|
-
<p>Light mode and dark mode will be detected automatically based on operating system preference. To set it manually, you can apply an additional class of <code>light</code> or <code>dark</code> to your <code><!--#<form>--></code> elements to force the mode.</p>
|
|
830
|
-
|
|
831
66
|
<h3 id="lowflowmode">Low flow (JavaScript disabled) mode</h3>
|
|
832
67
|
|
|
833
68
|
<p>The low flow will be displayed if JS is disabled.</p>
|
|
@@ -836,23 +71,6 @@
|
|
|
836
71
|
|
|
837
72
|
<p>The low-flow mode reverts the float label pattern to traditional labels and doesn't include other JS-exclusive enhancements, but preserves the other visual design enhancements driven purely by CSS.</p>
|
|
838
73
|
|
|
839
|
-
<h3 id="overriding">Overriding default styles</h3>
|
|
840
|
-
|
|
841
|
-
<p>The most convenient way to override the default styles in Semantic Forms is to override the built-in CSS variables.</p>
|
|
842
|
-
|
|
843
|
-
<p>For example:</p>
|
|
844
|
-
|
|
845
|
-
<pre><code class='language-css' lang='css'><escape>
|
|
846
|
-
form.semanticForms {
|
|
847
|
-
/* will overwrite the default semantic-forms values */
|
|
848
|
-
--semanticFormsFontFamily: monospace;
|
|
849
|
-
--semanticFormsTextColor: blue;
|
|
850
|
-
--semanticFormsInputMinWidth: 300px;
|
|
851
|
-
}
|
|
852
|
-
</escape></code></pre>
|
|
853
|
-
|
|
854
|
-
<p>For a complete list of CSS variables you can override, <a href="https://github.com/rooseveltframework/semantic-forms/blob/main/semanticForms.scss">see the top of semanticForms.scss</a>.</p>
|
|
855
|
-
|
|
856
74
|
<h3 id="more">More</h3>
|
|
857
75
|
|
|
858
76
|
<p>See a page demoing all features <a href="https://rooseveltframework.org/docs/semantic-forms/latest/fullDemo/">here</a>.</p>
|