@splenddev/kreativ-ui 0.1.0 → 0.2.1
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/README.md +1133 -1365
- package/dist/index.cjs +11 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +824 -110
- package/dist/index.d.ts +824 -110
- package/dist/index.js +11 -4
- package/dist/index.js.map +1 -1
- package/dist/styles/index.css +1 -1
- package/package.json +103 -66
package/README.md
CHANGED
|
@@ -1,1365 +1,1133 @@
|
|
|
1
|
-
# Kreativ UI
|
|
2
|
-
|
|
3
|
-
A modern, themeable React component library built with **React**, **Tailwind CSS v4**, and **CSS Variables**.
|
|
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
|
-
import
|
|
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
|
-
```ts
|
|
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
|
-
```tsx
|
|
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
|
-
```tsx
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
<Input
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
###
|
|
369
|
-
|
|
370
|
-
```tsx
|
|
371
|
-
<Input
|
|
372
|
-
<Input
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
<Input
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
```
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
<Input
|
|
396
|
-
```
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
```
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
<Input
|
|
408
|
-
<Input
|
|
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
|
-
</FormField>
|
|
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
|
-
</Select>
|
|
726
|
-
```
|
|
727
|
-
|
|
728
|
-
---
|
|
729
|
-
|
|
730
|
-
##
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
```tsx
|
|
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
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
```
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
<
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
<
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
```tsx
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
### With FormField
|
|
1136
|
-
|
|
1137
|
-
```tsx
|
|
1138
|
-
<FormField label="Choose your preference" error="Please select an option" required>
|
|
1139
|
-
<RadioGroup value={value} onValueChange={setValue}>
|
|
1140
|
-
<Radio value="opt1" label="Option 1" />
|
|
1141
|
-
<Radio value="opt2" label="Option 2" />
|
|
1142
|
-
</RadioGroup>
|
|
1143
|
-
</FormField>
|
|
1144
|
-
```
|
|
1145
|
-
|
|
1146
|
-
### Individual Radio Disabling
|
|
1147
|
-
|
|
1148
|
-
You can also disable individual radios via the `disabled` prop on `Radio`, which overrides the group’s `disabled` state for that item.
|
|
1149
|
-
|
|
1150
|
-
```tsx
|
|
1151
|
-
<RadioGroup disabled={false}>
|
|
1152
|
-
<Radio value="opt1" label="Enabled" />
|
|
1153
|
-
<Radio value="opt2" label="Disabled" disabled />
|
|
1154
|
-
</RadioGroup>
|
|
1155
|
-
```
|
|
1156
|
-
|
|
1157
|
-
### Props (RadioGroup)
|
|
1158
|
-
|
|
1159
|
-
| Prop | Type | Default | Description |
|
|
1160
|
-
|------|------|---------|-------------|
|
|
1161
|
-
| `value` | `string` | — | Controlled selected value |
|
|
1162
|
-
| `defaultValue` | `string` | — | Uncontrolled initial value |
|
|
1163
|
-
| `onValueChange` | `(value: string) => void` | — | Callback when selection changes |
|
|
1164
|
-
| `name` | `string` | auto‑generated | Shared `name` for all radio inputs |
|
|
1165
|
-
| `disabled` | `boolean` | `false` | Disables all radios in the group |
|
|
1166
|
-
| `required` | `boolean` | `false` | Sets `aria-required` on the group |
|
|
1167
|
-
| `orientation` | `"horizontal" \| "vertical"` | `"vertical"` | Layout direction |
|
|
1168
|
-
| `size` | `"sm" \| "md" \| "lg"` | `"md"` | Size of all radio bubbles |
|
|
1169
|
-
| `error` | `boolean` | `false` | Danger styling and `aria-invalid` |
|
|
1170
|
-
| `success` | `boolean` | `false` | Success styling |
|
|
1171
|
-
| `className` | `string` | — | Additional wrapper class |
|
|
1172
|
-
| `children` | `ReactNode` | — | `Radio` components |
|
|
1173
|
-
|
|
1174
|
-
### Props (Radio)
|
|
1175
|
-
|
|
1176
|
-
| Prop | Type | Default | Description |
|
|
1177
|
-
|------|------|---------|-------------|
|
|
1178
|
-
| `value` | `string` | **required** | Unique value for this option |
|
|
1179
|
-
| `disabled` | `boolean` | `false` | Disables this specific radio |
|
|
1180
|
-
| `label` | `ReactNode` | — | Label text or element |
|
|
1181
|
-
| `description` | `ReactNode` | — | Help text, wired via `aria-describedby` |
|
|
1182
|
-
| `className` | `string` | — | Additional wrapper class |
|
|
1183
|
-
|
|
1184
|
-
All standard `<input type="radio">` attributes (except `type`, `size`, `checked`, `defaultChecked`, `onChange`, `name`, `value`) are forwarded to the underlying `<input>`.
|
|
1185
|
-
```
|
|
1186
|
-
|
|
1187
|
-
---
|
|
1188
|
-
|
|
1189
|
-
### Updated Roadmap (Form section)
|
|
1190
|
-
|
|
1191
|
-
```markdown
|
|
1192
|
-
## Form
|
|
1193
|
-
- ✅ Input (with kind, clearable, loading, adornments)
|
|
1194
|
-
- ✅ Select (compound, groups, clearable)
|
|
1195
|
-
- ✅ Textarea (auto‑resize, counter, validation)
|
|
1196
|
-
- ✅ Checkbox (indeterminate, label, description)
|
|
1197
|
-
- ✅ RadioGroup (horizontal/vertical, validation)
|
|
1198
|
-
- ✅ FormField (automatic ARIA wiring)
|
|
1199
|
-
- ⏳ Switch
|
|
1200
|
-
- ⏳ Slider
|
|
1201
|
-
- ⏳ Combobox
|
|
1202
|
-
```
|
|
1203
|
-
|
|
1204
|
-
---
|
|
1205
|
-
|
|
1206
|
-
# Built-in Animations
|
|
1207
|
-
|
|
1208
|
-
Kreativ UI includes Tailwind‑compatible animation utilities.
|
|
1209
|
-
|
|
1210
|
-
```tsx
|
|
1211
|
-
<div className="animate-kui-fade-in" />
|
|
1212
|
-
```
|
|
1213
|
-
|
|
1214
|
-
### Available Animations
|
|
1215
|
-
|
|
1216
|
-
```
|
|
1217
|
-
animate-kui-spin
|
|
1218
|
-
animate-kui-pulse
|
|
1219
|
-
animate-kui-ping
|
|
1220
|
-
animate-kui-bounce
|
|
1221
|
-
|
|
1222
|
-
animate-kui-fade-in
|
|
1223
|
-
animate-kui-fade-out
|
|
1224
|
-
|
|
1225
|
-
animate-kui-scale-in
|
|
1226
|
-
animate-kui-scale-out
|
|
1227
|
-
|
|
1228
|
-
animate-kui-slide-up
|
|
1229
|
-
animate-kui-slide-down
|
|
1230
|
-
animate-kui-slide-left
|
|
1231
|
-
animate-kui-slide-right
|
|
1232
|
-
|
|
1233
|
-
animate-kui-shake
|
|
1234
|
-
|
|
1235
|
-
animate-kui-expand
|
|
1236
|
-
animate-kui-collapse
|
|
1237
|
-
|
|
1238
|
-
animate-kui-shimmer
|
|
1239
|
-
```
|
|
1240
|
-
|
|
1241
|
-
---
|
|
1242
|
-
|
|
1243
|
-
# Project Structure
|
|
1244
|
-
|
|
1245
|
-
```
|
|
1246
|
-
src/
|
|
1247
|
-
│
|
|
1248
|
-
├── components/
|
|
1249
|
-
│ ├── Button/
|
|
1250
|
-
│ │ ├── Button.tsx
|
|
1251
|
-
│ │ ├── Button.styles.ts
|
|
1252
|
-
│ │ ├── Button.types.ts
|
|
1253
|
-
│ │ └── index.ts
|
|
1254
|
-
│ ├── Input/
|
|
1255
|
-
│ │ └── ...
|
|
1256
|
-
│ ├── FormField/
|
|
1257
|
-
│ │ └── ...
|
|
1258
|
-
│ └── ThemeToggler/
|
|
1259
|
-
│ └── ...
|
|
1260
|
-
│
|
|
1261
|
-
├── context/ (UIProvider, ThemeContext)
|
|
1262
|
-
├── hooks/ (useTheme, useSizeStyle)
|
|
1263
|
-
├── styles/ (base CSS, animation utilities)
|
|
1264
|
-
├── theme/ (default tokens, color schemas)
|
|
1265
|
-
├── types/ (shared types: Size, Variant, etc.)
|
|
1266
|
-
├── utils/ (cn, merge, etc.)
|
|
1267
|
-
│
|
|
1268
|
-
└── index.ts
|
|
1269
|
-
```
|
|
1270
|
-
|
|
1271
|
-
---
|
|
1272
|
-
|
|
1273
|
-
# Creating a New Component
|
|
1274
|
-
|
|
1275
|
-
Every component follows the same pattern:
|
|
1276
|
-
|
|
1277
|
-
```
|
|
1278
|
-
Component/
|
|
1279
|
-
├── Component.tsx
|
|
1280
|
-
├── Component.styles.ts
|
|
1281
|
-
├── Component.types.ts
|
|
1282
|
-
└── index.ts
|
|
1283
|
-
```
|
|
1284
|
-
|
|
1285
|
-
Guidelines:
|
|
1286
|
-
|
|
1287
|
-
1. **Types** – Define props and style maps in `*.types.ts`.
|
|
1288
|
-
2. **Styles** – Define reusable `cn` style maps in `*.styles.ts`.
|
|
1289
|
-
3. **Component** – Use `useTheme()` to merge component overrides. Merge styles with `cn()`.
|
|
1290
|
-
4. **Exports** – Export the component and its types from `index.ts`.
|
|
1291
|
-
|
|
1292
|
-
---
|
|
1293
|
-
|
|
1294
|
-
# Development
|
|
1295
|
-
|
|
1296
|
-
```bash
|
|
1297
|
-
npm install # install dependencies
|
|
1298
|
-
npm run dev # start playground (Vite)
|
|
1299
|
-
npm run build # build the library
|
|
1300
|
-
npm run typecheck # run TypeScript type checking
|
|
1301
|
-
```
|
|
1302
|
-
|
|
1303
|
-
---
|
|
1304
|
-
|
|
1305
|
-
# Publishing
|
|
1306
|
-
|
|
1307
|
-
```bash
|
|
1308
|
-
npm version patch # or minor/major
|
|
1309
|
-
npm run build
|
|
1310
|
-
npm publish
|
|
1311
|
-
```
|
|
1312
|
-
|
|
1313
|
-
---
|
|
1314
|
-
|
|
1315
|
-
# Roadmap
|
|
1316
|
-
|
|
1317
|
-
## Core
|
|
1318
|
-
- ✅ Runtime theme engine
|
|
1319
|
-
- ✅ CSS variable tokens
|
|
1320
|
-
- ✅ Light / Dark / System modes
|
|
1321
|
-
- ✅ Tailwind v4 integration
|
|
1322
|
-
- ✅ Animation utilities
|
|
1323
|
-
- ✅ ThemeToggler with transitions
|
|
1324
|
-
|
|
1325
|
-
## Form
|
|
1326
|
-
- ✅ Input (with kind, clearable, loading, adornments)
|
|
1327
|
-
- ✅ FormField (automatic ARIA wiring)
|
|
1328
|
-
- ⏳ Textarea
|
|
1329
|
-
- ⏳ Select
|
|
1330
|
-
- ⏳ Checkbox
|
|
1331
|
-
- ⏳ Radio
|
|
1332
|
-
- ⏳ Switch
|
|
1333
|
-
- ⏳ Slider
|
|
1334
|
-
- ⏳ Combobox
|
|
1335
|
-
|
|
1336
|
-
## Feedback
|
|
1337
|
-
- ⏳ Alert
|
|
1338
|
-
- ⏳ Toast
|
|
1339
|
-
- ⏳ Progress
|
|
1340
|
-
- ⏳ Spinner
|
|
1341
|
-
- ⏳ Skeleton
|
|
1342
|
-
|
|
1343
|
-
## Data Display
|
|
1344
|
-
- ⏳ Badge
|
|
1345
|
-
- ⏳ Avatar
|
|
1346
|
-
- ⏳ Card
|
|
1347
|
-
- ⏳ Table
|
|
1348
|
-
- ⏳ Data Grid
|
|
1349
|
-
|
|
1350
|
-
## Navigation
|
|
1351
|
-
- ⏳ Tabs
|
|
1352
|
-
- ⏳ Accordion
|
|
1353
|
-
- ⏳ Breadcrumb
|
|
1354
|
-
- ⏳ Pagination
|
|
1355
|
-
|
|
1356
|
-
## Overlay
|
|
1357
|
-
- ⏳ Dialog
|
|
1358
|
-
- ⏳ Drawer
|
|
1359
|
-
- ⏳ Popover
|
|
1360
|
-
- ⏳ Tooltip
|
|
1361
|
-
- ⏳ Dropdown Menu
|
|
1362
|
-
|
|
1363
|
-
---
|
|
1364
|
-
|
|
1365
|
-
Happy building with **Kreativ UI**! 🎨✨
|
|
1
|
+
# Kreativ UI
|
|
2
|
+
|
|
3
|
+
A modern, themeable React component library built with **React**, **TypeScript**, **Tailwind CSS v4**, and **CSS Variables**.
|
|
4
|
+
Kreativ UI provides a runtime theme engine that lets you customize colors, typography, radius, sizes, and component styles **without rebuilding CSS**.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## ✨ Features
|
|
9
|
+
|
|
10
|
+
- Runtime theme switching (`light`, `dark`, `system`)
|
|
11
|
+
- Built‑in `ThemeToggler` with optional animated transitions
|
|
12
|
+
- CSS‑variable‑driven design tokens
|
|
13
|
+
- Primitive + semantic token architecture
|
|
14
|
+
- Component‑level theme overrides
|
|
15
|
+
- Fully accessible (ARIA, keyboard navigation, focus management)
|
|
16
|
+
- TypeScript‑first and tree‑shakable
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 📦 Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install @splenddev/kreativ-ui
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Import the stylesheet **once** in your application entry:
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import "@splenddev/kreativ-ui/styles.css";
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 🚀 Quick Start
|
|
35
|
+
|
|
36
|
+
Wrap your app with `UIProvider` and use the `Button` component:
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
import { UIProvider, Button } from "@splenddev/kreativ-ui";
|
|
40
|
+
import "@splenddev/kreativ-ui/styles.css";
|
|
41
|
+
|
|
42
|
+
export default function App() {
|
|
43
|
+
return (
|
|
44
|
+
<UIProvider defaultMode="system">
|
|
45
|
+
<Button>Click me</Button>
|
|
46
|
+
</UIProvider>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
# ☀️ UIProvider
|
|
54
|
+
|
|
55
|
+
The `UIProvider` component provides the theme context and manages the active colour mode. It must wrap any part of your application that uses Kreativ UI components.
|
|
56
|
+
|
|
57
|
+
### Modes
|
|
58
|
+
|
|
59
|
+
| Mode | Description |
|
|
60
|
+
| -------- | ---------------------------------------------- |
|
|
61
|
+
| `light` | Forces light mode |
|
|
62
|
+
| `dark` | Forces dark mode |
|
|
63
|
+
| `system` | Follows the user’s operating system preference |
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
<UIProvider defaultMode="system">
|
|
67
|
+
<App />
|
|
68
|
+
</UIProvider>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### useTheme
|
|
72
|
+
|
|
73
|
+
Access and change the current mode anywhere in your app:
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
import { useTheme } from "@splenddev/kreativ-ui";
|
|
77
|
+
|
|
78
|
+
function ThemeSwitcher() {
|
|
79
|
+
const { mode, setMode } = useTheme();
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<>
|
|
83
|
+
<button onClick={() => setMode("light")}>Light</button>
|
|
84
|
+
<button onClick={() => setMode("dark")}>Dark</button>
|
|
85
|
+
<button onClick={() => setMode("system")}>System</button>
|
|
86
|
+
</>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
# 🎨 Theming
|
|
94
|
+
|
|
95
|
+
Kreativ UI’s theme system is built around two layers:
|
|
96
|
+
|
|
97
|
+
- **Primitive tokens** – raw values (colours, spacing, radii, fonts, etc.)
|
|
98
|
+
- **Semantic tokens** – role‑based values that adapt to light/dark modes
|
|
99
|
+
|
|
100
|
+
The library ships with a default theme. You can override any part of it using a `ThemeOverride` object.
|
|
101
|
+
|
|
102
|
+
## Overriding the Theme
|
|
103
|
+
|
|
104
|
+
Pass a `theme` prop to `UIProvider`. Only the properties you provide will be merged with the default theme.
|
|
105
|
+
|
|
106
|
+
```tsx
|
|
107
|
+
import { UIProvider } from "@splenddev/kreativ-ui";
|
|
108
|
+
|
|
109
|
+
const theme = {
|
|
110
|
+
semanticTokens: {
|
|
111
|
+
colors: {
|
|
112
|
+
brand: {
|
|
113
|
+
value: {
|
|
114
|
+
light: "16 128 224", // RGB channel values
|
|
115
|
+
dark: "71 153 235",
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
surface: {
|
|
119
|
+
value: {
|
|
120
|
+
light: "255 255 255",
|
|
121
|
+
dark: "15 23 42",
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
text: {
|
|
125
|
+
value: {
|
|
126
|
+
light: "15 23 42",
|
|
127
|
+
dark: "241 245 249",
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
<UIProvider theme={theme}>
|
|
135
|
+
<App />
|
|
136
|
+
</UIProvider>;
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Primitive vs Semantic Tokens
|
|
140
|
+
|
|
141
|
+
**Primitive tokens** are raw values:
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
tokens.colors.blue.500 // → 59 130 246
|
|
145
|
+
tokens.colors.gray.900 // → 17 24 39
|
|
146
|
+
tokens.spacing.md // → 16px
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Semantic tokens** describe UI meaning and can reference primitive tokens or direct values:
|
|
150
|
+
|
|
151
|
+
```ts
|
|
152
|
+
semanticTokens.colors.brand = { value: { light: "{colors.blue.500}", dark: "{colors.blue.400}" } }
|
|
153
|
+
semanticTokens.colors.text = { value: { light: "{colors.gray.900}", dark: "{colors.gray.50}" } }
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
The runtime engine resolves these references and applies the correct values based on the active colour mode.
|
|
157
|
+
|
|
158
|
+
### Custom Component Sizes
|
|
159
|
+
|
|
160
|
+
You can extend the size system by adding custom size definitions. For example, to add an `xl` button size:
|
|
161
|
+
|
|
162
|
+
```tsx
|
|
163
|
+
import { defaultTheme } from "@splenddev/kreativ-ui";
|
|
164
|
+
|
|
165
|
+
const theme = {
|
|
166
|
+
...defaultTheme,
|
|
167
|
+
sizes: {
|
|
168
|
+
xl: {
|
|
169
|
+
height: "4.5rem",
|
|
170
|
+
paddingX: "2.5rem",
|
|
171
|
+
fontSize: "1.125rem",
|
|
172
|
+
gap: "0.75rem",
|
|
173
|
+
radius: "1rem",
|
|
174
|
+
iconSize: "1.5rem",
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
<UIProvider theme={theme}>
|
|
180
|
+
<Button size="xl">Extra Large</Button>
|
|
181
|
+
</UIProvider>;
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
# 🌗 ThemeToggler
|
|
187
|
+
|
|
188
|
+
A ready‑to‑use theme switcher that integrates with `UIProvider`.
|
|
189
|
+
|
|
190
|
+
## Basic Usage
|
|
191
|
+
|
|
192
|
+
```tsx
|
|
193
|
+
import { ThemeToggler } from "@splenddev/kreativ-ui";
|
|
194
|
+
|
|
195
|
+
<ThemeToggler />;
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## With System Mode
|
|
199
|
+
|
|
200
|
+
```tsx
|
|
201
|
+
<ThemeToggler allowSystem />
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Icon Only
|
|
205
|
+
|
|
206
|
+
```tsx
|
|
207
|
+
<ThemeToggler iconOnly allowSystem />
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Custom Variants
|
|
211
|
+
|
|
212
|
+
```tsx
|
|
213
|
+
<ThemeToggler variant="outline" activeVariant="solid" />
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Vertical Layout
|
|
217
|
+
|
|
218
|
+
```tsx
|
|
219
|
+
<ThemeToggler orientation="vertical" allowSystem />
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Custom Labels & Icons
|
|
223
|
+
|
|
224
|
+
```tsx
|
|
225
|
+
import { SunMedium, MoonStar, LaptopMinimal } from "lucide-react";
|
|
226
|
+
|
|
227
|
+
<ThemeToggler
|
|
228
|
+
allowSystem
|
|
229
|
+
labels={{ light: "Day", dark: "Night", system: "Auto" }}
|
|
230
|
+
icons={{
|
|
231
|
+
light: <SunMedium size={18} />,
|
|
232
|
+
dark: <MoonStar size={18} />,
|
|
233
|
+
system: <LaptopMinimal size={18} />,
|
|
234
|
+
}}
|
|
235
|
+
/>;
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## Cycle Mode with Animation
|
|
239
|
+
|
|
240
|
+
```tsx
|
|
241
|
+
<ThemeToggler
|
|
242
|
+
display="cycle"
|
|
243
|
+
allowSystem
|
|
244
|
+
transition={{ type: "rotate", duration: 400, easing: "ease-in-out" }}
|
|
245
|
+
/>
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
Supported transition types: `none`, `fade`, `slide`, `scale`, `rotate`.
|
|
249
|
+
|
|
250
|
+
## Props
|
|
251
|
+
|
|
252
|
+
| Prop | Type | Default | Description |
|
|
253
|
+
| --------------- | ----------------------------------------------------------------- | ------------------- | ------------------------------------------- |
|
|
254
|
+
| `variant` | `ThemeTogglerVariant` | `"ghost"` | Variant for inactive buttons |
|
|
255
|
+
| `activeVariant` | `ThemeTogglerVariant` | `"solid"` | Variant for active button |
|
|
256
|
+
| `size` | `"xs" \| "sm" \| "md" \| "lg" \| "xl"` | `"sm"` | Button size |
|
|
257
|
+
| `iconOnly` | `boolean` | `false` | Hide labels, show only icons |
|
|
258
|
+
| `allowSystem` | `boolean` | `false` | Show system theme option |
|
|
259
|
+
| `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` | Layout direction |
|
|
260
|
+
| `rounded` | `boolean` | `true` | Rounded container corners |
|
|
261
|
+
| `unstyled` | `boolean` | `false` | Remove wrapper styles |
|
|
262
|
+
| `display` | `"buttons" \| "cycle"` | `"buttons"` | Show all buttons or a single cycling button |
|
|
263
|
+
| `transition` | `{ type?: TransitionType; duration?: number; easing?: string }` | `{ type: "none" }` | Animation configuration for cycle mode |
|
|
264
|
+
| `labels` | `Partial<Record<"light" \| "dark" \| "system", string>>` | – | Override labels |
|
|
265
|
+
| `icons` | `Partial<Record<"light" \| "dark" \| "system", ReactNode>>` | – | Override icons |
|
|
266
|
+
| `buttonProps` | `Partial<ButtonProps>` | – | Props passed to every internal button |
|
|
267
|
+
| `className` | `string` | – | Additional wrapper class |
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
# Button
|
|
272
|
+
|
|
273
|
+
A versatile button with support for variants, sizes, loading states, icons, and full‑width.
|
|
274
|
+
|
|
275
|
+
## Basic Usage
|
|
276
|
+
|
|
277
|
+
```tsx
|
|
278
|
+
<Button>Click me</Button>
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
## Variants
|
|
282
|
+
|
|
283
|
+
```tsx
|
|
284
|
+
<Button variant="solid">Solid</Button>
|
|
285
|
+
<Button variant="outline">Outline</Button>
|
|
286
|
+
<Button variant="ghost">Ghost</Button>
|
|
287
|
+
<Button variant="soft">Soft</Button>
|
|
288
|
+
<Button variant="destructive">Delete</Button>
|
|
289
|
+
<Button variant="success">Success</Button>
|
|
290
|
+
<Button variant="link">Learn more</Button>
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
## Sizes
|
|
294
|
+
|
|
295
|
+
```tsx
|
|
296
|
+
<Button size="xs">Extra Small</Button>
|
|
297
|
+
<Button size="sm">Small</Button>
|
|
298
|
+
<Button size="md">Medium</Button>
|
|
299
|
+
<Button size="lg">Large</Button>
|
|
300
|
+
<Button size="xl">Extra Large</Button>
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## Loading State
|
|
304
|
+
|
|
305
|
+
```tsx
|
|
306
|
+
<Button isLoading>Saving...</Button>
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
## Icons
|
|
310
|
+
|
|
311
|
+
```tsx
|
|
312
|
+
<Button leftIcon={<SearchIcon />}>Search</Button>
|
|
313
|
+
<Button rightIcon={<ArrowRightIcon />}>Continue</Button>
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
## Icon Only
|
|
317
|
+
|
|
318
|
+
```tsx
|
|
319
|
+
<Button iconOnly aria-label="Search">
|
|
320
|
+
<SearchIcon />
|
|
321
|
+
</Button>
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
## Full Width
|
|
325
|
+
|
|
326
|
+
```tsx
|
|
327
|
+
<Button fullWidth>Continue</Button>
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
## Custom Sizes via Theme
|
|
331
|
+
|
|
332
|
+
Define additional sizes in the theme (as shown in the Theming section) and use them with `size` prop.
|
|
333
|
+
|
|
334
|
+
## Props
|
|
335
|
+
|
|
336
|
+
| Prop | Type | Default | Description |
|
|
337
|
+
| ------------------------ | ------------------------------------------------------ | -------- | ------------------------------------------- |
|
|
338
|
+
| `variant` | `"solid" \| "outline" \| "ghost" \| "soft" \| "destructive" \| "success" \| "link"` | `"solid"` | Visual style |
|
|
339
|
+
| `size` | `"xs" \| "sm" \| "md" \| "lg" \| "xl" \| string` | `"md"` | Size (theme‑driven; custom strings allowed) |
|
|
340
|
+
| `isLoading` | `boolean` | `false` | Shows spinner and disables |
|
|
341
|
+
| `leftIcon` / `rightIcon` | `ReactNode` | – | Icon elements |
|
|
342
|
+
| `fullWidth` | `boolean` | `false` | Stretch to container width |
|
|
343
|
+
| `disabled` | `boolean` | `false` | Disables interactions |
|
|
344
|
+
| `iconOnly` | `boolean` | `false` | Remove padding for icon‑only layout |
|
|
345
|
+
|
|
346
|
+
All standard `<button>` props are forwarded.
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
# 🧩 Input & FormField
|
|
351
|
+
|
|
352
|
+
This section covers the `Input` component and the `FormField` composition system for building accessible, validated form controls.
|
|
353
|
+
|
|
354
|
+
---
|
|
355
|
+
|
|
356
|
+
## Input
|
|
357
|
+
|
|
358
|
+
A flexible text input with support for variants, sizes, validation states, adornments, password visibility, clearing, and loading states.
|
|
359
|
+
|
|
360
|
+
### Basic Usage
|
|
361
|
+
|
|
362
|
+
```tsx
|
|
363
|
+
import { Input } from "@splenddev/kreativ-ui";
|
|
364
|
+
|
|
365
|
+
<Input placeholder="Enter your name" />
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
### Variants
|
|
369
|
+
|
|
370
|
+
```tsx
|
|
371
|
+
<Input variant="outline" />
|
|
372
|
+
<Input variant="filled" />
|
|
373
|
+
<Input variant="ghost" />
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### Sizes
|
|
377
|
+
|
|
378
|
+
```tsx
|
|
379
|
+
<Input inputSize="sm" />
|
|
380
|
+
<Input inputSize="md" />
|
|
381
|
+
<Input inputSize="lg" />
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### Input Kinds
|
|
385
|
+
|
|
386
|
+
The `kind` prop sets sensible defaults for `type`, `inputMode`, `autoComplete`, and sometimes a placeholder and icon. Any explicit prop overrides the kind default.
|
|
387
|
+
|
|
388
|
+
```tsx
|
|
389
|
+
<Input kind="email" />
|
|
390
|
+
<Input kind="tel" />
|
|
391
|
+
<Input kind="url" />
|
|
392
|
+
<Input kind="search" />
|
|
393
|
+
<Input kind="numeric" />
|
|
394
|
+
<Input kind="password-current" /> // autoComplete="current-password" + show/hide toggle
|
|
395
|
+
<Input kind="password-new" /> // autoComplete="new-password" + show/hide toggle
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
To suppress the icon that comes with certain kinds (e.g., `email`, `search`):
|
|
399
|
+
|
|
400
|
+
```tsx
|
|
401
|
+
<Input kind="email" hideKindIcon />
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
### Validation States
|
|
405
|
+
|
|
406
|
+
```tsx
|
|
407
|
+
<Input error />
|
|
408
|
+
<Input success />
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
The `error` state also sets `aria-invalid="true"`.
|
|
412
|
+
|
|
413
|
+
### Disabled & Loading
|
|
414
|
+
|
|
415
|
+
```tsx
|
|
416
|
+
<Input disabled />
|
|
417
|
+
<Input isLoading /> // shows a spinner, makes the field read‑only (not disabled)
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
### Adornments (Icons)
|
|
421
|
+
|
|
422
|
+
```tsx
|
|
423
|
+
<Input startIcon={<SearchIcon />} />
|
|
424
|
+
<Input endIcon={<MailIcon />} />
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
### Clearable
|
|
428
|
+
|
|
429
|
+
```tsx
|
|
430
|
+
<Input clearable onClear={() => console.log("cleared")} />
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
A clear button appears when the field has a value. Clicking it clears the value and calls `onClear`.
|
|
434
|
+
|
|
435
|
+
### Password Input
|
|
436
|
+
|
|
437
|
+
With `kind="password-current"` or `kind="password-new"`, a toggle button is shown to reveal/hide the password.
|
|
438
|
+
|
|
439
|
+
### Full Width & Rounded
|
|
440
|
+
|
|
441
|
+
```tsx
|
|
442
|
+
<Input fullWidth /> // default: true
|
|
443
|
+
<Input rounded /> // fully rounded corners
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
### Controlled & Uncontrolled
|
|
447
|
+
|
|
448
|
+
```tsx
|
|
449
|
+
// Controlled
|
|
450
|
+
const [value, setValue] = useState("");
|
|
451
|
+
<Input value={value} onChange={(e) => setValue(e.target.value)} />
|
|
452
|
+
|
|
453
|
+
// Uncontrolled
|
|
454
|
+
<Input defaultValue="Initial value" />
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
### Ref Forwarding
|
|
458
|
+
|
|
459
|
+
`Input` forwards refs to the underlying `<input>` element.
|
|
460
|
+
|
|
461
|
+
### Native Props
|
|
462
|
+
|
|
463
|
+
All standard `<input>` attributes (except `size`) are forwarded to the native input element.
|
|
464
|
+
|
|
465
|
+
### Size-Aware Styling
|
|
466
|
+
|
|
467
|
+
The component uses `useSizeStyle` to apply theme‑aware sizing from the `sizes` object in the theme.
|
|
468
|
+
|
|
469
|
+
---
|
|
470
|
+
|
|
471
|
+
## FormField
|
|
472
|
+
|
|
473
|
+
`FormField` is a higher‑level component that composes a label, description, control, and validation message into an accessible form field. It automatically wires `id`, `aria-describedby`, `aria-invalid`, and `aria-required` – no manual ID juggling.
|
|
474
|
+
|
|
475
|
+
### Basic Structure
|
|
476
|
+
|
|
477
|
+
```tsx
|
|
478
|
+
import { FormField, Input } from "@splenddev/kreativ-ui";
|
|
479
|
+
|
|
480
|
+
<FormField>
|
|
481
|
+
<FormField.Label>Email address</FormField.Label>
|
|
482
|
+
<FormField.Description>We'll only send receipts here.</FormField.Description>
|
|
483
|
+
<FormField.Control>
|
|
484
|
+
<Input kind="email" placeholder="you@company.com" />
|
|
485
|
+
</FormField.Control>
|
|
486
|
+
<FormField.Message>Enter a valid email.</FormField.Message>
|
|
487
|
+
</FormField>
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
### Subcomponents
|
|
491
|
+
|
|
492
|
+
| Component | Purpose |
|
|
493
|
+
| -------------------- | ------------------------------------------------------------- |
|
|
494
|
+
| `FormField` | Provides context, manages `id` and accessibility relationships |
|
|
495
|
+
| `FormField.Label` | Renders a label associated with the control via `htmlFor` |
|
|
496
|
+
| `FormField.Description` | Renders helper text, linked via `aria-describedby` |
|
|
497
|
+
| `FormField.Control` | Injects the field ID and accessibility props into its child |
|
|
498
|
+
| `FormField.Message` | Displays a validation message, linked via `aria-describedby` |
|
|
499
|
+
|
|
500
|
+
### Field‑Level Props
|
|
501
|
+
|
|
502
|
+
`FormField` accepts:
|
|
503
|
+
|
|
504
|
+
| Prop | Type | Default | Description |
|
|
505
|
+
| ------------- | ----------- | -------------- | ------------------------------------------------- |
|
|
506
|
+
| `id` | `string` | auto‑generated | Explicit `id` for the control |
|
|
507
|
+
| `error` | `string` | – | Validation error message (overrides description) |
|
|
508
|
+
| `required` | `boolean` | `false` | Shows required indicator and sets `aria-required` |
|
|
509
|
+
| `className` | `string` | – | Additional wrapper classes |
|
|
510
|
+
| `children` | `ReactNode` | – | The field content (typically subcomponents) |
|
|
511
|
+
|
|
512
|
+
### Error Handling
|
|
513
|
+
|
|
514
|
+
When `error` is provided:
|
|
515
|
+
|
|
516
|
+
- The error message is displayed (replacing any `Description`).
|
|
517
|
+
- The control receives `aria-invalid="true"`.
|
|
518
|
+
- The error message is linked via `aria-describedby`.
|
|
519
|
+
|
|
520
|
+
### Required Indicator
|
|
521
|
+
|
|
522
|
+
When `required` is `true`, the label gets a `*` suffix and the control receives `aria-required="true"`.
|
|
523
|
+
|
|
524
|
+
### Auto‑Generated IDs
|
|
525
|
+
|
|
526
|
+
If no `id` is provided, `FormField` generates a unique ID using `useId` (React 18+) and passes it to the control via `FormField.Control`.
|
|
527
|
+
|
|
528
|
+
---
|
|
529
|
+
|
|
530
|
+
## FormField + Input Integration
|
|
531
|
+
|
|
532
|
+
This is the recommended way to build accessible forms with Kreativ UI.
|
|
533
|
+
|
|
534
|
+
```tsx
|
|
535
|
+
import { FormField, Input } from "@splenddev/kreativ-ui";
|
|
536
|
+
|
|
537
|
+
function EmailField() {
|
|
538
|
+
const [error, setError] = useState("");
|
|
539
|
+
|
|
540
|
+
const handleBlur = (e: React.FocusEvent<HTMLInputElement>) => {
|
|
541
|
+
const value = e.target.value;
|
|
542
|
+
if (!value) setError("Email is required");
|
|
543
|
+
else if (!/\S+@\S+\.\S+/.test(value)) setError("Enter a valid email");
|
|
544
|
+
else setError("");
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
return (
|
|
548
|
+
<FormField id="email" required error={error}>
|
|
549
|
+
<FormField.Label>Email address</FormField.Label>
|
|
550
|
+
<FormField.Description>We'll only send receipts here.</FormField.Description>
|
|
551
|
+
<FormField.Control>
|
|
552
|
+
<Input
|
|
553
|
+
kind="email"
|
|
554
|
+
placeholder="you@company.com"
|
|
555
|
+
onBlur={handleBlur}
|
|
556
|
+
/>
|
|
557
|
+
</FormField.Control>
|
|
558
|
+
{error && <FormField.Message>{error}</FormField.Message>}
|
|
559
|
+
</FormField>
|
|
560
|
+
);
|
|
561
|
+
}
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
**Responsibilities**:
|
|
565
|
+
|
|
566
|
+
- `FormField` – owns field‑level state and accessibility relationships.
|
|
567
|
+
- `FormField.Label` – provides the accessible label.
|
|
568
|
+
- `FormField.Description` – provides supporting text (hidden when `error` exists).
|
|
569
|
+
- `FormField.Control` – connects the actual control to the field context.
|
|
570
|
+
- `Input` – handles the input behavior and presentation.
|
|
571
|
+
- `FormField.Message` – displays validation feedback.
|
|
572
|
+
|
|
573
|
+
---
|
|
574
|
+
|
|
575
|
+
## Accessibility
|
|
576
|
+
|
|
577
|
+
The library ensures the following relationships are automatically established:
|
|
578
|
+
|
|
579
|
+
```
|
|
580
|
+
Label
|
|
581
|
+
↓
|
|
582
|
+
for → input[id]
|
|
583
|
+
|
|
584
|
+
Description
|
|
585
|
+
↓
|
|
586
|
+
aria-describedby → description id
|
|
587
|
+
|
|
588
|
+
Validation message
|
|
589
|
+
↓
|
|
590
|
+
aria-describedby → message id (appended to description ids)
|
|
591
|
+
|
|
592
|
+
Validation state
|
|
593
|
+
↓
|
|
594
|
+
aria-invalid="true" (when error is present)
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
When using `FormField`, consumers **should** wrap the input with `FormField.Control` to benefit from these automatic connections.
|
|
598
|
+
|
|
599
|
+
---
|
|
600
|
+
|
|
601
|
+
## Validation Behavior
|
|
602
|
+
|
|
603
|
+
### Field‑Level vs. Input‑Level
|
|
604
|
+
|
|
605
|
+
```tsx
|
|
606
|
+
// Field-level validation (manages error message and aria state)
|
|
607
|
+
<FormField error="Invalid email">
|
|
608
|
+
<FormField.Control>
|
|
609
|
+
<Input />
|
|
610
|
+
</FormField.Control>
|
|
611
|
+
</FormField>
|
|
612
|
+
|
|
613
|
+
// Input-level error (only visual style and aria-invalid)
|
|
614
|
+
<Input error />
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
`FormField` manages the error message and overall accessibility, while `Input` controls its own visual presentation. Using both together gives full feedback.
|
|
618
|
+
|
|
619
|
+
### State‑Transition Feedback
|
|
620
|
+
|
|
621
|
+
When the `error` or `success` state changes on an `Input`, the component briefly animates the change (e.g., a subtle colour transition) rather than continuously animating the validation state. This provides a smooth user experience without being distracting.
|
|
622
|
+
|
|
623
|
+
---
|
|
624
|
+
|
|
625
|
+
## Standalone vs. FormField Usage
|
|
626
|
+
|
|
627
|
+
- **Standalone `Input`**: Use when you need a simple input without label/description/validation relationships. Ideal for search bars, inline inputs, or custom layouts.
|
|
628
|
+
- **`FormField` + `Input`**: Use for labeled, described, or validated form controls. This ensures proper accessibility and reduces manual ARIA management.
|
|
629
|
+
|
|
630
|
+
---
|
|
631
|
+
|
|
632
|
+
## API Reference
|
|
633
|
+
|
|
634
|
+
### Input Props
|
|
635
|
+
|
|
636
|
+
| Prop | Type | Default | Description |
|
|
637
|
+
| ----------------- | ----------------------------------- | ----------- | --------------------------------------------------------------------------- |
|
|
638
|
+
| `variant` | `"outline" \| "filled" \| "ghost"` | `"outline"` | Visual style |
|
|
639
|
+
| `inputSize` | `"sm" \| "md" \| "lg"` | `"md"` | Height, padding, font size |
|
|
640
|
+
| `kind` | `InputKind` | `"text"` | Sets defaults for `type`, `inputMode`, `autoComplete`, placeholder, and icon|
|
|
641
|
+
| `hideKindIcon` | `boolean` | `false` | Suppress the default icon from `kind` |
|
|
642
|
+
| `error` | `boolean` | `false` | Danger styling and `aria-invalid` |
|
|
643
|
+
| `success` | `boolean` | `false` | Success styling |
|
|
644
|
+
| `disabled` | `boolean` | `false` | Disables the input |
|
|
645
|
+
| `isLoading` | `boolean` | `false` | Shows spinner and marks read‑only |
|
|
646
|
+
| `clearable` | `boolean` | `false` | Shows clear button when value is present |
|
|
647
|
+
| `onClear` | `() => void` | – | Called after clear |
|
|
648
|
+
| `rounded` | `boolean` | `false` | Fully rounded wrapper |
|
|
649
|
+
| `fullWidth` | `boolean` | `true` | Stretch to container width |
|
|
650
|
+
| `startIcon` | `ReactNode` | – | Content before the input (e.g., icon) |
|
|
651
|
+
| `endIcon` | `ReactNode` | – | Content after the input (e.g., icon) |
|
|
652
|
+
| `className` | `string` | – | Additional wrapper class |
|
|
653
|
+
| `inputClassName` | `string` | – | Additional class for the native input element |
|
|
654
|
+
|
|
655
|
+
All standard `<input>` attributes (except `size`) are forwarded to the underlying `<input>`.
|
|
656
|
+
|
|
657
|
+
### FormField Props
|
|
658
|
+
|
|
659
|
+
| Prop | Type | Default | Description |
|
|
660
|
+
| ------------- | ----------- | -------------- | ------------------------------------------------- |
|
|
661
|
+
| `id` | `string` | auto‑generated | Explicit `id` for the control |
|
|
662
|
+
| `error` | `string` | – | Validation error message (overrides description) |
|
|
663
|
+
| `required` | `boolean` | `false` | Shows required indicator and sets `aria-required` |
|
|
664
|
+
| `className` | `string` | – | Additional wrapper classes |
|
|
665
|
+
| `children` | `ReactNode` | – | The field content (typically subcomponents) |
|
|
666
|
+
|
|
667
|
+
### FormField Subcomponents
|
|
668
|
+
|
|
669
|
+
| Component | Description |
|
|
670
|
+
| -------------------- | ----------------------------------------------------------------- |
|
|
671
|
+
| `FormField.Label` | Renders a label associated with the control via `htmlFor` |
|
|
672
|
+
| `FormField.Description` | Renders helper text, linked via `aria-describedby` |
|
|
673
|
+
| `FormField.Control` | Injects the field ID and accessibility props into its child |
|
|
674
|
+
| `FormField.Message` | Displays a validation message, linked via `aria-describedby` |
|
|
675
|
+
|
|
676
|
+
---
|
|
677
|
+
|
|
678
|
+
For more advanced usage (e.g., integrating with `react-hook-form`), see the [GitHub repository examples](https://github.com/Vincentvirtuoso/kreativ-ui).
|
|
679
|
+
|
|
680
|
+
---
|
|
681
|
+
|
|
682
|
+
# 🧩 Select
|
|
683
|
+
|
|
684
|
+
A fully accessible, customizable select component with keyboard navigation, grouped options, clearable selections, and optional integration with `FormField`. Built as a compound component for maximum flexibility.
|
|
685
|
+
|
|
686
|
+
---
|
|
687
|
+
|
|
688
|
+
## Overview
|
|
689
|
+
|
|
690
|
+
`Select` is a headless‑style compound component that implements the WAI‑ARIA combobox pattern. It consists of:
|
|
691
|
+
|
|
692
|
+
- `Select` – root container, manages state and context
|
|
693
|
+
- `Select.Trigger` – interactive button that opens/closes the dropdown
|
|
694
|
+
- `Select.Value` – displays the selected option or a placeholder
|
|
695
|
+
- `Select.Content` – dropdown container for options
|
|
696
|
+
- `Select.Item` – an individual selectable option
|
|
697
|
+
- `Select.Group` – groups related options
|
|
698
|
+
- `Select.Label` – heading for a group
|
|
699
|
+
|
|
700
|
+
Supports both **controlled** (`value`/`onValueChange`) and **uncontrolled** (`defaultValue`) usage.
|
|
701
|
+
|
|
702
|
+
---
|
|
703
|
+
|
|
704
|
+
## Import
|
|
705
|
+
|
|
706
|
+
```tsx
|
|
707
|
+
import { Select } from "@splenddev/kreativ-ui";
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
---
|
|
711
|
+
|
|
712
|
+
## Basic Usage
|
|
713
|
+
|
|
714
|
+
```tsx
|
|
715
|
+
<Select placeholder="Select a country">
|
|
716
|
+
<Select.Trigger>
|
|
717
|
+
<Select.Value />
|
|
718
|
+
</Select.Trigger>
|
|
719
|
+
|
|
720
|
+
<Select.Content>
|
|
721
|
+
<Select.Item value="us">United States</Select.Item>
|
|
722
|
+
<Select.Item value="ca">Canada</Select.Item>
|
|
723
|
+
<Select.Item value="mx">Mexico</Select.Item>
|
|
724
|
+
</Select.Content>
|
|
725
|
+
</Select>
|
|
726
|
+
```
|
|
727
|
+
|
|
728
|
+
---
|
|
729
|
+
|
|
730
|
+
## Controlled Select
|
|
731
|
+
|
|
732
|
+
Use `value` and `onValueChange` to control the selection from a parent component.
|
|
733
|
+
|
|
734
|
+
```tsx
|
|
735
|
+
import { useState } from "react";
|
|
736
|
+
|
|
737
|
+
function ControlledSelect() {
|
|
738
|
+
const [value, setValue] = useState<string | undefined>("");
|
|
739
|
+
|
|
740
|
+
return (
|
|
741
|
+
<Select value={value} onValueChange={setValue}>
|
|
742
|
+
<Select.Trigger>
|
|
743
|
+
<Select.Value placeholder="Choose a framework" />
|
|
744
|
+
</Select.Trigger>
|
|
745
|
+
|
|
746
|
+
<Select.Content>
|
|
747
|
+
<Select.Item value="react">React</Select.Item>
|
|
748
|
+
<Select.Item value="vue">Vue</Select.Item>
|
|
749
|
+
<Select.Item value="svelte">Svelte</Select.Item>
|
|
750
|
+
</Select.Content>
|
|
751
|
+
</Select>
|
|
752
|
+
);
|
|
753
|
+
}
|
|
754
|
+
```
|
|
755
|
+
|
|
756
|
+
> When `clearable` is enabled, clearing the value will call `onValueChange(undefined)`. The parent must handle this state change accordingly.
|
|
757
|
+
|
|
758
|
+
---
|
|
759
|
+
|
|
760
|
+
## Uncontrolled Select
|
|
761
|
+
|
|
762
|
+
Use `defaultValue` for an uncontrolled component.
|
|
763
|
+
|
|
764
|
+
```tsx
|
|
765
|
+
<Select defaultValue="react">
|
|
766
|
+
<Select.Trigger>
|
|
767
|
+
<Select.Value placeholder="Choose a framework" />
|
|
768
|
+
</Select.Trigger>
|
|
769
|
+
|
|
770
|
+
<Select.Content>
|
|
771
|
+
<Select.Item value="react">React</Select.Item>
|
|
772
|
+
<Select.Item value="vue">Vue</Select.Item>
|
|
773
|
+
<Select.Item value="angular">Angular</Select.Item>
|
|
774
|
+
</Select.Content>
|
|
775
|
+
</Select>
|
|
776
|
+
```
|
|
777
|
+
|
|
778
|
+
---
|
|
779
|
+
|
|
780
|
+
## Props
|
|
781
|
+
|
|
782
|
+
| Prop | Type | Default | Description |
|
|
783
|
+
| --------------- | ------------------------------------------ | ----------- | ---------------------------------------------------------------- |
|
|
784
|
+
| `value` | `string` | – | Controlled selected value |
|
|
785
|
+
| `defaultValue` | `string` | – | Uncontrolled initial value |
|
|
786
|
+
| `onValueChange` | `(value?: string) => void` | – | Called when selection changes |
|
|
787
|
+
| `placeholder` | `string` | – | Text shown when no value is selected |
|
|
788
|
+
| `required` | `boolean` | `false` | Marks the field as required (`aria-required`) |
|
|
789
|
+
| `name` | `string` | – | Name for the hidden input used in form submissions |
|
|
790
|
+
| `disabled` | `boolean` | `false` | Disables the entire select |
|
|
791
|
+
| `clearable` | `boolean` | `false` | Shows a clear button (removes selection) |
|
|
792
|
+
| `variant` | `"outline" \| "filled" \| "ghost"` | `"outline"` | Visual style |
|
|
793
|
+
| `size` | `"sm" \| "md" \| "lg"` | `"md"` | Size of the trigger and content |
|
|
794
|
+
| `error` | `boolean` | `false` | Shows error state and sets `aria-invalid="true"` |
|
|
795
|
+
| `success` | `boolean` | `false` | Shows success state |
|
|
796
|
+
| `rounded` | `boolean` | `false` | Applies fully rounded corners to the trigger |
|
|
797
|
+
| `className` | `string` | – | Additional class names for the root container |
|
|
798
|
+
|
|
799
|
+
---
|
|
800
|
+
|
|
801
|
+
## Compound Components
|
|
802
|
+
|
|
803
|
+
### `Select.Trigger`
|
|
804
|
+
|
|
805
|
+
The interactive button that toggles the dropdown. It receives all necessary ARIA attributes from the root `Select`.
|
|
806
|
+
|
|
807
|
+
```tsx
|
|
808
|
+
<Select.Trigger>
|
|
809
|
+
<Select.Value />
|
|
810
|
+
</Select.Trigger>
|
|
811
|
+
```
|
|
812
|
+
|
|
813
|
+
### `Select.Value`
|
|
814
|
+
|
|
815
|
+
Renders the current selection or the placeholder. The label is derived from the matching `Select.Item`’s children.
|
|
816
|
+
|
|
817
|
+
```tsx
|
|
818
|
+
<Select.Value placeholder="Choose an option" />
|
|
819
|
+
```
|
|
820
|
+
|
|
821
|
+
### `Select.Content`
|
|
822
|
+
|
|
823
|
+
The dropdown container. Renders its children (items, groups, labels) inside a listbox.
|
|
824
|
+
|
|
825
|
+
```tsx
|
|
826
|
+
<Select.Content>
|
|
827
|
+
{/* items */}
|
|
828
|
+
</Select.Content>
|
|
829
|
+
```
|
|
830
|
+
|
|
831
|
+
### `Select.Item`
|
|
832
|
+
|
|
833
|
+
A single selectable option.
|
|
834
|
+
|
|
835
|
+
| Prop | Type | Default | Description |
|
|
836
|
+
| ---------- | --------- | ------- | --------------------------------- |
|
|
837
|
+
| `value` | `string` | required | Value of the option |
|
|
838
|
+
| `disabled` | `boolean` | `false` | Disables this option |
|
|
839
|
+
| `children` | `ReactNode` | – | Display label |
|
|
840
|
+
|
|
841
|
+
```tsx
|
|
842
|
+
<Select.Item value="react" disabled>React</Select.Item>
|
|
843
|
+
```
|
|
844
|
+
|
|
845
|
+
### `Select.Group`
|
|
846
|
+
|
|
847
|
+
Groups related options, typically used with `Select.Label`.
|
|
848
|
+
|
|
849
|
+
```tsx
|
|
850
|
+
<Select.Group>
|
|
851
|
+
<Select.Label>Frontend</Select.Label>
|
|
852
|
+
<Select.Item value="react">React</Select.Item>
|
|
853
|
+
<Select.Item value="vue">Vue</Select.Item>
|
|
854
|
+
</Select.Group>
|
|
855
|
+
```
|
|
856
|
+
|
|
857
|
+
### `Select.Label`
|
|
858
|
+
|
|
859
|
+
A heading for a group of options. It is rendered as a non‑interactive label inside the listbox.
|
|
860
|
+
|
|
861
|
+
```tsx
|
|
862
|
+
<Select.Label>Backend</Select.Label>
|
|
863
|
+
```
|
|
864
|
+
|
|
865
|
+
---
|
|
866
|
+
|
|
867
|
+
## Accessibility
|
|
868
|
+
|
|
869
|
+
`Select` implements the WAI‑ARIA combobox pattern and manages all necessary relationships automatically.
|
|
870
|
+
|
|
871
|
+
**Roles & Attributes**:
|
|
872
|
+
|
|
873
|
+
- Trigger: `role="combobox"`, `aria-haspopup="listbox"`, `aria-expanded`, `aria-controls`, `aria-activedescendant`
|
|
874
|
+
- Content: `role="listbox"`
|
|
875
|
+
- Items: `role="option"`, `aria-selected`, `aria-disabled`
|
|
876
|
+
|
|
877
|
+
**Automatic IDs**: The root generates unique IDs for the trigger, content, and each option. These are used to connect the trigger to the listbox and to manage `aria-activedescendant`.
|
|
878
|
+
|
|
879
|
+
**FormField integration**: When placed inside a `FormField`, the Select consumes the following context:
|
|
880
|
+
|
|
881
|
+
- `id` – becomes the trigger’s `id`
|
|
882
|
+
- `labelId` – linked via `aria-labelledby`
|
|
883
|
+
- `descriptionId` / `messageId` – linked via `aria-describedby`
|
|
884
|
+
- `invalid` – sets `aria-invalid`
|
|
885
|
+
- `required` – sets `aria-required`
|
|
886
|
+
|
|
887
|
+
This ensures full ARIA support with no manual configuration.
|
|
888
|
+
|
|
889
|
+
---
|
|
890
|
+
|
|
891
|
+
## Keyboard Navigation
|
|
892
|
+
|
|
893
|
+
| Key | Open state | Closed state |
|
|
894
|
+
| ----------- | ---------- | ------------------------------------ |
|
|
895
|
+
| `ArrowDown` | Next item | Opens the dropdown |
|
|
896
|
+
| `ArrowUp` | Previous item | Opens the dropdown (or no-op) |
|
|
897
|
+
| `Home` | First item | Opens and selects first? (implementation) |
|
|
898
|
+
| `End` | Last item | Opens and selects last? |
|
|
899
|
+
| `Enter` | Select active item | Opens the dropdown |
|
|
900
|
+
| `Space` | Select active item | Opens the dropdown |
|
|
901
|
+
| `Escape` | Closes dropdown | – |
|
|
902
|
+
| `Backspace` | – | Clears selection (if `clearable`) |
|
|
903
|
+
| `Delete` | – | Clears selection (if `clearable`) |
|
|
904
|
+
|
|
905
|
+
> When the dropdown is open, `ArrowDown`/`ArrowUp` navigate through items. `Enter`/`Space` select the active (highlighted) item and close the dropdown. `Escape` closes the dropdown without selection.
|
|
906
|
+
|
|
907
|
+
---
|
|
908
|
+
|
|
909
|
+
## Clearable Select
|
|
910
|
+
|
|
911
|
+
When `clearable` is `true`, a clear button appears inside the trigger when a value is selected. Clicking it resets the selection to `undefined`.
|
|
912
|
+
|
|
913
|
+
```tsx
|
|
914
|
+
<Select clearable defaultValue="react">
|
|
915
|
+
<Select.Trigger>
|
|
916
|
+
<Select.Value placeholder="Pick a framework" />
|
|
917
|
+
</Select.Trigger>
|
|
918
|
+
|
|
919
|
+
<Select.Content>
|
|
920
|
+
<Select.Item value="react">React</Select.Item>
|
|
921
|
+
<Select.Item value="vue">Vue</Select.Item>
|
|
922
|
+
</Select.Content>
|
|
923
|
+
</Select>
|
|
924
|
+
```
|
|
925
|
+
|
|
926
|
+
**Controlled behavior**: The parent must handle `onValueChange(undefined)` to update its own state.
|
|
927
|
+
|
|
928
|
+
**Uncontrolled behavior**: The internal state is cleared automatically.
|
|
929
|
+
|
|
930
|
+
---
|
|
931
|
+
|
|
932
|
+
## Disabled Options
|
|
933
|
+
|
|
934
|
+
Individual items can be disabled using the `disabled` prop. They are not selectable via mouse or keyboard navigation and are announced as disabled by screen readers.
|
|
935
|
+
|
|
936
|
+
```tsx
|
|
937
|
+
<Select.Item value="legacy" disabled>Legacy</Select.Item>
|
|
938
|
+
```
|
|
939
|
+
|
|
940
|
+
Disabled items are skipped when navigating with arrow keys.
|
|
941
|
+
|
|
942
|
+
---
|
|
943
|
+
|
|
944
|
+
## Validation States
|
|
945
|
+
|
|
946
|
+
### Error
|
|
947
|
+
|
|
948
|
+
```tsx
|
|
949
|
+
<Select error>
|
|
950
|
+
<Select.Trigger>
|
|
951
|
+
<Select.Value placeholder="Choose" />
|
|
952
|
+
</Select.Trigger>
|
|
953
|
+
<Select.Content>...</Select.Content>
|
|
954
|
+
</Select>
|
|
955
|
+
```
|
|
956
|
+
|
|
957
|
+
Visually styles the trigger with error colours and sets `aria-invalid="true"`.
|
|
958
|
+
|
|
959
|
+
### Success
|
|
960
|
+
|
|
961
|
+
```tsx
|
|
962
|
+
<Select success>...</Select>
|
|
963
|
+
```
|
|
964
|
+
|
|
965
|
+
Applies success styling.
|
|
966
|
+
|
|
967
|
+
---
|
|
968
|
+
|
|
969
|
+
## FormField Integration
|
|
970
|
+
|
|
971
|
+
When used inside a `FormField`, the Select automatically inherits the field’s `id`, `required`, and validation state.
|
|
972
|
+
|
|
973
|
+
```tsx
|
|
974
|
+
<FormField required error="Please select a country">
|
|
975
|
+
<FormField.Label>Country</FormField.Label>
|
|
976
|
+
<FormField.Description>Select your country of residence.</FormField.Description>
|
|
977
|
+
|
|
978
|
+
<Select>
|
|
979
|
+
<Select.Trigger>
|
|
980
|
+
<Select.Value placeholder="Select a country" />
|
|
981
|
+
</Select.Trigger>
|
|
982
|
+
<Select.Content>
|
|
983
|
+
<Select.Item value="us">United States</Select.Item>
|
|
984
|
+
<Select.Item value="ca">Canada</Select.Item>
|
|
985
|
+
</Select.Content>
|
|
986
|
+
</Select>
|
|
987
|
+
|
|
988
|
+
<FormField.Message />
|
|
989
|
+
</FormField>
|
|
990
|
+
```
|
|
991
|
+
|
|
992
|
+
> No extra props are needed – the Select picks up the context automatically.
|
|
993
|
+
|
|
994
|
+
---
|
|
995
|
+
|
|
996
|
+
## Native Form Submission
|
|
997
|
+
|
|
998
|
+
The `name` prop renders a hidden `<input>` that is included in form submissions. The value submitted is the currently selected `value`.
|
|
999
|
+
|
|
1000
|
+
```tsx
|
|
1001
|
+
<form onSubmit={handleSubmit}>
|
|
1002
|
+
<Select name="country" defaultValue="us">
|
|
1003
|
+
<Select.Trigger>
|
|
1004
|
+
<Select.Value placeholder="Select a country" />
|
|
1005
|
+
</Select.Trigger>
|
|
1006
|
+
<Select.Content>
|
|
1007
|
+
<Select.Item value="us">United States</Select.Item>
|
|
1008
|
+
<Select.Item value="ca">Canada</Select.Item>
|
|
1009
|
+
</Select.Content>
|
|
1010
|
+
</Select>
|
|
1011
|
+
|
|
1012
|
+
<button type="submit">Submit</button>
|
|
1013
|
+
</form>
|
|
1014
|
+
```
|
|
1015
|
+
|
|
1016
|
+
---
|
|
1017
|
+
|
|
1018
|
+
## Styling and Theming
|
|
1019
|
+
|
|
1020
|
+
Select uses the same theming infrastructure as other Kreativ UI form controls:
|
|
1021
|
+
|
|
1022
|
+
- `theme.recipes.FormControl` defines base, variant, and size styles.
|
|
1023
|
+
- `useSizeStyle` applies height, padding, and font size from the `sizes` token.
|
|
1024
|
+
- Variants (`outline`, `filled`, `ghost`) are resolved via `resolveRecipe`.
|
|
1025
|
+
- Validation states (`error`, `success`) are applied through CSS variables and class names.
|
|
1026
|
+
|
|
1027
|
+
All styling is driven by the runtime theme, so overriding the visual appearance can be done by providing a custom `FormControl` recipe in the theme.
|
|
1028
|
+
|
|
1029
|
+
---
|
|
1030
|
+
|
|
1031
|
+
## Data Attributes
|
|
1032
|
+
|
|
1033
|
+
The Select exposes several data attributes for styling or testing:
|
|
1034
|
+
|
|
1035
|
+
| Attribute | Element | Values | Description |
|
|
1036
|
+
| ------------------ | --------------- | -------------------------- | ---------------------------------------- |
|
|
1037
|
+
| `data-state` | `Select.Trigger` | `"open"`, `"closed"` | Current dropdown state |
|
|
1038
|
+
| `data-state` | `Select.Item` | `"selected"`, `"unselected"` | Selection state of the item |
|
|
1039
|
+
| `data-active` | `Select.Item` | present when highlighted | Keyboard‑focused item (active) |
|
|
1040
|
+
| `data-disabled` | `Select.Item` | present when disabled | Disabled state |
|
|
1041
|
+
| `data-invalid` | `Select.Trigger` | present when error | Error state |
|
|
1042
|
+
|
|
1043
|
+
---
|
|
1044
|
+
|
|
1045
|
+
## Complete Example
|
|
1046
|
+
|
|
1047
|
+
```tsx
|
|
1048
|
+
import { useState } from "react";
|
|
1049
|
+
import { FormField, Select } from "@splenddev/kreativ-ui";
|
|
1050
|
+
|
|
1051
|
+
function CountrySelect() {
|
|
1052
|
+
const [country, setCountry] = useState<string | undefined>("");
|
|
1053
|
+
const [error, setError] = useState("");
|
|
1054
|
+
|
|
1055
|
+
const validate = (value?: string) => {
|
|
1056
|
+
if (!value) setError("Please select a country");
|
|
1057
|
+
else setError("");
|
|
1058
|
+
};
|
|
1059
|
+
|
|
1060
|
+
return (
|
|
1061
|
+
<FormField required error={error}>
|
|
1062
|
+
<FormField.Label>Country</FormField.Label>
|
|
1063
|
+
<FormField.Description>Choose your country of residence.</FormField.Description>
|
|
1064
|
+
|
|
1065
|
+
<Select
|
|
1066
|
+
value={country}
|
|
1067
|
+
onValueChange={(val) => {
|
|
1068
|
+
setCountry(val);
|
|
1069
|
+
validate(val);
|
|
1070
|
+
}}
|
|
1071
|
+
clearable
|
|
1072
|
+
name="country"
|
|
1073
|
+
error={!!error}
|
|
1074
|
+
>
|
|
1075
|
+
<Select.Trigger>
|
|
1076
|
+
<Select.Value placeholder="Select a country" />
|
|
1077
|
+
</Select.Trigger>
|
|
1078
|
+
|
|
1079
|
+
<Select.Content>
|
|
1080
|
+
<Select.Group>
|
|
1081
|
+
<Select.Label>North America</Select.Label>
|
|
1082
|
+
<Select.Item value="us">United States</Select.Item>
|
|
1083
|
+
<Select.Item value="ca">Canada</Select.Item>
|
|
1084
|
+
<Select.Item value="mx">Mexico</Select.Item>
|
|
1085
|
+
</Select.Group>
|
|
1086
|
+
|
|
1087
|
+
<Select.Group>
|
|
1088
|
+
<Select.Label>Europe</Select.Label>
|
|
1089
|
+
<Select.Item value="uk">United Kingdom</Select.Item>
|
|
1090
|
+
<Select.Item value="de">Germany</Select.Item>
|
|
1091
|
+
<Select.Item value="fr" disabled>France (disabled)</Select.Item>
|
|
1092
|
+
</Select.Group>
|
|
1093
|
+
</Select.Content>
|
|
1094
|
+
</Select>
|
|
1095
|
+
|
|
1096
|
+
{error && <FormField.Message>{error}</FormField.Message>}
|
|
1097
|
+
</FormField>
|
|
1098
|
+
);
|
|
1099
|
+
}
|
|
1100
|
+
```
|
|
1101
|
+
|
|
1102
|
+
---
|
|
1103
|
+
|
|
1104
|
+
For more advanced use cases (e.g., async loading, custom rendering), refer to the [GitHub repository examples](https://github.com/Vincentvirtuoso/kreativ-ui).
|
|
1105
|
+
|
|
1106
|
+
---
|
|
1107
|
+
|
|
1108
|
+
# ♿ Accessibility
|
|
1109
|
+
|
|
1110
|
+
Kreativ UI components are built with accessibility in mind:
|
|
1111
|
+
|
|
1112
|
+
- All interactive elements support keyboard navigation.
|
|
1113
|
+
- Focus management and visible focus indicators.
|
|
1114
|
+
- ARIA attributes are applied automatically where needed (e.g., `aria-label`, `aria-describedby`, `aria-invalid`).
|
|
1115
|
+
- Colour contrast respects system‑level settings.
|
|
1116
|
+
|
|
1117
|
+
---
|
|
1118
|
+
|
|
1119
|
+
# 📦 Browser Support
|
|
1120
|
+
|
|
1121
|
+
Kreativ UI works in all modern browsers (Chrome, Firefox, Safari, Edge).
|
|
1122
|
+
Requires React 18 or later.
|
|
1123
|
+
|
|
1124
|
+
---
|
|
1125
|
+
|
|
1126
|
+
# 📄 License
|
|
1127
|
+
|
|
1128
|
+
MIT
|
|
1129
|
+
|
|
1130
|
+
---
|
|
1131
|
+
|
|
1132
|
+
**More component documentation (Textarea, Checkbox, RadioGroup, etc.) coming soon.**
|
|
1133
|
+
Visit the [GitHub repository](https://github.com/Vincentvirtuoso/kreativ-ui) for updates.
|