100+ copy-paste UI components in plain HTML and CSS: no dependencies, no build step.

0 downloads

dbbasic-web-native/test-input-forms.html
Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-web-native.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-web-native.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-web-native.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

danq9 Add canonical.html v1.0 - The single source of truth for usability standards fb6e650 1 year ago History
test-input-forms.html · 23.0 KB · 618 lines
1<!DOCTYPE html>
2<html lang="en">
3<head>
4 <meta charset="UTF-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 <title>Semantic Input Form Testing</title>
7 <script src="semantic-components.js"></script>
8 <style>
9 body {
10 background: #000;
11 color: #fff;
12 font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
13 padding: 40px;
14 max-width: 1200px;
15 margin: 0 auto;
16 }
17
18 h1 {
19 margin-bottom: 40px;
20 }
21
22 .demo-section {
23 margin-bottom: 80px;
24 }
25
26 .demo-section h2 {
27 font-size: 20px;
28 color: #8e8e93;
29 margin-bottom: 30px;
30 }
31
32 .demo-section p {
33 color: #8e8e93;
34 margin-bottom: 20px;
35 line-height: 1.6;
36 }
37
38 .form-container {
39 background: #1c1c1e;
40 border-radius: 12px;
41 padding: 30px;
42 margin-bottom: 30px;
43 }
44
45 .form-title {
46 font-size: 18px;
47 font-weight: 600;
48 margin: 0 0 20px 0;
49 }
50
51 /* Form layouts */
52 .form-group {
53 margin-bottom: 24px;
54 }
55
56 .form-group:last-child {
57 margin-bottom: 0;
58 }
59
60 .form-label {
61 display: block;
62 margin-bottom: 8px;
63 font-size: 14px;
64 font-weight: 500;
65 color: #fff;
66 }
67
68 .form-label.required::after {
69 content: " *";
70 color: #ff453a;
71 }
72
73 .form-help {
74 display: block;
75 margin-top: 6px;
76 font-size: 13px;
77 color: #8e8e93;
78 }
79
80 .form-error {
81 display: block;
82 margin-top: 6px;
83 font-size: 13px;
84 color: #ff453a;
85 }
86
87 .form-success {
88 display: block;
89 margin-top: 6px;
90 font-size: 13px;
91 color: #30d158;
92 }
93
94 /* Two-column layout */
95 .form-row {
96 display: grid;
97 grid-template-columns: repeat(2, 1fr);
98 gap: 20px;
99 margin-bottom: 24px;
100 }
101
102 /* Three-column layout */
103 .form-row-3 {
104 display: grid;
105 grid-template-columns: repeat(3, 1fr);
106 gap: 16px;
107 margin-bottom: 24px;
108 }
109
110 /* Inline form */
111 .form-inline {
112 display: flex;
113 gap: 12px;
114 align-items: flex-end;
115 }
116
117 .form-inline .form-group {
118 flex: 1;
119 margin-bottom: 0;
120 }
121
122 /* Input group with addon */
123 .input-group {
124 display: flex;
125 gap: 0;
126 }
127
128 .input-addon {
129 background: #2c2c2e;
130 border: 2px solid #3a3a3c;
131 padding: 12px 16px;
132 display: flex;
133 align-items: center;
134 color: #8e8e93;
135 font-size: 15px;
136 }
137
138 .input-addon-left {
139 border-radius: 8px 0 0 8px;
140 border-right: none;
141 }
142
143 .input-addon-right {
144 border-radius: 0 8px 8px 0;
145 border-left: none;
146 }
147
148 .input-group semantic-input {
149 flex: 1;
150 }
151
152 /* Responsive */
153 @media (max-width: 768px) {
154 .form-row, .form-row-3 {
155 grid-template-columns: 1fr;
156 }
157
158 .form-inline {
159 flex-direction: column;
160 align-items: stretch;
161 }
162
163 .form-inline .form-group {
164 margin-bottom: 24px;
165 }
166 }
167
168 /* Action buttons */
169 .form-actions {
170 display: flex;
171 gap: 12px;
172 margin-top: 32px;
173 padding-top: 24px;
174 border-top: 1px solid #3a3a3c;
175 }
176
177 /* Search bar styling */
178 .search-bar {
179 position: relative;
180 max-width: 600px;
181 }
182
183 .search-icon {
184 position: absolute;
185 left: 16px;
186 top: 50%;
187 transform: translateY(-50%);
188 color: #8e8e93;
189 font-size: 18px;
190 pointer-events: none;
191 }
192
193 .search-bar semantic-input {
194 padding-left: 44px;
195 }
196 </style>
197</head>
198<body>
199 <h1>semantic-input Form Testing</h1>
200
201 <div class="demo-section">
202 <h2>Single Column Form</h2>
203 <p>Traditional vertical form layout with full-width inputs.</p>
204
205 <div class="form-container">
206 <h3 class="form-title">Create Account</h3>
207
208 <div class="form-group">
209 <label class="form-label required">Full Name</label>
210 <semantic-input type="text" placeholder="John Doe" intent="primary"></semantic-input>
211 <span class="form-help">Enter your first and last name</span>
212 </div>
213
214 <div class="form-group">
215 <label class="form-label required">Email Address</label>
216 <semantic-input type="email" placeholder="john@example.com" intent="primary"></semantic-input>
217 <span class="form-help">We'll never share your email with anyone</span>
218 </div>
219
220 <div class="form-group">
221 <label class="form-label required">Password</label>
222 <semantic-input type="password" placeholder="Enter a strong password" intent="primary"></semantic-input>
223 <span class="form-help">Must be at least 8 characters with a mix of letters and numbers</span>
224 </div>
225
226 <div class="form-group">
227 <label class="form-label required">Confirm Password</label>
228 <semantic-input type="password" placeholder="Re-enter your password" intent="primary"></semantic-input>
229 </div>
230
231 <div class="form-actions">
232 <semantic-action intent="primary">Create Account</semantic-action>
233 <semantic-action intent="secondary">Cancel</semantic-action>
234 </div>
235 </div>
236 </div>
237
238 <div class="demo-section">
239 <h2>Two-Column Form</h2>
240 <p>Efficient layout for forms with many fields, optimized for desktop.</p>
241
242 <div class="form-container">
243 <h3 class="form-title">Billing Information</h3>
244
245 <div class="form-row">
246 <div class="form-group">
247 <label class="form-label required">First Name</label>
248 <semantic-input type="text" placeholder="John" intent="primary"></semantic-input>
249 </div>
250 <div class="form-group">
251 <label class="form-label required">Last Name</label>
252 <semantic-input type="text" placeholder="Doe" intent="primary"></semantic-input>
253 </div>
254 </div>
255
256 <div class="form-group">
257 <label class="form-label required">Street Address</label>
258 <semantic-input type="text" placeholder="123 Main Street" intent="primary"></semantic-input>
259 </div>
260
261 <div class="form-row">
262 <div class="form-group">
263 <label class="form-label required">City</label>
264 <semantic-input type="text" placeholder="San Francisco" intent="primary"></semantic-input>
265 </div>
266 <div class="form-group">
267 <label class="form-label required">State</label>
268 <semantic-input type="text" placeholder="CA" intent="primary"></semantic-input>
269 </div>
270 </div>
271
272 <div class="form-row">
273 <div class="form-group">
274 <label class="form-label required">ZIP Code</label>
275 <semantic-input type="text" placeholder="94102" intent="primary"></semantic-input>
276 </div>
277 <div class="form-group">
278 <label class="form-label required">Country</label>
279 <semantic-input type="text" placeholder="United States" intent="primary"></semantic-input>
280 </div>
281 </div>
282
283 <div class="form-row">
284 <div class="form-group">
285 <label class="form-label required">Phone Number</label>
286 <semantic-input type="tel" placeholder="(555) 123-4567" intent="primary"></semantic-input>
287 </div>
288 <div class="form-group">
289 <label class="form-label">Company (Optional)</label>
290 <semantic-input type="text" placeholder="Acme Inc." intent="primary"></semantic-input>
291 </div>
292 </div>
293
294 <div class="form-actions">
295 <semantic-action intent="primary">Save Billing Info</semantic-action>
296 <semantic-action intent="secondary">Cancel</semantic-action>
297 </div>
298 </div>
299 </div>
300
301 <div class="demo-section">
302 <h2>Three-Column Form</h2>
303 <p>Compact layout for related fields like date inputs.</p>
304
305 <div class="form-container">
306 <h3 class="form-title">Payment Details</h3>
307
308 <div class="form-group">
309 <label class="form-label required">Card Number</label>
310 <semantic-input type="text" placeholder="1234 5678 9012 3456" intent="primary"></semantic-input>
311 </div>
312
313 <div class="form-row-3">
314 <div class="form-group">
315 <label class="form-label required">Month</label>
316 <semantic-input type="text" placeholder="MM" intent="primary"></semantic-input>
317 </div>
318 <div class="form-group">
319 <label class="form-label required">Year</label>
320 <semantic-input type="text" placeholder="YY" intent="primary"></semantic-input>
321 </div>
322 <div class="form-group">
323 <label class="form-label required">CVV</label>
324 <semantic-input type="text" placeholder="123" intent="primary"></semantic-input>
325 </div>
326 </div>
327
328 <div class="form-group">
329 <label class="form-label required">Cardholder Name</label>
330 <semantic-input type="text" placeholder="Name on card" intent="primary"></semantic-input>
331 </div>
332
333 <div class="form-actions">
334 <semantic-action intent="primary">Process Payment</semantic-action>
335 <semantic-action intent="secondary">Cancel</semantic-action>
336 </div>
337 </div>
338 </div>
339
340 <div class="demo-section">
341 <h2>Inline Form</h2>
342 <p>Compact horizontal layout for simple forms like search or subscribe.</p>
343
344 <div class="form-container">
345 <h3 class="form-title">Newsletter Signup</h3>
346 <p style="color: #8e8e93; font-size: 14px; margin-bottom: 20px;">
347 Get weekly updates and exclusive content delivered to your inbox.
348 </p>
349
350 <div class="form-inline">
351 <div class="form-group">
352 <label class="form-label">Email Address</label>
353 <semantic-input type="email" placeholder="you@example.com" intent="primary"></semantic-input>
354 </div>
355 <semantic-action intent="primary">Subscribe</semantic-action>
356 </div>
357 </div>
358
359 <div class="form-container">
360 <h3 class="form-title">Quick Search</h3>
361
362 <div class="form-inline">
363 <div class="form-group" style="flex: 2;">
364 <label class="form-label">Search Query</label>
365 <semantic-input type="text" placeholder="Search products, articles, or help docs..." intent="primary"></semantic-input>
366 </div>
367 <div class="form-group">
368 <label class="form-label">Category</label>
369 <semantic-input type="text" placeholder="All" intent="primary"></semantic-input>
370 </div>
371 <semantic-action intent="primary">Search</semantic-action>
372 </div>
373 </div>
374 </div>
375
376 <div class="demo-section">
377 <h2>Input States</h2>
378 <p>Different states and validation feedback for inputs.</p>
379
380 <div class="form-container">
381 <h3 class="form-title">Form Validation Examples</h3>
382
383 <div class="form-group">
384 <label class="form-label required">Username (Success State)</label>
385 <semantic-input type="text" value="johndoe" intent="success"></semantic-input>
386 <span class="form-success">✓ Username is available</span>
387 </div>
388
389 <div class="form-group">
390 <label class="form-label required">Email (Error State)</label>
391 <semantic-input type="email" value="invalid-email" intent="danger"></semantic-input>
392 <span class="form-error">✗ Please enter a valid email address</span>
393 </div>
394
395 <div class="form-group">
396 <label class="form-label required">Password (Warning State)</label>
397 <semantic-input type="password" value="weak" intent="warning"></semantic-input>
398 <span class="form-error" style="color: #ff9f0a;">⚠ Password is too weak</span>
399 </div>
400
401 <div class="form-group">
402 <label class="form-label">Bio (Neutral/Default State)</label>
403 <semantic-input type="text" placeholder="Tell us about yourself..." intent="neutral"></semantic-input>
404 <span class="form-help">Optional field</span>
405 </div>
406
407 <div class="form-group">
408 <label class="form-label">Disabled Input</label>
409 <semantic-input type="text" value="Cannot edit this" disabled intent="neutral"></semantic-input>
410 <span class="form-help">This field is read-only</span>
411 </div>
412 </div>
413 </div>
414
415 <div class="demo-section">
416 <h2>Search Bars</h2>
417 <p>Common search input patterns with icons.</p>
418
419 <div class="form-container">
420 <h3 class="form-title">Global Search</h3>
421 <div class="search-bar">
422 <span class="search-icon">🔍</span>
423 <semantic-input type="text" placeholder="Search everything..." intent="primary" style="padding-left: 44px;"></semantic-input>
424 </div>
425 </div>
426
427 <div class="form-container">
428 <h3 class="form-title">Compact Search</h3>
429 <semantic-input type="text" placeholder="🔍 Quick search..." intent="neutral"></semantic-input>
430 </div>
431 </div>
432
433 <div class="demo-section">
434 <h2>Input Types Grid</h2>
435 <p>All HTML5 input types in a grid layout.</p>
436
437 <div class="form-container">
438 <h3 class="form-title">All Input Types</h3>
439
440 <div class="form-row">
441 <div class="form-group">
442 <label class="form-label">Text</label>
443 <semantic-input type="text" placeholder="Text input" intent="primary"></semantic-input>
444 </div>
445 <div class="form-group">
446 <label class="form-label">Email</label>
447 <semantic-input type="email" placeholder="email@example.com" intent="primary"></semantic-input>
448 </div>
449 </div>
450
451 <div class="form-row">
452 <div class="form-group">
453 <label class="form-label">Password</label>
454 <semantic-input type="password" placeholder="Password" intent="primary"></semantic-input>
455 </div>
456 <div class="form-group">
457 <label class="form-label">Number</label>
458 <semantic-input type="number" placeholder="42" intent="primary"></semantic-input>
459 </div>
460 </div>
461
462 <div class="form-row">
463 <div class="form-group">
464 <label class="form-label">Tel</label>
465 <semantic-input type="tel" placeholder="(555) 123-4567" intent="primary"></semantic-input>
466 </div>
467 <div class="form-group">
468 <label class="form-label">URL</label>
469 <semantic-input type="url" placeholder="https://example.com" intent="primary"></semantic-input>
470 </div>
471 </div>
472
473 <div class="form-row">
474 <div class="form-group">
475 <label class="form-label">Date</label>
476 <semantic-input type="date" intent="primary"></semantic-input>
477 </div>
478 <div class="form-group">
479 <label class="form-label">Time</label>
480 <semantic-input type="time" intent="primary"></semantic-input>
481 </div>
482 </div>
483
484 <div class="form-row">
485 <div class="form-group">
486 <label class="form-label">Color</label>
487 <semantic-input type="color" value="#409cff" intent="primary"></semantic-input>
488 </div>
489 <div class="form-group">
490 <label class="form-label">Range</label>
491 <semantic-input type="range" min="0" max="100" value="50" intent="primary"></semantic-input>
492 </div>
493 </div>
494 </div>
495 </div>
496
497 <div class="demo-section">
498 <h2>Real-World Contact Form</h2>
499 <p>Complete contact form with mixed layout and validation.</p>
500
501 <div class="form-container" style="max-width: 700px;">
502 <h3 class="form-title">Get in Touch</h3>
503 <p style="color: #8e8e93; font-size: 14px; margin-bottom: 24px;">
504 Have a question or want to work together? Fill out the form below and we'll get back to you within 24 hours.
505 </p>
506
507 <div class="form-row">
508 <div class="form-group">
509 <label class="form-label required">First Name</label>
510 <semantic-input type="text" placeholder="John" intent="primary"></semantic-input>
511 </div>
512 <div class="form-group">
513 <label class="form-label required">Last Name</label>
514 <semantic-input type="text" placeholder="Doe" intent="primary"></semantic-input>
515 </div>
516 </div>
517
518 <div class="form-group">
519 <label class="form-label required">Email</label>
520 <semantic-input type="email" placeholder="john@example.com" intent="primary"></semantic-input>
521 </div>
522
523 <div class="form-group">
524 <label class="form-label">Phone</label>
525 <semantic-input type="tel" placeholder="(555) 123-4567" intent="primary"></semantic-input>
526 <span class="form-help">Optional - we'll only call if necessary</span>
527 </div>
528
529 <div class="form-group">
530 <label class="form-label required">Subject</label>
531 <semantic-input type="text" placeholder="What can we help you with?" intent="primary"></semantic-input>
532 </div>
533
534 <div class="form-group">
535 <label class="form-label required">Message</label>
536 <semantic-input type="text" placeholder="Tell us more about your inquiry..." intent="primary"></semantic-input>
537 <span class="form-help">Minimum 10 characters</span>
538 </div>
539
540 <div class="form-actions">
541 <semantic-action intent="primary">Send Message</semantic-action>
542 <semantic-action intent="secondary">Clear Form</semantic-action>
543 </div>
544 </div>
545 </div>
546
547 <div class="demo-section">
548 <h2>Settings Form</h2>
549 <p>Multi-section settings form with various input types.</p>
550
551 <div class="form-container">
552 <h3 class="form-title">Account Settings</h3>
553
554 <div style="margin-bottom: 32px;">
555 <h4 style="font-size: 16px; margin: 0 0 16px 0; color: #409cff;">Profile Information</h4>
556 <div class="form-row">
557 <div class="form-group">
558 <label class="form-label">Display Name</label>
559 <semantic-input type="text" value="John Doe" intent="primary"></semantic-input>
560 </div>
561 <div class="form-group">
562 <label class="form-label">Username</label>
563 <semantic-input type="text" value="@johndoe" intent="primary"></semantic-input>
564 </div>
565 </div>
566 <div class="form-group">
567 <label class="form-label">Bio</label>
568 <semantic-input type="text" value="Designer & Developer" intent="primary"></semantic-input>
569 </div>
570 </div>
571
572 <div style="margin-bottom: 32px;">
573 <h4 style="font-size: 16px; margin: 0 0 16px 0; color: #30d158;">Security</h4>
574 <div class="form-group">
575 <label class="form-label">Current Password</label>
576 <semantic-input type="password" placeholder="Enter current password" intent="primary"></semantic-input>
577 </div>
578 <div class="form-row">
579 <div class="form-group">
580 <label class="form-label">New Password</label>
581 <semantic-input type="password" placeholder="Enter new password" intent="primary"></semantic-input>
582 </div>
583 <div class="form-group">
584 <label class="form-label">Confirm New Password</label>
585 <semantic-input type="password" placeholder="Confirm new password" intent="primary"></semantic-input>
586 </div>
587 </div>
588 </div>
589
590 <div>
591 <h4 style="font-size: 16px; margin: 0 0 16px 0; color: #ff9f0a;">Notifications</h4>
592 <div class="form-group">
593 <label class="form-label">Email Notifications</label>
594 <semantic-input type="email" value="john@example.com" intent="primary"></semantic-input>
595 <span class="form-help">Where you'll receive updates and alerts</span>
596 </div>
597 </div>
598
599 <div class="form-actions">
600 <semantic-action intent="primary">Save Changes</semantic-action>
601 <semantic-action intent="secondary">Reset</semantic-action>
602 <semantic-action intent="secondary">Delete Account</semantic-action>
603 </div>
604 </div>
605 </div>
606
607 <script>
608 // Log form interactions
609 document.querySelectorAll('semantic-input').forEach((input, index) => {
610 input.addEventListener('change', (e) => {
611 console.log(`Input ${index + 1} changed:`, e.target.value);
612 });
613 });
614
615 console.log('Total inputs on page:', document.querySelectorAll('semantic-input').length);
616 </script>
617</body>
618</html>