-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomponents.html-data.json
1251 lines (1251 loc) · 56.4 KB
/
components.html-data.json
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
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
{
"$schema": "https://raw.githubusercontent.com/microsoft/vscode-html-languageservice/refs/heads/main/docs/customData.schema.json",
"version": 1.1,
"tags": [
{
"name": "s-button",
"description": "**按钮 Button**\n\n基础按钮,适用于简单的点击操作。\n\n```html\n<s-button>button</s-button>\n```\n\n> 如果你只需要一个拥有触摸反馈的容器,那么 [Ripple](https://soberjs.com/component/ripple) 组件可能更适合。\n\n**属性:**\n\n- `type`: 按钮样式\n- `disabled` (`boolean`): 是否禁用\n\n**插槽:**\n\n- `start`: 开始\n- `end`: 结束",
"attributes": [
{
"name": "type",
"description": "按钮样式。\n\n可选值为:\n- `filled`\n- `elevated`\n- `filled-tonal`\n- `outlined`\n- `text`",
"values": [
{
"name": "filled",
"description": "默认值。带有较明显背景色的按钮"
},
{
"name": "elevated",
"description": "带有阴影的按钮"
},
{
"name": "filled-tonal",
"description": "带有背景色的按钮"
},
{
"name": "outlined",
"description": "带有边框的按钮"
},
{
"name": "text",
"description": "只包含文字的按钮,没有其他样式"
}
]
},
{
"name": "disabled",
"description": "是否禁用",
"valueSet": "boolean"
}
],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/button"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/button.ts"
}
]
},
{
"name": "s-icon",
"description": "**图标 Icon**\n\n图标。\n\n我们推荐你使用 `svg` 作为图标,`icon` 组件作为 `svg` 的容器使用。\n\n```html\n<s-icon>\n <svg viewBox=\"...\">...</svg>\n</s-icon>\n```\n\n为了方便使用和出于体积考虑,`icon` 自带了一些常用的图标,你可以使用 `type` 指定图标\n\n```html\n<s-icon type=\"home\"></s-icon>\n```\n\n你可以在图标库中获取 SVG 图标,或者使用阿里巴巴矢量图标库。\n\n**属性:**\n\n- `type`: 图标名称",
"attributes": [
{
"name": "type",
"description": "图标名称。",
"values": [
{
"name": "none",
"description": "不使用内置图标"
},
{ "name": "home" },
{ "name": "search" },
{ "name": "menu" },
{ "name": "arrow_back" },
{ "name": "arrow_forward" },
{ "name": "arrow_upward" },
{ "name": "arrow_downward" },
{ "name": "arrow_drop_up" },
{ "name": "arrow_drop_down" },
{ "name": "arrow_drop_left" },
{ "name": "arrow_drop_right" },
{ "name": "more_vert" },
{ "name": "more_horiz" },
{ "name": "close" },
{ "name": "chevron_up" },
{ "name": "chevron_down" },
{ "name": "chevron_left" },
{ "name": "chevron_right" },
{ "name": "light_mode" },
{ "name": "dark_mode" },
{ "name": "star" },
{ "name": "favorite" }
]
}
],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/icon"
},
{
"name": "图标库",
"url": "https://soberjs.com/resource/icon"
},
{
"name": "阿里巴巴矢量图标库",
"url": "https://www.iconfont.cn/"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/icon.ts"
}
]
},
{
"name": "s-icon-button",
"description": "**图标按钮 Icon Button**\n\n```html\n<s-icon-button>\n <s-icon type=\"search\"></s-icon>\n</s-icon-button>\n```\n\n**属性:**\n\n- `type`: 按钮样式\n- `disabled` (`boolean`): 是否禁用",
"attributes": [
{
"name": "type",
"description": "按钮样式。\n\n可选值为:\n- `text`\n- `filled`\n- `elevated`\n- `filled-tonal`\n- `outlined`",
"values": [
{
"name": "text",
"description": "默认值。只包含文字的按钮,没有其他样式"
},
{
"name": "filled",
"description": "带有较明显背景色的按钮"
},
{
"name": "elevated",
"description": "带有阴影的按钮"
},
{
"name": "filled-tonal",
"description": "带有背景色的按钮"
},
{
"name": "outlined",
"description": "带有边框的按钮"
}
]
},
{
"name": "disabled",
"description": "是否禁用",
"valueSet": "boolean"
}
],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/icon-button"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/icon-button.ts"
}
]
},
{
"name": "s-fab",
"description": "**浮动操作按钮 Floating Action Button**\n\n```html\n<s-fab>\n <s-icon type=\"add\"></s-icon>\n</s-fab>\n```\n\n设置 `extended` 来开启扩展浮动按钮。\n\n**属性:**\n\n- `size`: 按钮大小\n- `extended` (`boolean`): 是否为扩展按钮\n\n**插槽:**\n\n- `start`: 开始\n- `end`: 结束",
"attributes": [
{
"name": "size",
"description": "按钮大小。\n\n可选值为:\n- `medium`\n- `small`",
"values": [
{
"name": "medium",
"description": "默认值。中等大小"
},
{
"name": "small",
"description": "大小较小"
}
]
},
{
"name": "extended",
"description": "是否为扩展按钮",
"valueSet": "boolean"
}
],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/FAB"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/FAB.ts"
}
]
},
{
"name": "s-segmented-button",
"description": "**分组按钮 Segmented Button**\n\n```html\n<s-segmented-button>\n <s-segmented-button-item selected=\"true\">\n <s-icon slot=\"start\" type=\"search\"></s-icon>\n item1\n </s-segmented-button-item>\n <s-segmented-button-item disabled=\"true\">\n item2\n <s-icon slot=\"end\" type=\"close\"></s-icon>\n </s-segmented-button-item>\n</s-segmented-button>\n```\n\n**属性:**\n\n- `options` _[只读]_ (`SegmentedButtonItem[]`): 子项目\n- `selectedIndex` _[只读]_ (`number`): 当前选中下标\n\n**事件:**\n- `change`: 选中变化后触发\n\n**插槽:**\n\n- `start`: 开始(不会触发选中)\n- `end`: 结束(不会触发选中)",
"attributes": [
{
"name": "onchange",
"description": "选中变化后触发"
}
],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/segmented-button"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/segmented-button.ts"
}
]
},
{
"name": "s-segmented-button-item",
"description": "**分组按钮项目 Segmented Button Item**\n\n作为 `s-segmented-item` 的子项使用。\n\n**属性:**\n\n- `selected` (`boolean`): 是否选中。\n- `disabled` (`boolean`): 是否禁用\n- `selectable` (`boolean`): 是否启用选中",
"attributes": [
{
"name": "selected",
"description": "是否选中",
"valueSet": "boolean"
},
{
"name": "disabled",
"description": "是否禁用",
"valueSet": "boolean"
},
{
"name": "selectable",
"description": "是否启用选中",
"valueSet": "boolean"
}
],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/segmented-button"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/segmented-button.ts"
}
]
},
{
"name": "s-ripple",
"description": "**波纹 Ripple**\n\n波纹是一个容器,它本身没有任何样式,波纹的颜色继承文本颜色,并带有一定的不透明度。\n\n```html\n<s-ripple style=\"padding: 16px 48px\">test</s-ripple>\n```\n\n如果你希望单独修改波纹颜色,那你应当使用 CSS 变量。\n\n设置 `attached` 来启用依附模式,它依附在容器中呈现,事件从容器上触发,某些情况下可能有妙用。\n\n由于使用定位确定位置,所以容器的 `position` 必须设置为 `relative`、`absolute`、`sticky`、`fixed` 其中之一。\n\n**属性:**\n\n- `centered` (`boolean`): 波纹是否居中\n- `attached` (`boolean`): 是否设置为依附模式\n- `rippled` _[只读]_ (`boolean`): 在波纹触发时,容器将被设置该属性\n\n**CSS 变量:**\n\n- `--ripple-color`: 波纹颜色\n- `--ripple-opacity`: 波纹颜色不透明度",
"attributes": [
{
"name": "centered",
"description": "波纹是否居中",
"valueSet": "boolean"
},
{
"name": "attached",
"description": "是否设置为依附模式",
"valueSet": "boolean"
}
],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/ripple"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/ripple.ts"
}
]
},
{
"name": "s-checkbox",
"description": "**复选框 Checkbox**\n\n```html\n<s-checkbox>已阅读用户协议</s-checkbox>\n<s-checkbox checked=\"true\"></s-checkbox>\n<s-checkbox indeterminate=\"true\"></s-checkbox>\n```\n\n设置 disabled 来禁用复选框。\n\n使用`color`自定义颜色。\n\n**属性:**\n\n- `checked` (`boolean`): 是否选中\n- `disabled` (`boolean`): 是否禁用\n- `indeterminate` (`boolean`): 是否未知\n\n**事件:**\n- `change`: 选中变化后触发",
"attributes": [
{
"name": "checked",
"description": "是否选中",
"valueSet": "boolean"
},
{
"name": "disabled",
"description": "是否禁用",
"valueSet": "boolean"
},
{
"name": "indeterminate",
"description": "是否未知",
"valueSet": "boolean"
},
{
"name": "onchange",
"description": "选中变化后触发"
}
],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/checkbox"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/checkbox.ts"
}
]
},
{
"name": "s-radio-button",
"description": "**单选按钮 Radio Button**\n\n单选按钮需要设置一个唯一的 `name` 作为分组才能执行单选。\n\n```html\n<s-radio-button name=\"group\">男</s-radio-button>\n<s-radio-button name=\"group\">女</s-radio-button>\n<s-radio-button name=\"group\" disabled=\"true\">未知</s-radio-button>\n```\n\n设置 `disabled` 来禁用复选框。\n\n使用`color`自定义颜色。\n\n**属性:**\n\n- `name` (`string`): 名称\n- `checked` (`boolean`): 是否选中\n- `disabled` (`boolean`): 是否禁用\n\n**事件:**\n- `change`: 选中变化后触发",
"attributes": [
{
"name": "name",
"description": "名称"
},
{
"name": "checked",
"description": "是否选中",
"valueSet": "boolean"
},
{
"name": "disabled",
"description": "是否禁用",
"valueSet": "boolean"
},
{
"name": "onchange",
"description": "选中变化后触发"
}
],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/radio-button"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/radio-button.ts"
}
]
},
{
"name": "s-slider",
"description": "**滑块 Slider**\n\n```html\n<s-slider></s-slider>\n```\n\n设置 `labeled` 开启文本标签。\n\n设置 `disabled` 来禁用滑块。\n\n使用`color`自定义颜色。\n\n**属性:**\n\n- `labeled` (`boolean`): 是否启用文本标签\n- `disabled` (`boolean`): 是否禁用\n- `max` (`number`): 最大值\n- `min` (`number`): 最小值\n- `step` (`number`): 步进值\n- `value` (`number`): 当前值\n\n**事件:**\n- `change`: 值变化后触发",
"attributes": [
{
"name": "labeled",
"description": "是否启用文本标签",
"valueSet": "boolean"
},
{
"name": "disabled",
"description": "是否禁用",
"valueSet": "boolean"
},
{
"name": "max",
"description": "最大值"
},
{
"name": "min",
"description": "最小值"
},
{
"name": "step",
"description": "步进值"
},
{
"name": "value",
"description": "当前值"
},
{
"name": "onchange",
"description": "值变化后触发"
}
],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/slider"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/slider.ts"
}
]
},
{
"name": "s-linear-progress",
"description": "**线性进度 Linear Progress**\n\n```html\n<s-linear-progress value=\"50\"></s-linear-progress>\n```\n\n设置 `indeterminate` 来启用未知进度。\n```html\n<s-linear-progress indeterminate=\"true\"></s-linear-progress>\n```\n\n设置 `animated` 来启用变更过渡动画。\n\n使用`color`自定义颜色。\n\n**属性:**\n\n- `indeterminate` (`boolean`): 是否未知\n- `animated` (`boolean`): 是否启用变更时过渡动画\n- `max` (`number`): 最大值\n- `value` (`number`): 当前值",
"attributes": [
{
"name": "indeterminate",
"description": "是否未知",
"valueSet": "boolean"
},
{
"name": "animated",
"description": "是否启用变更时过渡动画",
"valueSet": "boolean"
},
{
"name": "max",
"description": "最大值"
},
{
"name": "value",
"description": "当前值"
},
{
"name": "onchange",
"description": "选中变化后触发"
}
],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/linear-progress"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/linear-progress.ts"
}
]
},
{
"name": "s-circular-progress",
"description": "**圆形进度 Circular Progress**\n\n```html\n<s-circular-progress value=\"50\"></s-circular-progress>\n```\n\n设置 `indeterminate` 来启用未知进度。\n```html\n<s-circular-progress indeterminate=\"true\"></s-circular-progress>\n```\n\n设置 `animated` 来启用变更过渡动画。\n\n使用`color`自定义颜色。\n\n**属性:**\n\n- `indeterminate` (`boolean`): 是否未知\n- `animated` (`boolean`): 是否启用变更时过渡动画\n- `max` (`number`): 最大值\n- `value` (`number`): 当前值",
"attributes": [
{
"name": "indeterminate",
"description": "是否未知",
"valueSet": "boolean"
},
{
"name": "animated",
"description": "是否启用变更时过渡动画",
"valueSet": "boolean"
},
{
"name": "max",
"description": "最大值"
},
{
"name": "value",
"description": "当前值"
},
{
"name": "onchange",
"description": "选中变化后触发"
}
],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/circular-progress"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/circular-progress.ts"
}
]
},
{
"name": "s-switch",
"description": "**开关 Switch**\n\n```html\n<s-switch></s-switch>\n<s-switch checked=\"true\"></s-switch>\n```\n\n设置 `disabled` 来禁用开关。\n\n使用`color`自定义颜色。\n\n**属性:**\n\n- `checked` (`boolean`): 是否选中\n- `disabled` (`boolean`): 是否禁用\n\n**事件:**\n- `change`: 选中变化后触发",
"attributes": [
{
"name": "checked",
"description": "是否选中",
"valueSet": "boolean"
},
{
"name": "disabled",
"description": "是否禁用",
"valueSet": "boolean"
},
{
"name": "onchange",
"description": "选中变化后触发"
}
],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/switch"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/switch.ts"
}
]
},
{
"name": "s-text-field",
"description": "**文本框 Text Field**\n\n`Text Field` 是一个容器组件,可以在内部放置 `input` 和 `textarea` 元素。推荐使用 `label` 属性来替代 `placeholder`,从而在表单交互中提升可访问性。\n\n```html\n<s-text-field>\n <input type=\"text\" placeholder=\"请输入名称\">\n <s-icon slot=\"end\" type=\"favorite\"></s-icon>\n</s-text-field>\n\n<s-text-field label=\"请输入名称\">\n <input type=\"text\">\n <s-icon-button slot=\"end\">\n <s-icon slot=\"end\" type=\"star\"></s-icon>\n </s-icon-button>\n</s-text-field>\n```\n\n在使用 `textarea` 时,组件高度将会自适应,你可以通过设置 `min-height` 和 `max-height` 来定义文本框的最小和最大高度。\n\n```html\n<s-text-field label=\"请输入名称\">\n <textarea style=\"min-height: 112px\"></textarea>\n</s-text-field>\n```\n\n`Text Field` 支持 `display: grid` 样式,从而作为块元素占满一行。\n\n由于组件内部封装性较高,样式自定义变得复杂,因此开放了一些 CSS 变量来允许你自定义样式。\n\n**属性:**\n\n- `label` (`string`): 标签文本,用于替代 `placeholder`。\n- `value` (`string`): 文本框中的初始值。\n- `placeholder` (`string`): 用于显示在文本框中的占位符文本。\n\n**插槽:**\n\n- `start`: 插槽用于放置在文本框开始位置的内容(如图标或按钮)。\n- `end`: 插槽用于放置在文本框结束位置的内容(如图标或按钮)。\n\n**CSS 变量:**\n\n- `--text-field-border-radius`: 文本框的圆角,默认值为 `4px`。\n- `--text-field-border-width`: 文本框的边框宽度,默认值为 `1px`。\n- `--text-field-border-color`: 文本框的边框颜色,默认值为 `var(--s-color-outline, #777680)`。\n- `--text-field-padding`: 文本框的内边距,默认值为 `16px`。\n\n**示例:**\n\n```html\n<s-text-field label=\"请输入名称\">\n <input type=\"text\">\n <s-icon slot=\"end\" type=\"search\"></s-icon>\n</s-text-field>\n```\n\n你可以在 `<s-text-field>` 组件中加入 `input`、`textarea` 或其他表单元素,并结合 `slot` 插槽在文本框内放置额外内容(如图标或按钮)。",
"attributes": [
{
"name": "label",
"description": "标签文本,用于替代 `placeholder` 来描述文本框内容。"
},
{
"name": "value",
"description": "文本框中的初始值。"
},
{
"name": "placeholder",
"description": "用于显示在文本框中的占位符文本。"
}
],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/text-field"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/text-field.ts"
}
]
},
{
"name": "s-rate",
"description": "**评分 Rate**\n\n```html\n<s-rate></s-rate>\n```\n\n设置 `readOnly` 启用只读模式。\n\n使用 `track` 和 `indicator` 插槽来自定义图标,你可以使用 svg 或者 icon 组件。\n\n```html\n<s-rate>\n <s-icon slot=\"track\" type=\"favorite\"></s-icon>\n <s-icon slot=\"indicator\" type=\"favorite\"></s-icon>\n</s-rate>\n```\n\n> 如果你希望自定义大小,那么请使用 `font-size` 来设置,该组件需要保持宽高比例,单独设置 width 和 height 可能会导致变形。\n\n**属性:**\n\n- `readOnly` (`boolean`): 是否启用只读模式\n- `max` (`number`): 最大值\n- `min` (`number`): 最小值\n- `step` (`number`): 步进值\n- `value` (`number`): 当前值\n\n**事件:**\n- `change`: 值变化后触发\n- `input`: 值变化时触发\n\n**插槽:**\n- `track`: 未选中\n- `indicator`: 已选中",
"attributes": [
{
"name": "readOnly",
"description": "是否启用只读模式",
"valueSet": "boolean"
},
{
"name": "max",
"description": "最大值"
},
{
"name": "min",
"description": "最小值"
},
{
"name": "step",
"description": "步进值"
},
{
"name": "value",
"description": "当前值"
},
{
"name": "onchange",
"description": "值变化后触发"
},
{
"name": "oninput",
"description": "值变化时触发"
}
],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/rate"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/rate.ts"
}
]
},
{
"name": "s-picker",
"description": "**选择框 Picker**\n\n通常用于单选数据,它的目标是替代 `select` 元素。`s-picker` 组件可以通过定义多个 `s-picker-item` 选项来进行选择,支持标签文本、默认值设置以及自定义触发器。\n\n```html\n<s-picker label=\"选择地区\">\n <s-picker-item value=\"gui yang\">贵阳</s-picker-item>\n <s-picker-item value=\"bei jing\">北京</s-picker-item>\n <s-picker-item value=\"shang hai\">上海</s-picker-item>\n <s-picker-item value=\"shen zhen\">深圳</s-picker-item>\n <s-picker-item value=\"cheng du\">成都</s-picker-item>\n <s-picker-item value=\"wu han\">武汉</s-picker-item>\n <s-picker-item value=\"nan chang\">南昌</s-picker-item>\n <s-picker-item value=\"hang zhou\">杭州</s-picker-item>\n</s-picker>\n```\n\n你可以在 `s-picker-item` 上设置 `value` 来定义选项的值,并使用 `s-picker` 的 `value` 属性来设置默认选中的值。\n\n**属性:**\n\n- `label` (`string`): 标签文本,用于显示在选择框的触发按钮上。\n- `value` (`string`): 当前选中值,设置为选项 `s-picker-item` 中的 `value` 属性值。\n- `options` _[只读]_ (`PickerItem[]`): 子项目数组,默认为 `[]`。\n- `selectedIndex` (`number`): 当前选中下标,默认为 `-1`。\n- `show()` (`Function`): 显示选择框。\n- `dismiss()` (`Function`): 隐藏选择框。\n- `toggle()` (`Function`): 切换选择框的显示和隐藏状态。\n\n**事件:**\n\n- `change`: 选中值变化后触发。\n\n**插槽:**\n\n- `trigger`: 自定义触发器插槽。\n\n**CSS 变量:**\n\n- `--picker-border-radius`: 圆角,默认值为 `4px`。\n- `--picker-border-width`: 边框宽度,默认值为 `1px`。\n- `--picker-border-color`: 边框颜色,默认值为 `var(--s-color-outline, #777680)`。\n- `--picker-padding`: 内边距,默认值为 `16px`。\n- `--picker-height`: 高度,默认值为 `48px`。",
"attributes": [
{
"name": "label",
"description": "设置选择框的标签文本,用于显示在选择框触发按钮上。",
"type": "string"
},
{
"name": "value",
"description": "设置选中的值,对应子项 `s-picker-item` 的 `value` 属性。",
"type": "string",
"defaultValue": ""
},
{
"name": "selectedIndex",
"description": "当前选中下标。",
"type": "number",
"defaultValue": "-1"
}
],
"methods": [
{
"name": "show",
"description": "显示选择框。"
},
{
"name": "dismiss",
"description": "隐藏选择框。"
},
{
"name": "toggle",
"description": "切换选择框的显示与隐藏状态。"
}
],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/picker"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/picker.ts"
}
]
},
{
"name": "s-picker-item",
"description": "**选择框项目 Picker Item**\n\n作为 `s-picker` 组件的子组件使用,用于定义每个选择项。每个 `s-picker-item` 需要设置 `value` 属性来代表其选中值。\n\n**属性:**\n\n- `value` (`string`): 项目的值,用于标识该项被选中时的返回值。\n- `selected` (`boolean`): 是否选中该项,默认为 `false`。\n\n**插槽:**\n- `start`: 项目内容开始位置的插槽\n- `end`: 项目内容结束位置的插槽",
"attributes": [
{
"name": "value",
"description": "项目的值,用于标识该项被选中时的返回值。"
},
{
"name": "selected",
"description": "是否选中该项,默认为 `false`。",
"valueSet": "boolean"
}
],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/picker"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/picker.ts"
}
]
},
{
"name": "s-divider",
"description": "**分割线 Divider**\n\n```html\n<s-divider></s-divider>\n```",
"attributes": [],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/divider"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/divider.ts"
}
]
},
{
"name": "s-page",
"description": "**页面 Page**\n\n建议作为页面根容器的组件,它拥有全局的 CSS 变量,用于控制所有后代组件的样式。\n\n```html\n<s-page></s-page>\n```\n\n设置 `theme` 来使用其他主题。\n\n**属性:**\n\n- `theme`: 主题",
"attributes": [
{
"name": "theme",
"description": "主题,可选值为 `light`, `dark`, `auto`。",
"values": [
{
"name": "light",
"description": "亮色主题(默认)"
},
{
"name": "dark",
"description": "暗色主题"
},
{
"name": "auto",
"description": "跟随系统"
}
]
}
],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/page"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/page.ts"
}
]
},
{
"name": "s-drawer",
"description": "**抽屉 Drawer**\n\n当窗口宽度小于 1200px 时,抽屉会切换为折叠模式。通常适用于移动端,以便于腾出更多空间。\n\n```html\n<s-drawer>\n <div slot=\"start\">Start</div>\n <div>Main</div>\n <div slot=\"end\">End</div>\n</s-drawer>\n```\n\n**属性:**\n\n- `mode` _[只读]_: 模式\n\n**插槽:**\n- `start`: 开始插槽\n- `end`: 结束插槽",
"attributes": [],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/drawer"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/drawer.ts"
}
]
},
{
"name": "s-scroll-view",
"description": "**滚动 Scroll View**\n\n滚动为容器提供了滚动条样式,出于触屏设备优化,滚动条样式仅在支持鼠标的设备上有效。\n\n```html\n<s-scroll-view>\n <div style=\"height: 1080px;width: 2200px\"></div>\n</s-scroll-view>\n```",
"attributes": [],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/scroll-view"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/scroll-view.ts"
}
]
},
{
"name": "s-card",
"description": "**卡片 Card**\n\n用于显示内容的卡片组件,支持多种样式,可以作为容器使用。\n\n```html\n<s-card>\n <div slot=\"image\"></div>\n <div slot=\"headline\">Headline</div>\n <div slot=\"subhead\">Subhead</div>\n <div slot=\"text\">Cards are often used for grid lists, which provide click effects</div>\n <s-button slot=\"action\" type=\"filled-tonal\">Action</s-button>\n <s-button slot=\"action\">Action</s-button>\n</s-card>\n\n<s-card clickable=\"true\">\n <div slot=\"image\"></div>\n <div slot=\"headline\">Headline</div>\n <div slot=\"subhead\">Subhead</div>\n <div slot=\"text\">Cards are often used for grid lists, which provide click effects</div>\n <s-button slot=\"action\" type=\"filled-tonal\">Action</s-button>\n <s-button slot=\"action\">Action</s-button>\n</s-card>\n\n<s-card style=\"display: block; padding: 24px\">\n Card\n</s-card>\n```\n\n**属性:**\n\n- `type` (`elevated`, `filled`, `outlined`): 卡片样式,默认为 `elevated`\n- `clickable` (`boolean`): 是否启用可点击,默认为 `false`\n- `selectable` (`boolean`): 是否启用选中,默认为 `false`\n\n**插槽:**\n- `image`: 图片\n- `headline`: 标题\n- `subhead`: 副标题\n- `text`: 卡片文本\n- `action`: 操作按钮\n\n**CSS 变量:**\n\n- `--border-radius`: 边框半径\n- `--border-width`: 边框宽度\n- `--border-color`: 边框颜色\n- `--padding`: 内边距",
"attributes": [
{
"name": "type",
"description": "卡片样式,可选值为 `elevated`, `filled`, `outlined`。",
"values": [
{
"name": "elevated",
"description": "带有阴影的卡片"
},
{
"name": "filled",
"description": "带有背景色的卡片"
},
{
"name": "outlined",
"description": "带有边框的卡片"
}
]
},
{
"name": "clickable",
"description": "是否启用可点击",
"valueSet": "boolean"
},
{
"name": "selectable",
"description": "是否启用选中",
"valueSet": "boolean"
}
],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/card"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/card.ts"
}
]
},
{
"name": "s-search",
"description": "**搜索栏 Search**\n\n搜索组件支持不同尺寸和插槽。可以使用图标按钮、设置不同的尺寸以及自定义下拉插槽。\n\n```html\n<s-search>\n <s-icon-button slot=\"start\">\n <s-icon type=\"search\"></s-icon>\n </s-icon-button>\n <input type=\"text\" placeholder=\"搜索关键字\">\n <s-icon-button slot=\"end\">\n <s-icon type=\"close\"></s-icon>\n </s-icon-button>\n</s-search>\n\n<s-search>\n <s-icon type=\"search\" slot=\"start\"></s-icon>\n <input type=\"text\" placeholder=\"搜索关键字\">\n <s-icon type=\"close\" slot=\"end\"></s-icon>\n <div slot=\"dropdown\" style=\"height: 128px\">\n hello\n </div>\n</s-search>\n```\n\n**属性:**\n\n- `size` (`string`): 按钮大小,可选值为 `medium`, `small`, `large`,默认值为 `medium`。\n\n**插槽:**\n- `start`: 开始插槽\n- `end`: 结束插槽\n- `dropdown`: 下拉插槽",
"attributes": [
{
"name": "size",
"description": "按钮大小,可选值为 `medium`, `small`, `large`,默认值为 `medium`。",
"values": [
{
"name": "medium",
"description": "默认值。中等大小"
},
{
"name": "small",
"description": "大小较小"
},
{
"name": "large",
"description": "大小较大"
}
]
}
],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/search"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/search.ts"
}
]
},
{
"name": "s-carousel",
"description": "**轮播图 Carousel**\n\n轮播组件用于展示一组内容,并可以自动轮播。可以通过设置持续时长来自定义每张幻灯片显示的时间。\n\n```html\n<s-carousel>\n <div style=\"background: #936d6d\"></div>\n <div style=\"background: #6d936f\"></div>\n <div style=\"background: #856d93\"></div>\n</s-carousel>\n```\n\n**属性:**\n\n- `duration` (`number`): 每张幻灯片显示的持续时长,单位为毫秒,默认值为 `4000`。\n\n**插槽:**\n- 无特定插槽。",
"attributes": [
{
"name": "duration",
"description": "每张幻灯片显示的持续时长,单位为毫秒,默认值为 `4000`。"
}
],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/carousel"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/carousel.ts"
}
]
},
{
"name": "s-tab",
"description": "**选项卡 Tab**\n\n选项卡组件用于在同一个区域内切换不同的内容。支持徽章、左右对齐以及固定模式。\n\n```html\n<s-tab>\n <s-tab-item>\n <div slot=\"text\">Item 1</div>\n </s-tab-item>\n <s-tab-item selected=\"true\">\n <div slot=\"text\">Item 2</div>\n </s-tab-item>\n <s-tab-item>\n <div slot=\"text\">Item 3</div>\n </s-tab-item>\n</s-tab>\n```\n\n**属性:**\n\n- `mode` (`string`): 设置固定模式,使 item 均分占据宽度,不再支持滚动。\n\n**事件:**\n- `change`: 选中变化后触发。",
"attributes": [
{
"name": "mode",
"description": "设置固定模式,使 item 均分占据宽度,不再支持滚动。",
"values": [
{
"name": "scrollable",
"description": "可滚动模式"
},
{
"name": "fixed",
"description": "固定模式"
}
]
}
],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/tab"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/tab.ts"
}
]
},
{
"name": "s-tab-item",
"description": "**选项卡项目 Tab Item**\n\n选项卡项组件,作为 `s-tab` 组件的子组件。\n\n**属性:**\n\n- `selected` (`boolean`): 是否选中,默认值为 `false`。\n\n**插槽:**\n- `icon`: 图标\n- `text`: 文本\n- `badge`: 徽章",
"attributes": [
{
"name": "selected",
"description": "是否选中,默认值为 `false`。",
"valueSet": "boolean"
}
],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/tab-item"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/tab.ts"
}
]
},
{
"name": "s-navigation",
"description": "**导航栏 Navigation**\n\n导航组件用于在应用中进行页面切换或执行其他操作。支持图标、文本、徽章插槽,以及导轨模式。\n\n```html\n<s-navigation>\n <s-navigation-item selected=\"true\">\n <s-icon type=\"add\" slot=\"icon\"></s-icon>\n <div slot=\"text\">Item 1</div>\n <s-badge slot=\"badge\"></s-badge>\n </s-navigation-item>\n <s-navigation-item>\n <s-icon type=\"search\" slot=\"icon\"></s-icon>\n <div slot=\"text\">Item 2</div>\n </s-navigation-item>\n <s-navigation-item>\n <s-icon type=\"dark_mode\" slot=\"icon\"></s-icon>\n <div slot=\"text\">Item 3</div>\n <s-badge slot=\"badge\">99</s-badge>\n </s-navigation-item>\n</s-navigation>\n\n<s-navigation mode=\"rail\">\n <s-navigation-item selected=\"true\">\n <s-icon type=\"add\" slot=\"icon\"></s-icon>\n <div slot=\"text\">Item 1</div>\n </s-navigation-item>\n <s-navigation-item>\n <s-icon type=\"search\" slot=\"icon\"></s-icon>\n <div slot=\"text\">Item 2</div>\n </s-navigation-item>\n <s-navigation-item>\n <s-icon type=\"dark_mode\" slot=\"icon\"></s-icon>\n <div slot=\"text\">Item 3</div>\n </s-navigation-item>\n</s-navigation>\n```\n\n**属性:**\n\n- `mode` (`string`): 设置导轨模式,支持 `bottom` 和 `rail`。\n- `value` (`string`): 选中值,默认值为 `null`。\n- `options` _[只读]_ (`Item[]`): 子项目数组,默认值为 `[]`。\n- `selectedIndex` _[只读]_ (`number`): 当前选中下标,默认值为 `-1`。\n\n**事件:**\n\n- `change`: 选中变化后触发。\n\n**插槽:**\n\n- `start`: 开始插槽\n- `end`: 结束插槽",
"attributes": [
{
"name": "mode",
"description": "设置导轨模式。",
"values": [
{
"name": "bottom",
"description": "底栏模式"
},
{
"name": "rail",
"description": "导轨模式"
}
]
},
{
"name": "value",
"description": "选中值"
}
],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/navigation"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/navigation.ts"
}
]
},
{
"name": "s-navigation-item",
"description": "**导航栏子项 Navigation Item**\n\n导航项组件,作为 `s-navigation` 组件的子组件。\n\n**属性:**\n\n- `selected` (`boolean`): 是否选中,默认值为 `false`。\n- `value` (`string`): 选中项的值。\n\n**插槽:**\n\n- `icon`: 图标\n- `text`: 文本\n- `badge`: 徽章\n\n**事件:**\n\n- `click`: 点击后触发。",
"attributes": [
{
"name": "selected",
"description": "是否选中,默认值为 `false`。",
"valueSet": "boolean"
},
{
"name": "value",
"description": "选中项的值。",
"valueSet": "string"
}
],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/navigation"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/navigation-item.ts"
}
]
},
{
"name": "s-appbar",
"description": "**应用栏 Appbar**\n\nAppbar 的表现更像一个容器,它没有事件和行为。\n\n在屏幕宽度小于 **840px** 时,它的高度会变为 **56px**。\n\n支持导航、标题和操作按钮的插槽。\n\n你可以嵌套该组件,内部的 Appbar 会居中并且设置一个最大宽度,默认为 **1280px**。\n\n```html\n<s-appbar>\n <!--左侧菜单按钮-->\n <s-icon-button slot=\"navigation\">\n <s-icon type=\"menu\"></s-icon>\n </s-icon-button>\n <!--标题-->\n <div slot=\"headline\"> Title </div>\n <!--右侧操作按钮-->\n <s-icon-button slot=\"action\">\n <s-icon type=\"search\"></s-icon>\n </s-icon-button>\n</s-appbar>\n```\n\n**插槽:**\n- `navigation`: 导航\n- `headline`: 标题\n- `action`: 操作",
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/appbar"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/appbar.ts"
}
]
},
{
"name": "s-dialog",
"description": "**对话框 Dialog**\n\nDialog 对话框组件用于显示重要信息或提示。\n\n```html\n<s-dialog>\n <s-button slot=\"trigger\"> dialog </s-button>\n <div slot=\"headline\"> Title </div>\n <div slot=\"text\">问人生、头白京国,算来何事消得。不如罨画清溪上,蓑笠扁舟一只。人不识,且笑煮、鲈鱼趁著莼丝碧。无端酸鼻,向岐路消魂,征轮驿骑,断雁西风急。英雄辈,事业东西南北。临风因甚泣。酬知有愿频挥手,零雨凄其此日。休太息,须信道、诸公衮衮皆虚掷。年来踪迹。有多少雄心,几翻恶梦,泪点霜华织。</div>\n <s-button slot=\"action\" type=\"text\">取消</s-button>\n <s-button slot=\"action\" type=\"text\">确定</s-button>\n</s-dialog>\n```\n\n**属性:**\n\n- `size` (`string`): 对话框尺寸,可选值为 `basic` (普通), `full` (全屏)\n\n**事件:**\n\n- `show`: 对话框开始显示时触发\n- `showed`: 对话框显示后触发(动画结束)\n- `dismiss`: 对话框开始隐藏时触发\n- `dismissed`: 对话框隐藏后触发(动画结束)\n\n**插槽:**\n- `trigger`: 触发器\n- `headline`: 标题\n- `text`: 文本内容\n- `action`: 操作按钮",
"attributes": [
{
"name": "size",
"description": "对话框尺寸,可选值为 `basic` (普通), `full` (全屏)",
"values": [
{
"name": "basic",
"description": "普通"
},
{
"name": "full",
"description": "全屏"
}
]
}
],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/dialog"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/dialog.ts"
}
]
},
{
"name": "s-popup",
"description": "**弹出框 Popup**\n\nPopup 弹出框组件用于展示临时内容或提示信息。支持通过不同方式触发,并且可以设置默认位置。\n\n```html\n<s-popup>\n <s-button slot=\"trigger\"> popup </s-button>\n <div style=\"min-height: 280px\">\n 弹出框\n </div>\n</s-popup>\n\n<s-popup showalign=\"right\">\n <s-button slot=\"trigger\"> popup </s-button>\n <div style=\"min-height: 280px\">\n 弹出框\n </div>\n</s-popup>\n```\n\n**属性:**\n\n- `showAlign` (`string`): 设置弹出框的默认位置,可选值为 `center`, `left`, `right`。\n\n**插槽:**\n- `trigger`: 触发器",
"attributes": [
{
"name": "showAlign",
"description": "设置弹出框的默认位置,可选值为 `center`, `left`, `right`",
"values": [
{
"name": "center",
"description": "居中"
},
{
"name": "left",
"description": "居左"
},
{
"name": "right",
"description": "居右"
}
]
}
],
"references": [
{
"name": "文档",
"url": "https://soberjs.com/component/popup"
},
{
"name": "源代码",
"url": "https://github.com/apprat/sober/blob/main/src/popup.ts"
}
]
},
{
"name": "s-popup-menu",