-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocs.html
More file actions
974 lines (881 loc) · 38 KB
/
Copy pathdocs.html
File metadata and controls
974 lines (881 loc) · 38 KB
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
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sprinkle - Documentation</title>
<link rel="stylesheet" href="./style.css">
<link rel="stylesheet" href="./sprinkle.min.css">
<meta name="sprinkle-svg-path" content="./icons/">
<style>
.doc-directive {
margin-bottom: 2rem;
}
.doc-directive h3 {
font-size: 1rem;
margin: 0 0 0.5rem;
}
.doc-directive p {
color: var(--text-color);
margin-bottom: 0.5rem;
}
.doc-demo {
padding: 1rem;
border: 1px solid var(--border-color);
border-radius: 6px;
margin-bottom: 0.5rem;
background: var(--bg-color);
}
.doc-code pre {
margin: 0;
}
</style>
</head>
<body>
<header class="top-nav">
<nav>
<a href="./index.html" class="brand"><span class="bracket">[</span><span class="bracket">]</span> spr<span class="accent">inkle</span></a>
<a href="./docs.html">Docs</a>
<a href="./examples/dashboard.html">Examples</a>
<a href="https://github.com/forge-kernel/sprinkle">GitHub</a>
</nav>
</header>
<div class="doc-shell" shell>
<aside sidebar="left">
<ul>
<li>
<details open>
<summary>Input & textarea</summary>
<ul>
<li><a href="#autosize">autosize</a></li>
<li><a href="#auto-width">auto-width</a></li>
<li><a href="#clearable">clearable</a></li>
<li><a href="#character-count">character-count</a></li>
<li><a href="#auto-select">auto-select</a></li>
<li><a href="#enter-submit">enter-submit</a></li>
<li><a href="#drop-zone">drop-zone</a></li>
<li><a href="#leading">leading / suffix</a></li>
<li><a href="#prefix">prefix</a></li>
<li><a href="#combo-box">combo-box</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary>Validation</summary>
<ul>
<li><a href="#error-message">error-message</a></li>
<li><a href="#allowed-domains">allowed-domains</a></li>
<li><a href="#mask">mask</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary>Date / time</summary>
<ul>
<li><a href="#no-past">no-past / no-future</a></li>
<li><a href="#disable-days">disable-days</a></li>
<li><a href="#business-hours">business-hours</a></li>
<li><a href="#date-range">date-range</a></li>
<li><a href="#date-input">date-input</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary>Dialog</summary>
<ul>
<li><a href="#drawer">drawer</a></li>
<li><a href="#modal">modal</a></li>
<li><a href="#command-for">command-for</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary>Details / disclosure</summary>
<ul>
<li><a href="#accordion">accordion</a></li>
<li><a href="#dropdown">dropdown</a></li>
<li><a href="#close-outside">close-outside</a></li>
<li><a href="#group-toggle">group-toggle</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary>Visual</summary>
<ul>
<li><a href="#sticky">sticky</a></li>
<li><a href="#zoomable">zoomable</a></li>
<li><a href="#copy">copy</a></li>
<li><a href="#loading">loading</a></li>
<li><a href="#switch">switch</a></li>
<li><a href="#truncate">truncate</a></li>
<li><a href="#tooltip">tooltip</a></li>
<li><a href="#avatar">avatar</a></li>
<li><a href="#breadcrumb">breadcrumb</a></li>
<li><a href="#nav">nav</a></li>
<li><a href="#card">card</a></li>
<li><a href="#count-up">count-up</a></li>
<li><a href="#shell">shell</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary>Other</summary>
<ul>
<li><a href="#confirm-leave">confirm-leave</a></li>
<li><a href="#otp">otp</a></li>
<li><a href="#theme-toggle">theme-toggle</a></li>
<li><a href="#enhance">enhance</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary>Guides</summary>
<ul>
<li><a href="#icons">Icons</a></li>
<li><a href="#accessibility">Accessibility</a></li>
<li><a href="#extending">Extending</a></li>
</ul>
</details>
</li>
</ul>
</aside>
<article content>
<main>
<h1 style="margin-top:0;">Documentation</h1>
<button theme-toggle aria-label="Switch to dark theme">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="5"/><path d="M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"/></svg>
</button>
<p class="lead">Complete list of Sprinkle directives, usage examples, and guides.</p>
<hr>
<!-- ──── Input ──── -->
<section id="input">Input</h2>
<div class="doc-directive" id="autosize">
<h3><code>autosize</code></h3>
<p>On: <textarea></p>
<div class="doc-demo">
<textarea autosize placeholder="Type here — it grows…"></textarea>
</div>
<div class="doc-code"><pre><code><textarea autosize placeholder="Type here — it grows…"></textarea></code></pre></div>
</div>
<div class="doc-directive" id="auto-width">
<h3><code>auto-width</code></h3>
<p>On: <input>, <textarea></p>
<div class="doc-demo">
<input auto-width placeholder="Full width input" />
</div>
<div class="doc-code"><pre><code><input auto-width placeholder="Full width input" /></code></pre></div>
</div>
<div class="doc-directive" id="clearable">
<h3><code>clearable</code></h3>
<p>On: <input></p>
<div class="doc-demo">
<input clearable placeholder="Search…" value="Type and clear" />
</div>
<div class="doc-code"><pre><code><input clearable placeholder="Search…" /></code></pre></div>
</div>
<div class="doc-directive" id="character-count">
<h3><code>character-count</code></h3>
<p>On: <input>, <textarea></p>
<div class="doc-demo">
<input character-count maxlength="16" placeholder="Max 16 characters" />
<textarea character-count maxlength="160" placeholder="Max 160 characters" rows="2"></textarea>
</div>
<div class="doc-code"><pre><code><input character-count maxlength="16" /></code></pre></div>
</div>
<div class="doc-directive" id="auto-select">
<h3><code>auto-select</code></h3>
<p>On: <input></p>
<div class="doc-demo">
<input value="https://example.com/share/abc123" auto-select readonly />
</div>
<div class="doc-code"><pre><code><input value="https://…" auto-select readonly /></code></pre></div>
</div>
<div class="doc-directive" id="enter-submit">
<h3><code>enter-submit</code></h3>
<p>On: <textarea></p>
<div class="doc-demo">
<textarea enter-submit placeholder="Write a message… Ctrl+Enter to send" rows="2"></textarea>
</div>
<div class="doc-code"><pre><code><textarea enter-submit></textarea></code></pre></div>
</div>
<div class="doc-directive" id="drop-zone">
<h3><code>drop-zone</code></h3>
<p>On: <label> wrapping <input type="file">. Supports drag-and-drop, click to browse, image preview, multiple files, and removal.</p>
<div class="doc-demo">
<p>Single image (avatar):</p>
<label drop-zone>
<span>Drag your avatar here or click to browse</span>
<input type="file" name="avatar" accept="image/*" />
</label>
<p>Multiple files (any type):</p>
<label drop-zone>
<span>Drag files here or click to browse</span>
<input type="file" name="files" multiple />
</label>
</div>
<div class="doc-code"><pre><code><label drop-zone>
<span>Drag your avatar here or click to browse</span>
<input type="file" name="avatar" accept="image/*" />
</label></code></pre></div>
</div>
<div class="doc-directive" id="leading-suffix">
<h3><code>leading</code> / <code>suffix</code></h3>
<p>On: <input></p>
<div class="doc-demo">
<input leading="search" placeholder="Search…" />
<input type="password" leading="lock" suffix="eye" value="secret" />
<input type="search" suffix="close" placeholder="Type to search…" />
</div>
<div class="doc-code"><pre><code><input leading="search" />
<input type="password" leading="lock" suffix="eye" /></code></pre></div>
</div>
<div class="doc-directive" id="prefix">
<h3><code>prefix</code></h3>
<p>On: <input type="url"></p>
<div class="doc-demo">
<input type="url" prefix placeholder="your-site.com" />
<input type="url" prefix="upper.do" placeholder="subdomain" />
</div>
<div class="doc-code"><pre><code><input type="url" prefix />
<input type="url" prefix="upper.do" /></code></pre></div>
</div>
<div class="doc-directive" id="combo-box">
<h3><code>combo-box</code></h3>
<p>On: <select></p>
<div class="doc-demo">
<form>
<select name="tenant_id" combo-box searchable>
<option value="1" data-avatar="https://i.abcnewsfe.com/a/10669fab-5a56-4555-8012-0b3d83369352/avatar-the-way-of-water-07-ht-jt-220907_1662579296232_hpMain_1x1.jpg?w=992">Upper Platform</option>
<option value="2" data-avatar="https://i.abcnewsfe.com/a/10669fab-5a56-4555-8012-0b3d83369352/avatar-the-way-of-water-07-ht-jt-220907_1662579296232_hpMain_1x1.jpg?w=992" selected>Nimbus Runtime</option>
<option value="3" data-avatar="https://i.abcnewsfe.com/a/10669fab-5a56-4555-8012-0b3d83369352/avatar-the-way-of-water-07-ht-jt-220907_1662579296232_hpMain_1x1.jpg?w=992">Forge Core</option>
</select>
</form>
<p>With <code>leading</code> / <code>suffix</code> icons:</p>
<select combo-box leading="search" suffix="settings">
<option value="a">Option A</option>
<option value="b" selected>Option B</option>
<option value="c">Option C</option>
</select>
<p>Multi-select with <code>multiple</code>:</p>
<select name="tags[]" multiple combo-box searchable>
<option value="php">PHP</option>
<option value="js" selected>JavaScript</option>
<option value="css" selected>CSS</option>
<option value="html">HTML</option>
<option value="sql">SQL</option>
<option value="python">Python</option>
</select>
<p>With <code>category</code> groups:</p>
<select name="framework" combo-box searchable>
<option value="react" category="Frontend">React</option>
<option value="vue" category="Frontend">Vue</option>
<option value="angular" category="Frontend">Angular</option>
<option value="laravel" category="Backend">Laravel</option>
<option value="django" category="Backend">Django</option>
<option value="rails" category="Backend">Ruby on Rails</option>
<option value="postgres" category="Database">PostgreSQL</option>
<option value="mysql" category="Database">MySQL</option>
<option value="mongo" category="Database">MongoDB</option>
</select>
</div>
<div class="doc-code"><pre><code><select combo-box searchable>
<option value="1" data-avatar="…">Upper Platform</option>
<option value="2" data-avatar="…" selected>Nimbus Runtime</option>
<option value="3" data-avatar="…">Forge Core</option>
</select></code></pre></div>
</div>
<hr>
<!-- ──── Validation ──── -->
<section id="validation">Validation</h2>
<div class="doc-directive" id="error-message">
<h3><code>error-message</code></h3>
<p>On: any validated element</p>
<div class="doc-demo">
<form>
<input type="text" minlength="4" maxlength="5" required error-message-maxlength="Too long" error-message-minlength="At least 4 characters!" error-message-required="Can't be blank." placeholder="4–5 chars required" />
<input type="email" required error-message="We need a valid email." placeholder="Your email" />
<button type="submit">Submit</button>
</form>
</div>
<div class="doc-code"><pre><code><input required error-message-required="Can't be blank." /></code></pre></div>
</div>
<div class="doc-directive" id="allowed-domains">
<h3><code>allowed-domains</code></h3>
<p>On: <input type="email|url"></p>
<div class="doc-demo">
<form>
<input type="email" allowed-domains="upper.do,example.com" required placeholder="Only @upper.do or @example.com" />
<button type="submit">Submit</button>
</form>
</div>
<div class="doc-code"><pre><code><input type="email" allowed-domains="upper.do,example.com" /></code></pre></div>
</div>
<div class="doc-directive" id="mask">
<h3><code>mask</code></h3>
<p>On: <input type="tel|text"></p>
<div class="doc-demo">
<input type="tel" mask placeholder="Phone" />
<input type="text" mask="00/00/0000" placeholder="DD/MM/YYYY" />
</div>
<div class="doc-code"><pre><code><input type="tel" mask />
<input type="text" mask="00/00/0000" /></code></pre></div>
</div>
<hr>
<!-- ──── Date / Time ──── -->
<section id="datetime">Date / Time</h2>
<div class="doc-directive" id="no-past">
<h3><code>no-past</code> / <code>no-future</code></h3>
<p>On: <input type="date|datetime-local"></p>
<div class="doc-demo">
<input type="date" no-past />
<input type="date" no-future />
</div>
<div class="doc-code"><pre><code><input type="date" no-past />
<input type="date" no-future /></code></pre></div>
</div>
<div class="doc-directive" id="disable-days">
<h3><code>disable-days</code></h3>
<p>On: <input type="date|datetime-local"></p>
<div class="doc-demo">
<input type="date" disable-days="weekends" />
<input type="date" disable-days="sat,sun" />
</div>
<div class="doc-code"><pre><code><input type="date" disable-days="weekends" /></code></pre></div>
</div>
<div class="doc-directive" id="business-hours">
<h3><code>business-hours</code></h3>
<p>On: <input type="datetime-local"></p>
<div class="doc-demo">
<input type="datetime-local" business-hours="09:00-18:00" />
</div>
<div class="doc-code"><pre><code><input type="datetime-local" business-hours="09:00-18:00" /></code></pre></div>
</div>
<div class="doc-directive" id="date-range">
<h3><code>date-range</code></h3>
<p>On: <input type="date|datetime-local">. Add <code>date-input</code> to enable the custom calendar picker with dual-month range view.</p>
<div class="doc-demo">
<input type="date" date-input date-range="trip" data-range-type="start" name="trip_start" />
<input type="date" date-input date-range="trip" data-range-type="end" name="trip_end" />
</div>
<div class="doc-code"><pre><code><input type="date" date-input date-range="trip" data-range-type="start" />
<input type="date" date-input date-range="trip" data-range-type="end" /></code></pre></div>
</div>
<div class="doc-directive" id="date-input">
<h3><code>date-input</code></h3>
<p>On: <input type="date|datetime-local">. Replaces the native date picker with a custom calendar popup featuring month/year navigation, disabled date support, keyboard navigation (arrows, PageUp/Down, Home/End, Enter/Space, Escape), and full ARIA accessibility. When combined with <code>date-range</code>, displays two side-by-side months.</p>
<div class="doc-demo">
<input type="date" date-input />
</div>
<div class="doc-code"><pre><code><input type="date" date-input />
<!-- With constraints -->
<input type="date" date-input no-past />
<input type="date" date-input disable-days="weekends" />
<!-- Range mode -->
<input type="date" date-input date-range="trip" data-range-type="start" />
<input type="date" date-input date-range="trip" data-range-type="end" /></code></pre></div>
</div>
<hr>
<!-- ──── Dialog ──── -->
<section id="dialog">Dialog</h2>
<div class="doc-directive" id="drawer">
<h3><code>drawer</code></h3>
<p>On: <dialog></p>
<div class="doc-demo">
<button command-for="demo-drawer" command="show-modal">Open drawer</button>
<dialog drawer="left" close-outside id="demo-drawer">
<header class="sprinkle-modal-header">
Navigation
<button class="sprinkle-modal-close" command-for="demo-drawer" command="close">×</button>
</header>
<div class="sprinkle-modal-body">
<a href="#">Home</a>
<a href="#">Blog</a>
<a href="#">About</a>
</div>
</dialog>
</div>
<div class="doc-code"><pre><code><dialog drawer="left" close-outside id="nav">…</dialog>
<button command-for="nav" command="show-modal">Open</button></code></pre></div>
</div>
<div class="doc-directive" id="modal">
<h3><code>modal</code></h3>
<p>On: <dialog></p>
<div class="doc-demo">
<button command-for="demo-modal" command="show-modal">Open modal</button>
<dialog modal close-outside id="demo-modal">
<div class="sprinkle-modal-header">
Confirm Delete
<button class="sprinkle-modal-close" command-for="demo-modal" command="close">×</button>
</div>
<div class="sprinkle-modal-body">Are you sure? This action cannot be undone.</div>
<div class="sprinkle-modal-footer">
<button command-for="demo-modal" command="close">Cancel</button>
</div>
</dialog>
</div>
<div class="doc-code"><pre><code><dialog modal id="confirm">
<div class="sprinkle-modal-header">…</div>
…
</dialog></code></pre></div>
</div>
<hr>
<!-- ──── Layout ──── -->
<section id="layout">Layout</h2>
<div id="layout">
<h3><code>shell</code> + <code>sidebar</code> + <code>nav</code> + <code>content</code></h3>
<p>The page itself uses <code>shell</code> with <code>sidebar="left"</code> and <code>content</code>. Below is a second nested layout example — no inline styles, no extra classes:</p>
<div shell shell-static>
<aside sidebar="left">
<div>Dashboard</div>
<hr nav-sep>
<ul nav>
<li><a href="#" active>Overview</a></li>
<li><a href="#">Analytics</a></li>
<li><a href="#">Settings</a></li>
</ul>
</aside>
<main content>
<h4>Welcome to the Dashboard</h4>
<p>This nested shell uses the same <code>shell</code> grid with <code>sidebar</code> + <code>nav</code>. The sidebar width and content padding come from sprinkle defaults.</p>
</main>
</div>
<div class="doc-directive" id="nav-horizontal">
<h3><code>nav="horizontal"</code></h3>
<p>On: <ul></p>
<div class="doc-demo">
<ul nav="horizontal">
<li><a href="#" active>Overview</a></li>
<li><a href="#">Analytics</a></li>
<li><a href="#">Settings</a></li>
<li><a href="#">Help</a></li>
</ul>
</div>
<div class="doc-code"><pre><code><ul nav="horizontal">
<li><a href="#" active>Overview</a></li>
<li><a href="#">Analytics</a></li>
<li><a href="#">Settings</a></li>
<li><a href="#">Help</a></li>
</ul></code></pre></div>
</div>
<div class="doc-directive" id="card">
<h3><code>card</code></h3>
<p>On: <fieldset></p>
<p>Basic card with <code><legend></code>:</p>
<div class="doc-demo">
<fieldset card>
<legend>Profile</legend>
<main>
<p>Name: Jane Doe</p>
<p>Role: Engineer</p>
</main>
</fieldset>
</div>
<div class="doc-code"><pre><code><fieldset card>
<legend>Profile</legend>
<main>
<p>Name: Jane Doe</p>
</main>
</fieldset></code></pre></div>
<p>Card with <code><header></code>, <code><main></code>, and <code><footer></code>:</p>
<div class="doc-demo">
<fieldset card>
<header>Notifications</header>
<main>
<p>You have 3 unread messages.</p>
</main>
<footer>
<button loading>Mark all read</button>
</footer>
</fieldset>
</div>
<div class="doc-code"><pre><code><fieldset card>
<header>Notifications</header>
<main>
<p>You have 3 unread messages.</p>
</main>
<footer>
<button loading>Mark all read</button>
</footer>
</fieldset></code></pre></div>
<p>Clickable card with <code>href</code>:</p>
<div class="doc-demo">
<fieldset card href="/sprinkle">
<header>Forge Sprinkle</header>
<main>
<p>Lightweight HTML attribute enhancements. No build step required.</p>
</main>
<footer>
<a href="/sprinkle" class="card-link">Learn more →</a>
</footer>
</fieldset>
</div>
<div class="doc-code"><pre><code><fieldset card href="/sprinkle">
<header>Forge Sprinkle</header>
<main>&hellip;</main>
<footer>
<a href="/sprinkle" class="card-link">Learn more →</a>
</footer>
</fieldset></code></pre></div>
<p>Grid of cards:</p>
<div class="doc-demo">
<div style="display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:1rem">
<fieldset card>
<header>Getting Started</header>
<main>
<p>Install the CSS and JS, add attributes to your HTML, and you're done.</p>
</main>
<footer><a href="#">Docs →</a></footer>
</fieldset>
<fieldset card>
<header>Components</header>
<main>
<p>Dropdowns, accordions, modals, drawers, combo-box, and more.</p>
</main>
<footer><a href="#">Explore →</a></footer>
</fieldset>
<fieldset card>
<header>Accessibility</header>
<main>
<p>Built on native HTML semantics. ARIA attributes are handled automatically.</p>
</main>
<footer><a href="#">Learn →</a></footer>
</fieldset>
</div>
</div>
<div class="doc-code"><pre><code><div style="display:grid;&hellip;">
<fieldset card>
<header>Getting Started</header>
<main>&hellip;</main>
</fieldset>
&hellip;
</div></code></pre></div>
</div>
<div class="doc-directive" id="count-up">
<h3><code>count-up</code></h3>
<p>On: any element, <progress></p>
<p>Animates from <code>start</code> (default 0) to the element's text value using <code>IntersectionObserver</code>.</p>
<div class="doc-demo">
<div style="display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:1rem">
<fieldset card>
<legend>Total Deployments</legend>
<main>
<strong count-up duration="2500">7,342</strong>
</main>
</fieldset>
<fieldset card>
<legend>Active Users</legend>
<main>
<span count-up duration="2000">12,847</span>
</main>
</fieldset>
<fieldset card>
<legend>Uptime</legend>
<main>
<span count-up start="90" duration="1500">99.97%</span>
</main>
</fieldset>
</div>
</div>
<div class="doc-code"><pre><code><strong count-up duration="2500">7,342</strong>
<span count-up duration="2000">12,847</span>
<span count-up start="90" duration="1500">99.97%</span></code></pre></div>
<p>On <code><progress></code> — animates the <code>value</code> attribute:</p>
<div class="doc-demo">
<fieldset card>
<legend>Storage Used</legend>
<main>
<progress count-up value="2500" max="3000"></progress>
<p style="margin-top:0.5rem"><span count-up duration="2000">2,500</span> / 3,000 GB</p>
</main>
</fieldset>
</div>
<div class="doc-code"><pre><code><progress count-up value="2500" max="3000"></progress>
<span count-up duration="2000">2,500</span> / 3,000 GB</code></pre></div>
</div>
</div>
<hr>
<section id="disclosure">Disclosure</h2>
<div class="doc-directive" id="accordion">
<h3><code>accordion</code></h3>
<p>On: <details></p>
<div class="doc-demo">
<details accordion="demo-faq">
<summary>What is ForgeSprinkle?</summary>
<p>A set of HTML attribute enhancements. Each directive is self-contained and degrades gracefully.</p>
</details>
<details accordion="demo-faq">
<summary>Does it require a build step?</summary>
<p>No. Drop in the CSS and JS files. No bundler, no npm, no configuration.</p>
</details>
<details accordion="demo-faq">
<summary>What about accessibility?</summary>
<p>Uses native <code><details></code> semantics. <code>aria-expanded</code> is handled automatically.</p>
</details>
</div>
<div class="doc-code"><pre><code><details accordion="faq">
<summary>Question</summary>
<p>Answer.</p>
</details></code></pre></div>
</div>
<div class="doc-directive" id="dropdown">
<h3><code>dropdown</code></h3>
<p>On: <details></p>
<div class="doc-demo">
<details dropdown close-outside>
<summary>
<img src="https://i.abcnewsfe.com/a/10669fab-5a56-4555-8012-0b3d83369352/avatar-the-way-of-water-07-ht-jt-220907_1662579296232_hpMain_1x1.jpg?w=992" avatar="sm">
<span>My Account</span>
</summary>
<ul>
<li><a href="#">My Profile</a></li>
<li><a href="#">Settings</a></li>
<li><a href="#">Logout</a></li>
</ul>
</details>
</div>
<div class="doc-code"><pre><code><details dropdown close-outside>
<summary>My Account</summary>
<ul>
<li><a href="#">Profile</a></li>
<li><a href="#">Logout</a></li>
</ul>
</details></code></pre></div>
</div>
<div class="doc-directive" id="close-outside">
<h3><code>close-outside</code></h3>
<p>On: <details>, <dialog></p>
<div class="doc-demo">
<details close-outside>
<summary>Click me</summary>
<p>Click outside to close this panel.</p>
</details>
</div>
<div class="doc-code"><pre><code><details close-outside>
<summary>Click me</summary>
<p>Click outside to close.</p>
</details></code></pre></div>
</div>
<div class="doc-directive" id="group-toggle">
<h3><code>open-group</code> / <code>close-group</code></h3>
<p>On: <button></p>
<div class="doc-demo">
<button open-group="demo-grp">Expand all</button>
<button close-group="demo-grp">Collapse all</button>
<details accordion="demo-grp">
<summary>Item A</summary>
<p>Content A</p>
</details>
<details accordion="demo-grp">
<summary>Item B</summary>
<p>Content B</p>
</details>
</div>
<div class="doc-code"><pre><code><button open-group="faq">Expand all</button>
<button close-group="faq">Collapse all</button></code></pre></div>
</div>
<hr>
<section id="visual">Visual</h2>
<div class="doc-directive" id="sticky">
<h3><code>sticky</code></h3>
<p>On: any element</p>
<div class="doc-demo">
<div sticky style="margin-bottom:0.5rem">
Scroll down — I stick to the top.
</div>
<div style="height:80px;overflow:auto;border:1px solid var(--border-color);border-radius:4px;padding:0.5rem">
<p>Scroll down to see the sticky element catch.</p>
<p style="margin-top:120px">It should be stuck at the top of this box now.</p>
<p style="margin-top:120px">More content to ensure scrolling.</p>
</div>
</div>
<div class="doc-code"><pre><code><div sticky>I stick to the top.</div></code></pre></div>
</div>
<div class="doc-directive" id="zoomable">
<h3><code>zoomable</code></h3>
<p>On: <img></p>
<div class="doc-demo">
<img src="https://i.abcnewsfe.com/a/10669fab-5a56-4555-8012-0b3d83369352/avatar-the-way-of-water-07-ht-jt-220907_1662579296232_hpMain_1x1.jpg?w=992" zoomable alt="Demo image" width="100" />
</div>
<div class="doc-code"><pre><code><img src="photo.jpg" zoomable /></code></pre></div>
</div>
<div class="doc-directive" id="copy">
<h3><code>copy</code> / <code>copy="#id"</code></h3>
<p>On: any element</p>
<div class="doc-demo">
<button copy>Copy my label</button>
<input value="hello@example.com" copy readonly />
</div>
<div class="doc-code"><pre><code><button copy>Copy my label</button>
<input value="hello@example.com" copy /></code></pre></div>
</div>
<div class="doc-directive" id="loading">
<h3><code>loading</code></h3>
<p>On: <button></p>
<div class="doc-demo">
<form>
<button loading>Save</button>
</form>
</div>
<div class="doc-code"><pre><code><button loading>Save</button></code></pre></div>
</div>
<div class="doc-directive" id="switch">
<h3><code>switch</code></h3>
<p>On: <input type="checkbox"></p>
<div class="doc-demo">
<label>
<input type="checkbox" switch checked />
Notifications
</label>
</div>
<div class="doc-code"><pre><code><input type="checkbox" switch /></code></pre></div>
</div>
<div class="doc-directive" id="truncate">
<h3><code>truncate="N"</code></h3>
<p>On: any element</p>
<div class="doc-demo">
<p truncate="2">
This is a long paragraph that gets clamped to two lines. The "Show more" button appears at the end of the clamped text. Clicking it reveals the full content, and clicking "Show less" collapses it back. This pattern is useful for card previews, article excerpts, and comment threads where you want to show a preview before expanding. This is especially handy when you have variable-length content and want a consistent card height.
</p>
</div>
<div class="doc-code"><pre><code><p truncate="2">Long text&hellip;</p></code></pre></div>
</div>
<div class="doc-directive" id="tooltip">
<h3><code>tooltip</code></h3>
<p>On: any element</p>
<div class="doc-demo">
<button tooltip="This cannot be undone">Delete</button>
<span tooltip="Verified account">&#x2705; Verified</span>
</div>
<div class="doc-code"><pre><code><button tooltip="This cannot be undone">Delete</button>
<span tooltip="Verified account">✅ Verified</span></code></pre></div>
</div>
<div class="doc-directive" id="avatar">
<h3><code>avatar</code></h3>
<p>On: <img></p>
<div class="doc-demo">
<img src="https://i.abcnewsfe.com/a/10669fab-5a56-4555-8012-0b3d83369352/avatar-the-way-of-water-07-ht-jt-220907_1662579296232_hpMain_1x1.jpg?w=992" avatar="sm" />
<img src="https://i.abcnewsfe.com/a/10669fab-5a56-4555-8012-0b3d83369352/avatar-the-way-of-water-07-ht-jt-220907_1662579296232_hpMain_1x1.jpg?w=992" avatar />
<img src="https://i.abcnewsfe.com/a/10669fab-5a56-4555-8012-0b3d83369352/avatar-the-way-of-water-07-ht-jt-220907_1662579296232_hpMain_1x1.jpg?w=992" avatar="lg" />
</div>
<div class="doc-code"><pre><code><img avatar="sm" />
<img avatar />
<img avatar="lg" /></code></pre></div>
</div>
<div class="doc-directive" id="breadcrumb">
<h3><code>breadcrumb</code></h3>
<p>On: <ul></p>
<div class="doc-demo">
<ul breadcrumb>
<li><a href="#">Home</a></li>
<li><a href="#">Blog</a></li>
<li>Current Page</li>
</ul>
</div>
<div class="doc-code"><pre><code><ul breadcrumb>
<li><a href="#">Home</a></li>
<li>Current Page</li>
</ul></code></pre></div>
</div>
<hr>
<section id="other">Other</h2>
<div class="doc-directive" id="confirm-leave">
<h3><code>confirm-leave</code></h3>
<p>On: <form></p>
<div class="doc-demo">
<form confirm-leave>
<textarea placeholder="Type something and try to leave the page…" rows="2"></textarea>
</form>
</div>
<div class="doc-code"><pre><code><form confirm-leave>
<textarea></textarea>
</form></code></pre></div>
</div>
<div class="doc-directive" id="otp">
<h3><code>otp</code></h3>
<p>On: <input></p>
<div class="doc-demo">
<input type="number" min="6" max="6" otp />
</div>
<div class="doc-code"><pre><code><input type="number" min="6" max="6" otp /></code></pre></div>
</div>
<div class="doc-directive" id="enhance">
<h3><code>enhance</code></h3>
<p>On: <form></p>
<p>Ajax form submission with loading states, validation errors, and server response handling.</p>
<div class="doc-demo">
<form enhance method="post" action="/api/submit">
<input name="email" type="email" required placeholder="Your email" error-message style="margin-bottom:0.5rem" />
<input name="name" required placeholder="Your name" error-message style="margin-bottom:0.5rem" />
<button loading type="submit">Submit</button>
</form>
</div>
<div class="doc-code"><pre><code><form enhance method="post" action="/api/submit">
<input name="email" type="email" required />
<button loading>Submit</button>
</form></code></pre></div>
</div>
<div class="doc-directive" id="theme-toggle">
<h3><code>theme-toggle</code></h3>
<p>On: any element</p>
<p>Toggles <code>data-sprinkle-theme</code> between <code>light</code> and <code>dark</code> on click. Persists to <code>localStorage</code>.</p>
<div class="doc-demo">
<p>Click the sun icon button at the top of this page to toggle the theme.</p>
</div>
<div class="doc-code"><pre><code><button theme-toggle>
<svg>&hellip;</svg>
</button></code></pre></div>
</div>
<hr>
<section id="guides">Guides</h2>
<div class="doc-directive" id="icons">
<h3>Icons</h3>
<p>Place SVGs in <code>/assets/svg/{name}.svg</code>. Reference by name (no extension):</p>
<div class="doc-code"><pre><code><input leading="search" placeholder="Search…" />
<input type="password" leading="lock" suffix="eye" /></code></pre></div>
<p><strong>Visibility toggle:</strong> <code>suffix</code> on <code>type="password"</code> swaps between <code>{name}.svg</code> and <code>{name}-off.svg</code> on click.</p>
<p><strong>Clear button:</strong> <code>suffix="close"</code> or <code>suffix="clear"</code> clears the input on click.</p>
<p><strong>Custom path:</strong> Override the SVG directory with a <code><meta></code> tag:</p>
<div class="doc-code"><pre><code><meta name="sprinkle-svg-path" content="/custom/path/to/icons"></code></pre></div>
<p>When <code>suffix</code> is present, <code>clearable</code> is ignored.</p>
</div>
<div class="doc-directive" id="accessibility">
<h3>Accessibility</h3>
<ul>
<li><code>aria-live="polite"</code> on character counters and drop-zone announcements</li>
<li><code>aria-expanded</code> on truncate toggles and accordion summaries</li>
<li><code>role="switch"</code> and <code>aria-checked</code> on switch toggles</li>
<li><code>role="alert"</code> and <code>aria-describedby</code> on validation errors</li>
<li><code>role="tooltip"</code> on tooltip elements</li>
<li>WAI-ARIA combobox pattern on <code>[combo-box]</code>: <code>role="combobox"</code>, <code>role="listbox"</code>, <code>role="option"</code>, <code>aria-expanded</code>, <code>aria-haspopup</code>, <code>aria-multiselectable</code>, <code>aria-selected</code>, <code>aria-posinset</code>, <code>aria-setsize</code></li>
<li><code>aria-current="page"</code> automatically set on active links in <code>ul[nav]</code></li>
<li><code>aria-label</code> on drop-zone remove buttons</li>
<li>Keyboard navigation on OTP (arrow keys, backspace, auto-advance)</li>
<li>Native <code><details></code> / <code><summary></code> keyboard behavior preserved in dropdown mode</li>
</ul>
</div>
<div class="doc-directive" id="extending">
<h3>Extending</h3>
<p>Custom directives can be added via the global <code>ForgeSprinkle</code> namespace:</p>
<div class="doc-code"><pre><code>ForgeSprinkle.register('my-attr', function (el) {
el.style.border = '2px solid gold'
})</code></pre></div>
<p>Register before <code>DOMContentLoaded</code>. The handler runs on matching elements at init and on dynamically added elements via <code>MutationObserver</code>.</p>
</div>
</main>
</article>
</div>
<footer>
<p>Sprinkle is a free and open-source library released under the <a
href="https://github.com/forge-kernel/sprinkle/blob/main/LICENSE">MIT License</a>.</p>
<p>Enhancing HTML, simply.</p>
</footer>
<script src="./sprinkle.min.js" defer></script>
</body>
</html>