Player card(选手卡片)
球员资料卡突出球员姓名和位置,下面排列四项比赛数据。
loading
安装
bash
npm install @assistant-ui/generative-ui zod1
用法
将下方规格传给渲染器。此规格包含完整的展示数据,渲染时使用已完成状态。
tsx
import { defaultGenerativeUILibrary, renderGenerativeUI } from "@assistant-ui/generative-ui/react";
renderGenerativeUI(spec, defaultGenerativeUILibrary, { status: "done" });1
2
3
2
3
规格
tsx
const spec = {
"$type": "Card",
"children": [
{
"$type": "Header",
"$key": "name",
"text": "陈马库斯",
"size": "lg"
},
{
"$type": "Caption",
"$key": "position",
"value": "控球后卫 · 23 号"
},
{
"$type": "Row",
"$key": "stats",
"justify": "between",
"children": [
{
"$type": "Col",
"$key": "pts",
"align": "center",
"gap": 1,
"children": [
{
"$type": "Text",
"$key": "value",
"value": "24.6",
"size": "2xl",
"weight": "bold"
},
{
"$type": "Caption",
"$key": "label",
"value": "场均得分"
}
]
},
{
"$type": "Col",
"$key": "ast",
"align": "center",
"gap": 1,
"children": [
{
"$type": "Text",
"$key": "value",
"value": "8.1",
"size": "2xl",
"weight": "bold"
},
{
"$type": "Caption",
"$key": "label",
"value": "助攻"
}
]
},
{
"$type": "Col",
"$key": "reb",
"align": "center",
"gap": 1,
"children": [
{
"$type": "Text",
"$key": "value",
"value": "5.3",
"size": "2xl",
"weight": "bold"
},
{
"$type": "Caption",
"$key": "label",
"value": "篮板"
}
]
},
{
"$type": "Col",
"$key": "eff",
"align": "center",
"gap": 1,
"children": [
{
"$type": "Text",
"$key": "value",
"value": "27.9",
"size": "2xl",
"weight": "bold"
},
{
"$type": "Caption",
"$key": "label",
"value": "效率值"
}
]
}
]
}
]
}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
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