@fragments-sdk/ui 0.17.1 → 0.18.0
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/fragments.json +1 -1
- package/package.json +3 -3
- package/src/components/Accordion/Accordion.contract.json +169 -0
- package/src/components/Alert/Alert.contract.json +157 -0
- package/src/components/AppShell/AppShell.contract.json +155 -0
- package/src/components/Avatar/Avatar.contract.json +189 -0
- package/src/components/Badge/Badge.contract.json +187 -0
- package/src/components/BentoGrid/BentoGrid.contract.json +135 -0
- package/src/components/Box/Box.contract.json +423 -0
- package/src/components/Breadcrumbs/Breadcrumbs.contract.json +143 -0
- package/src/components/Button/Button.contract.json +205 -0
- package/src/components/ButtonGroup/ButtonGroup.contract.json +140 -0
- package/src/components/Card/Card.contract.json +185 -0
- package/src/components/Chart/Chart.contract.json +129 -0
- package/src/components/Checkbox/Checkbox.contract.json +246 -0
- package/src/components/Chip/Chip.contract.json +212 -0
- package/src/components/CodeBlock/CodeBlock.contract.json +388 -0
- package/src/components/Collapsible/Collapsible.contract.json +154 -0
- package/src/components/ColorPicker/ColorPicker.contract.json +212 -0
- package/src/components/Combobox/Combobox.contract.json +297 -0
- package/src/components/Command/Command.contract.json +165 -0
- package/src/components/ConversationList/ConversationList.contract.json +151 -0
- package/src/components/DataTable/DataTable.contract.json +302 -0
- package/src/components/DatePicker/DatePicker.contract.json +288 -0
- package/src/components/Dialog/Dialog.contract.json +159 -0
- package/src/components/Drawer/Drawer.contract.json +160 -0
- package/src/components/Editor/Editor.contract.json +263 -0
- package/src/components/EmptyState/EmptyState.contract.json +133 -0
- package/src/components/Field/Field.contract.json +157 -0
- package/src/components/Fieldset/Fieldset.contract.json +117 -0
- package/src/components/Form/Form.contract.json +145 -0
- package/src/components/Grid/Grid.contract.json +195 -0
- package/src/components/Header/Header.contract.json +194 -0
- package/src/components/Icon/Icon.contract.json +194 -0
- package/src/components/Image/Image.contract.json +209 -0
- package/src/components/Input/Input.contract.json +344 -0
- package/src/components/Link/Link.contract.json +180 -0
- package/src/components/List/List.contract.json +154 -0
- package/src/components/Listbox/Listbox.contract.json +158 -0
- package/src/components/Loading/Loading.contract.json +167 -0
- package/src/components/Markdown/Markdown.contract.json +127 -0
- package/src/components/Menu/Menu.contract.json +177 -0
- package/src/components/Message/Message.contract.json +183 -0
- package/src/components/NavigationMenu/NavigationMenu.contract.json +203 -0
- package/src/components/Pagination/Pagination.contract.json +163 -0
- package/src/components/Popover/Popover.contract.json +163 -0
- package/src/components/Progress/Progress.contract.json +176 -0
- package/src/components/Prompt/Prompt.contract.json +211 -0
- package/src/components/RadioGroup/RadioGroup.contract.json +226 -0
- package/src/components/ScrollArea/ScrollArea.contract.json +131 -0
- package/src/components/Select/Select.contract.json +269 -0
- package/src/components/Separator/Separator.contract.json +143 -0
- package/src/components/Sidebar/Sidebar.contract.json +258 -0
- package/src/components/Skeleton/Skeleton.contract.json +166 -0
- package/src/components/Slider/Slider.contract.json +248 -0
- package/src/components/Stack/Stack.contract.json +220 -0
- package/src/components/Table/Table.contract.json +171 -0
- package/src/components/TableOfContents/TableOfContents.contract.json +145 -0
- package/src/components/Tabs/Tabs.contract.json +159 -0
- package/src/components/Text/Text.contract.json +239 -0
- package/src/components/Textarea/Textarea.contract.json +308 -0
- package/src/components/Theme/Theme.contract.json +152 -0
- package/src/components/ThinkingIndicator/ThinkingIndicator.contract.json +165 -0
- package/src/components/Toast/Toast.contract.json +181 -0
- package/src/components/Toggle/Toggle.contract.json +231 -0
- package/src/components/ToggleGroup/ToggleGroup.contract.json +206 -0
- package/src/components/Tooltip/Tooltip.contract.json +214 -0
- package/src/components/VisuallyHidden/VisuallyHidden.contract.json +116 -0
- package/src/tokens/_derive.scss +4 -1
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://usefragments.com/schemas/contract.v1.json",
|
|
3
|
+
"name": "Popover",
|
|
4
|
+
"description": "Rich content overlay anchored to a trigger element. Use for forms, detailed information, or interactive content that should stay in context.",
|
|
5
|
+
"category": "feedback",
|
|
6
|
+
"tags": [
|
|
7
|
+
"popover",
|
|
8
|
+
"overlay",
|
|
9
|
+
"dropdown",
|
|
10
|
+
"floating",
|
|
11
|
+
"contextual"
|
|
12
|
+
],
|
|
13
|
+
"status": "stable",
|
|
14
|
+
"sourcePath": "src/components/Popover/index.tsx",
|
|
15
|
+
"exportName": "Popover",
|
|
16
|
+
"propsSummary": [
|
|
17
|
+
"children: node (required)",
|
|
18
|
+
"open: boolean",
|
|
19
|
+
"defaultOpen: boolean",
|
|
20
|
+
"onOpenChange: function",
|
|
21
|
+
"modal: boolean (default: false)"
|
|
22
|
+
],
|
|
23
|
+
"props": {
|
|
24
|
+
"children": {
|
|
25
|
+
"type": "node",
|
|
26
|
+
"description": "Popover trigger and content",
|
|
27
|
+
"required": true
|
|
28
|
+
},
|
|
29
|
+
"open": {
|
|
30
|
+
"type": "boolean",
|
|
31
|
+
"description": "Controlled open state",
|
|
32
|
+
"required": false
|
|
33
|
+
},
|
|
34
|
+
"defaultOpen": {
|
|
35
|
+
"type": "boolean",
|
|
36
|
+
"description": "Default open state (uncontrolled)",
|
|
37
|
+
"default": "false",
|
|
38
|
+
"required": false
|
|
39
|
+
},
|
|
40
|
+
"onOpenChange": {
|
|
41
|
+
"type": "function",
|
|
42
|
+
"description": "Called when open state changes",
|
|
43
|
+
"required": false
|
|
44
|
+
},
|
|
45
|
+
"modal": {
|
|
46
|
+
"type": "boolean",
|
|
47
|
+
"description": "Whether to block page interaction",
|
|
48
|
+
"default": "false",
|
|
49
|
+
"required": false
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"usage": {
|
|
53
|
+
"when": [
|
|
54
|
+
"Inline editing forms",
|
|
55
|
+
"Rich preview content",
|
|
56
|
+
"Filter panels",
|
|
57
|
+
"Date/color pickers",
|
|
58
|
+
"Content that needs more space than a tooltip"
|
|
59
|
+
],
|
|
60
|
+
"whenNot": [
|
|
61
|
+
"Simple hints (use Tooltip)",
|
|
62
|
+
"Action lists (use Menu)",
|
|
63
|
+
"Blocking user interaction (use Dialog)",
|
|
64
|
+
"System notifications (use Toast or Alert)"
|
|
65
|
+
],
|
|
66
|
+
"guidelines": [
|
|
67
|
+
"Keep popover content focused and minimal",
|
|
68
|
+
"Include a clear way to close (X button or action buttons)",
|
|
69
|
+
"Position to avoid covering important content",
|
|
70
|
+
"Use arrow to visually connect popover to trigger",
|
|
71
|
+
"Popover.Trigger and Popover.Close support asChild for links/router-link components (single valid element child required)"
|
|
72
|
+
],
|
|
73
|
+
"accessibility": [
|
|
74
|
+
"Focus is moved to popover content on open",
|
|
75
|
+
"Closes on Escape key",
|
|
76
|
+
"Focus returns to trigger on close"
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
"examples": [
|
|
80
|
+
{
|
|
81
|
+
"name": "Default",
|
|
82
|
+
"description": "Basic popover with content",
|
|
83
|
+
"code": "<Popover>\n <Popover.Trigger asChild>\n <Button variant=\"secondary\">Open Popover</Button>\n </Popover.Trigger>\n <Popover.Content>\n <Popover.Close />\n <Popover.Title>Popover Title</Popover.Title>\n <Popover.Description>\n This is a popover with some content. It can contain text, forms, or other elements.\n </Popover.Description>\n </Popover.Content>\n</Popover>"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"name": "With Form",
|
|
87
|
+
"description": "Popover containing a form",
|
|
88
|
+
"code": "<Popover>\n <Popover.Trigger asChild>\n <Button variant=\"secondary\">Edit Name</Button>\n </Popover.Trigger>\n <Popover.Content size=\"sm\">\n <Popover.Close />\n <Popover.Title>Edit Name</Popover.Title>\n <Popover.Body>\n <Input label=\"Display Name\" placeholder=\"Enter name\" />\n </Popover.Body>\n <Popover.Footer>\n <Popover.Close asChild>\n <Button variant=\"secondary\" size=\"sm\">Cancel</Button>\n </Popover.Close>\n <Button variant=\"primary\" size=\"sm\">Save</Button>\n </Popover.Footer>\n </Popover.Content>\n</Popover>"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"name": "With Arrow",
|
|
92
|
+
"description": "Popover with pointing arrow",
|
|
93
|
+
"code": "<Popover>\n <Popover.Trigger asChild>\n <Button variant=\"secondary\">Info</Button>\n </Popover.Trigger>\n <Popover.Content arrow>\n <Popover.Title>Quick Tip</Popover.Title>\n <Popover.Description>\n This popover has an arrow pointing to its trigger element.\n </Popover.Description>\n </Popover.Content>\n</Popover>"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"name": "Positions",
|
|
97
|
+
"description": "Popover on different sides",
|
|
98
|
+
"code": "<div style={{ display: 'flex', gap: '16px', padding: '60px' }}>\n <Popover>\n <Popover.Trigger asChild>\n <Button variant=\"secondary\">Top</Button>\n </Popover.Trigger>\n <Popover.Content side=\"top\" size=\"sm\">\n <Popover.Description>Popover on top</Popover.Description>\n </Popover.Content>\n </Popover>\n <Popover>\n <Popover.Trigger asChild>\n <Button variant=\"secondary\">Bottom</Button>\n </Popover.Trigger>\n <Popover.Content side=\"bottom\" size=\"sm\">\n <Popover.Description>Popover on bottom</Popover.Description>\n </Popover.Content>\n </Popover>\n</div>"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"name": "Link Trigger",
|
|
102
|
+
"description": "Use asChild with a non-button trigger element",
|
|
103
|
+
"code": "<Popover>\n <Popover.Trigger asChild>\n <a href=\"#popover-help\">Open help</a>\n </Popover.Trigger>\n <Popover.Content size=\"sm\">\n <Popover.Description>Popover trigger can be an anchor when using asChild.</Popover.Description>\n </Popover.Content>\n</Popover>"
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
"relations": [
|
|
107
|
+
{
|
|
108
|
+
"component": "Tooltip",
|
|
109
|
+
"relationship": "alternative",
|
|
110
|
+
"note": "Use Tooltip for brief, non-interactive hints"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"component": "Menu",
|
|
114
|
+
"relationship": "alternative",
|
|
115
|
+
"note": "Use Menu for action lists"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"component": "Dialog",
|
|
119
|
+
"relationship": "alternative",
|
|
120
|
+
"note": "Use Dialog for blocking interactions"
|
|
121
|
+
}
|
|
122
|
+
],
|
|
123
|
+
"contract": {
|
|
124
|
+
"propsSummary": [
|
|
125
|
+
"open: boolean - controlled open state",
|
|
126
|
+
"onOpenChange: (open) => void - state handler",
|
|
127
|
+
"modal: boolean - blocks page interaction (default: false)",
|
|
128
|
+
"Popover.Trigger / Popover.Close asChild support non-button children",
|
|
129
|
+
"Popover.Content side: top|bottom|left|right - position"
|
|
130
|
+
],
|
|
131
|
+
"a11yRules": [
|
|
132
|
+
"A11Y_POPOVER_FOCUS",
|
|
133
|
+
"A11Y_POPOVER_ESCAPE",
|
|
134
|
+
"A11Y_TARGET_SIZE_MIN"
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
"ai": {
|
|
138
|
+
"compositionPattern": "compound",
|
|
139
|
+
"subComponents": [
|
|
140
|
+
"Trigger",
|
|
141
|
+
"Content",
|
|
142
|
+
"Close",
|
|
143
|
+
"Title",
|
|
144
|
+
"Description",
|
|
145
|
+
"Body",
|
|
146
|
+
"Footer"
|
|
147
|
+
],
|
|
148
|
+
"requiredChildren": [
|
|
149
|
+
"Trigger",
|
|
150
|
+
"Content"
|
|
151
|
+
],
|
|
152
|
+
"commonPatterns": [
|
|
153
|
+
"<Popover><Popover.Trigger asChild><Button>Open</Button></Popover.Trigger><Popover.Content><Popover.Close /><Popover.Title>{title}</Popover.Title><Popover.Description>{description}</Popover.Description></Popover.Content></Popover>",
|
|
154
|
+
"<Popover><Popover.Trigger asChild><a href=\"#help\">Open help</a></Popover.Trigger><Popover.Content>...</Popover.Content></Popover>"
|
|
155
|
+
]
|
|
156
|
+
},
|
|
157
|
+
"provenance": {
|
|
158
|
+
"source": "migrated",
|
|
159
|
+
"verified": false,
|
|
160
|
+
"frameworkSupport": "native",
|
|
161
|
+
"extractedAt": "2026-03-13T23:19:02.154Z"
|
|
162
|
+
}
|
|
163
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://usefragments.com/schemas/contract.v1.json",
|
|
3
|
+
"name": "Progress",
|
|
4
|
+
"description": "Visual indicator of task completion or loading state. Available in linear and circular variants.",
|
|
5
|
+
"category": "feedback",
|
|
6
|
+
"tags": [
|
|
7
|
+
"progress",
|
|
8
|
+
"loading",
|
|
9
|
+
"indicator",
|
|
10
|
+
"percentage",
|
|
11
|
+
"status"
|
|
12
|
+
],
|
|
13
|
+
"status": "stable",
|
|
14
|
+
"sourcePath": "src/components/Progress/index.tsx",
|
|
15
|
+
"exportName": "Progress",
|
|
16
|
+
"propsSummary": [
|
|
17
|
+
"value: number (default: null)",
|
|
18
|
+
"min: number (default: 0)",
|
|
19
|
+
"max: number (default: 100)",
|
|
20
|
+
"size: sm|md|lg (default: md)",
|
|
21
|
+
"variant: default|success|warning|danger (default: default)",
|
|
22
|
+
"label: string",
|
|
23
|
+
"showValue: boolean (default: false)",
|
|
24
|
+
"formatValue: function"
|
|
25
|
+
],
|
|
26
|
+
"props": {
|
|
27
|
+
"value": {
|
|
28
|
+
"type": "number",
|
|
29
|
+
"description": "Current progress value (0-100). Null for indeterminate.",
|
|
30
|
+
"default": "null",
|
|
31
|
+
"required": false
|
|
32
|
+
},
|
|
33
|
+
"min": {
|
|
34
|
+
"type": "number",
|
|
35
|
+
"description": "Minimum value",
|
|
36
|
+
"default": "0",
|
|
37
|
+
"required": false
|
|
38
|
+
},
|
|
39
|
+
"max": {
|
|
40
|
+
"type": "number",
|
|
41
|
+
"description": "Maximum value",
|
|
42
|
+
"default": "100",
|
|
43
|
+
"required": false
|
|
44
|
+
},
|
|
45
|
+
"size": {
|
|
46
|
+
"type": "enum",
|
|
47
|
+
"description": "Size of the progress bar",
|
|
48
|
+
"default": "md",
|
|
49
|
+
"required": false,
|
|
50
|
+
"values": [
|
|
51
|
+
"sm",
|
|
52
|
+
"md",
|
|
53
|
+
"lg"
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
"variant": {
|
|
57
|
+
"type": "enum",
|
|
58
|
+
"description": "Color variant",
|
|
59
|
+
"default": "default",
|
|
60
|
+
"required": false,
|
|
61
|
+
"values": [
|
|
62
|
+
"default",
|
|
63
|
+
"success",
|
|
64
|
+
"warning",
|
|
65
|
+
"danger"
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
"label": {
|
|
69
|
+
"type": "string",
|
|
70
|
+
"description": "Label text above the progress bar",
|
|
71
|
+
"required": false
|
|
72
|
+
},
|
|
73
|
+
"showValue": {
|
|
74
|
+
"type": "boolean",
|
|
75
|
+
"description": "Show percentage value",
|
|
76
|
+
"default": "false",
|
|
77
|
+
"required": false
|
|
78
|
+
},
|
|
79
|
+
"formatValue": {
|
|
80
|
+
"type": "function",
|
|
81
|
+
"description": "Custom formatter for displayed progress value",
|
|
82
|
+
"required": false
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"usage": {
|
|
86
|
+
"when": [
|
|
87
|
+
"Showing upload/download progress",
|
|
88
|
+
"Displaying task completion percentage",
|
|
89
|
+
"Form completion indicators",
|
|
90
|
+
"Loading states with known duration"
|
|
91
|
+
],
|
|
92
|
+
"whenNot": [
|
|
93
|
+
"Unknown loading duration (use Spinner)",
|
|
94
|
+
"Step-based progress (use Stepper)",
|
|
95
|
+
"Status without percentage (use Badge)"
|
|
96
|
+
],
|
|
97
|
+
"guidelines": [
|
|
98
|
+
"Use determinate progress when you know the completion percentage",
|
|
99
|
+
"Use indeterminate for unknown durations",
|
|
100
|
+
"Include a label for context when the purpose isnt obvious",
|
|
101
|
+
"Use appropriate color variants for success/warning/danger states",
|
|
102
|
+
"Determinate values are clamped to the min/max range for display"
|
|
103
|
+
],
|
|
104
|
+
"accessibility": [
|
|
105
|
+
"Uses role=\"progressbar\" with aria-valuenow",
|
|
106
|
+
"Label is associated with the progress bar",
|
|
107
|
+
"State changes are announced to screen readers"
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
"examples": [
|
|
111
|
+
{
|
|
112
|
+
"name": "Default",
|
|
113
|
+
"description": "Basic progress bar with percentage",
|
|
114
|
+
"code": "<Progress value={60} label=\"Uploading...\" showValue />"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"name": "Variants",
|
|
118
|
+
"description": "Different color variants for different states",
|
|
119
|
+
"code": "<div style={{ display: 'flex', flexDirection: 'column', gap: '16px', width: '300px' }}>\n <Progress value={75} variant=\"default\" label=\"Processing\" showValue />\n <Progress value={100} variant=\"success\" label=\"Complete\" showValue />\n <Progress value={80} variant=\"warning\" label=\"Almost full\" showValue />\n <Progress value={95} variant=\"danger\" label=\"Storage critical\" showValue />\n</div>"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"name": "Sizes",
|
|
123
|
+
"description": "Different progress bar sizes",
|
|
124
|
+
"code": "<div style={{ display: 'flex', flexDirection: 'column', gap: '16px', width: '300px' }}>\n <Progress value={50} size=\"sm\" label=\"Small\" />\n <Progress value={50} size=\"md\" label=\"Medium\" />\n <Progress value={50} size=\"lg\" label=\"Large\" />\n</div>"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"name": "Indeterminate",
|
|
128
|
+
"description": "Loading state with unknown duration",
|
|
129
|
+
"code": "<Progress value={null} label=\"Loading...\" />"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"name": "Circular",
|
|
133
|
+
"description": "Circular progress indicator",
|
|
134
|
+
"code": "<div style={{ display: 'flex', gap: '24px', alignItems: 'center' }}>\n <CircularProgress value={25} size=\"sm\" />\n <CircularProgress value={50} size=\"md\" showValue />\n <CircularProgress value={75} size=\"lg\" showValue variant=\"success\" />\n <CircularProgress value={null} size=\"md\" />\n</div>"
|
|
135
|
+
}
|
|
136
|
+
],
|
|
137
|
+
"relations": [
|
|
138
|
+
{
|
|
139
|
+
"component": "Badge",
|
|
140
|
+
"relationship": "alternative",
|
|
141
|
+
"note": "Use Badge for status without percentage"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"component": "Alert",
|
|
145
|
+
"relationship": "sibling",
|
|
146
|
+
"note": "Use Alert for completion messages"
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
"contract": {
|
|
150
|
+
"propsSummary": [
|
|
151
|
+
"value: number|null - progress percentage (null for indeterminate)",
|
|
152
|
+
"size: sm|md|lg - bar thickness",
|
|
153
|
+
"variant: default|success|warning|danger - color",
|
|
154
|
+
"label: string - descriptive label",
|
|
155
|
+
"showValue: boolean - display percentage",
|
|
156
|
+
"Determinate display values are clamped (and invalid min/max ranges render as 0%)"
|
|
157
|
+
],
|
|
158
|
+
"a11yRules": [
|
|
159
|
+
"A11Y_PROGRESS_ROLE",
|
|
160
|
+
"A11Y_PROGRESS_VALUE"
|
|
161
|
+
]
|
|
162
|
+
},
|
|
163
|
+
"ai": {
|
|
164
|
+
"compositionPattern": "compound",
|
|
165
|
+
"subComponents": [
|
|
166
|
+
"Root",
|
|
167
|
+
"Circular"
|
|
168
|
+
]
|
|
169
|
+
},
|
|
170
|
+
"provenance": {
|
|
171
|
+
"source": "migrated",
|
|
172
|
+
"verified": false,
|
|
173
|
+
"frameworkSupport": "native",
|
|
174
|
+
"extractedAt": "2026-03-13T23:19:02.339Z"
|
|
175
|
+
}
|
|
176
|
+
}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://usefragments.com/schemas/contract.v1.json",
|
|
3
|
+
"name": "Prompt",
|
|
4
|
+
"description": "Multi-line input with toolbar for AI/chat interfaces",
|
|
5
|
+
"category": "ai",
|
|
6
|
+
"tags": [
|
|
7
|
+
"prompt",
|
|
8
|
+
"chat",
|
|
9
|
+
"ai",
|
|
10
|
+
"input",
|
|
11
|
+
"textarea",
|
|
12
|
+
"form"
|
|
13
|
+
],
|
|
14
|
+
"status": "stable",
|
|
15
|
+
"sourcePath": "src/components/Prompt/index.tsx",
|
|
16
|
+
"exportName": "Prompt",
|
|
17
|
+
"propsSummary": [
|
|
18
|
+
"children: node (required)",
|
|
19
|
+
"value: string",
|
|
20
|
+
"defaultValue: string (default: )",
|
|
21
|
+
"onChange: function",
|
|
22
|
+
"onSubmit: function",
|
|
23
|
+
"placeholder: string (default: Ask, Search or Chat...)",
|
|
24
|
+
"disabled: boolean (default: false)",
|
|
25
|
+
"loading: boolean (default: false)",
|
|
26
|
+
"minRows: number (default: 1)",
|
|
27
|
+
"maxRows: number (default: 8)",
|
|
28
|
+
"autoResize: boolean (default: true)",
|
|
29
|
+
"submitOnEnter: boolean (default: true)",
|
|
30
|
+
"variant: default|fixed|sticky (default: default)"
|
|
31
|
+
],
|
|
32
|
+
"props": {
|
|
33
|
+
"children": {
|
|
34
|
+
"type": "node",
|
|
35
|
+
"description": "Prompt composition using Prompt sub-components",
|
|
36
|
+
"required": true
|
|
37
|
+
},
|
|
38
|
+
"value": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"description": "Controlled input value",
|
|
41
|
+
"required": false
|
|
42
|
+
},
|
|
43
|
+
"defaultValue": {
|
|
44
|
+
"type": "string",
|
|
45
|
+
"description": "Uncontrolled default value",
|
|
46
|
+
"default": "",
|
|
47
|
+
"required": false
|
|
48
|
+
},
|
|
49
|
+
"onChange": {
|
|
50
|
+
"type": "function",
|
|
51
|
+
"description": "Called when value changes",
|
|
52
|
+
"required": false
|
|
53
|
+
},
|
|
54
|
+
"onSubmit": {
|
|
55
|
+
"type": "function",
|
|
56
|
+
"description": "Called on form submission",
|
|
57
|
+
"required": false
|
|
58
|
+
},
|
|
59
|
+
"placeholder": {
|
|
60
|
+
"type": "string",
|
|
61
|
+
"description": "Placeholder text for the textarea",
|
|
62
|
+
"default": "Ask, Search or Chat...",
|
|
63
|
+
"required": false
|
|
64
|
+
},
|
|
65
|
+
"disabled": {
|
|
66
|
+
"type": "boolean",
|
|
67
|
+
"description": "Disable the entire prompt",
|
|
68
|
+
"default": "false",
|
|
69
|
+
"required": false
|
|
70
|
+
},
|
|
71
|
+
"loading": {
|
|
72
|
+
"type": "boolean",
|
|
73
|
+
"description": "Show loading state",
|
|
74
|
+
"default": "false",
|
|
75
|
+
"required": false
|
|
76
|
+
},
|
|
77
|
+
"minRows": {
|
|
78
|
+
"type": "number",
|
|
79
|
+
"description": "Minimum number of visible rows",
|
|
80
|
+
"default": "1",
|
|
81
|
+
"required": false
|
|
82
|
+
},
|
|
83
|
+
"maxRows": {
|
|
84
|
+
"type": "number",
|
|
85
|
+
"description": "Maximum number of visible rows",
|
|
86
|
+
"default": "8",
|
|
87
|
+
"required": false
|
|
88
|
+
},
|
|
89
|
+
"autoResize": {
|
|
90
|
+
"type": "boolean",
|
|
91
|
+
"description": "Enable auto-resize based on content",
|
|
92
|
+
"default": "true",
|
|
93
|
+
"required": false
|
|
94
|
+
},
|
|
95
|
+
"submitOnEnter": {
|
|
96
|
+
"type": "boolean",
|
|
97
|
+
"description": "Submit on Enter (Shift+Enter for newline)",
|
|
98
|
+
"default": "true",
|
|
99
|
+
"required": false
|
|
100
|
+
},
|
|
101
|
+
"variant": {
|
|
102
|
+
"type": "enum",
|
|
103
|
+
"description": "Visual/positioning variant",
|
|
104
|
+
"default": "default",
|
|
105
|
+
"required": false,
|
|
106
|
+
"values": [
|
|
107
|
+
"default",
|
|
108
|
+
"fixed",
|
|
109
|
+
"sticky"
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"usage": {
|
|
114
|
+
"when": [
|
|
115
|
+
"Building chat or AI assistant interfaces",
|
|
116
|
+
"Need multi-line input with submit action",
|
|
117
|
+
"Require toolbar with actions like attachments or model selection"
|
|
118
|
+
],
|
|
119
|
+
"whenNot": [
|
|
120
|
+
"Simple single-line text input (use Input)",
|
|
121
|
+
"Basic multi-line without toolbar (use Textarea)",
|
|
122
|
+
"Search-only interface (use Input with search variant)"
|
|
123
|
+
],
|
|
124
|
+
"guidelines": [
|
|
125
|
+
"Always provide an onSubmit handler",
|
|
126
|
+
"Use loading state during API calls",
|
|
127
|
+
"Prompt.Textarea forwards native textarea props (autoComplete, inputMode, aria-*, data-*, handlers)",
|
|
128
|
+
"Prompt.Textarea composes your onChange/onKeyDown handlers with built-in submit and auto-resize behavior",
|
|
129
|
+
"Consider showing usage/token limits for AI contexts"
|
|
130
|
+
],
|
|
131
|
+
"accessibility": [
|
|
132
|
+
"Enter submits, Shift+Enter for newline",
|
|
133
|
+
"Submit button is keyboard accessible",
|
|
134
|
+
"Loading state prevents duplicate submissions"
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
"examples": [
|
|
138
|
+
{
|
|
139
|
+
"name": "Basic",
|
|
140
|
+
"description": "Simple prompt with submit button",
|
|
141
|
+
"code": "<Prompt onSubmit={(value) => console.log(value)}>\n <Prompt.Textarea />\n <Prompt.Toolbar>\n <Prompt.Actions />\n <Prompt.Info>\n <Prompt.Submit />\n </Prompt.Info>\n </Prompt.Toolbar>\n</Prompt>"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"name": "With Actions",
|
|
145
|
+
"description": "Prompt with attachment and mode buttons",
|
|
146
|
+
"code": "<Prompt onSubmit={(value) => console.log(value)}>\n <Prompt.Textarea />\n <Prompt.Toolbar>\n <Prompt.Actions>\n <Prompt.ActionButton aria-label=\"Add attachment\">\n +\n </Prompt.ActionButton>\n <Prompt.ModeButton>Auto</Prompt.ModeButton>\n </Prompt.Actions>\n <Prompt.Info>\n <Prompt.Submit />\n </Prompt.Info>\n </Prompt.Toolbar>\n</Prompt>"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"name": "With Usage",
|
|
150
|
+
"description": "Shows token usage indicator",
|
|
151
|
+
"code": "<Prompt onSubmit={(value) => console.log(value)}>\n <Prompt.Textarea />\n <Prompt.Toolbar>\n <Prompt.Actions>\n <Prompt.ActionButton aria-label=\"Add attachment\">\n +\n </Prompt.ActionButton>\n <Prompt.ModeButton active>Auto</Prompt.ModeButton>\n </Prompt.Actions>\n <Prompt.Info>\n <Prompt.Usage>52% used</Prompt.Usage>\n <Prompt.Submit />\n </Prompt.Info>\n </Prompt.Toolbar>\n</Prompt>"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"name": "Loading State",
|
|
155
|
+
"description": "During API submission",
|
|
156
|
+
"code": "<Prompt\n onSubmit={(value) => console.log(value)}\n loading\n defaultValue=\"Tell me about the weather...\"\n>\n <Prompt.Textarea />\n <Prompt.Toolbar>\n <Prompt.Actions>\n <Prompt.ActionButton aria-label=\"Add attachment\">\n +\n </Prompt.ActionButton>\n <Prompt.ModeButton>Auto</Prompt.ModeButton>\n </Prompt.Actions>\n <Prompt.Info>\n <Prompt.Usage>52% used</Prompt.Usage>\n <Prompt.Submit />\n </Prompt.Info>\n </Prompt.Toolbar>\n</Prompt>"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"name": "Disabled",
|
|
160
|
+
"description": "Non-interactive prompt",
|
|
161
|
+
"code": "<Prompt onSubmit={(value) => console.log(value)} disabled>\n <Prompt.Textarea />\n <Prompt.Toolbar>\n <Prompt.Actions>\n <Prompt.ActionButton aria-label=\"Add attachment\">\n +\n </Prompt.ActionButton>\n </Prompt.Actions>\n <Prompt.Info>\n <Prompt.Submit />\n </Prompt.Info>\n </Prompt.Toolbar>\n</Prompt>"
|
|
162
|
+
}
|
|
163
|
+
],
|
|
164
|
+
"relations": [
|
|
165
|
+
{
|
|
166
|
+
"component": "Input",
|
|
167
|
+
"relationship": "alternative",
|
|
168
|
+
"note": "Use Input for simple single-line text input"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"component": "Textarea",
|
|
172
|
+
"relationship": "alternative",
|
|
173
|
+
"note": "Use Textarea for multi-line without toolbar"
|
|
174
|
+
}
|
|
175
|
+
],
|
|
176
|
+
"contract": {
|
|
177
|
+
"propsSummary": [
|
|
178
|
+
"value: string - controlled input value",
|
|
179
|
+
"onSubmit: (value: string) => void - submission handler",
|
|
180
|
+
"placeholder: string - hint text (default: \"Ask, Search or Chat...\")",
|
|
181
|
+
"disabled: boolean - disables interaction",
|
|
182
|
+
"loading: boolean - shows loading state",
|
|
183
|
+
"minRows/maxRows: number - row constraints (default: 1/8)",
|
|
184
|
+
"submitOnEnter: boolean - Enter key behavior (default: true)",
|
|
185
|
+
"Prompt.Textarea accepts native textarea props and optional aria-label override"
|
|
186
|
+
],
|
|
187
|
+
"a11yRules": [
|
|
188
|
+
"A11Y_TEXTAREA_LABEL",
|
|
189
|
+
"A11Y_BUTTON_LABEL"
|
|
190
|
+
]
|
|
191
|
+
},
|
|
192
|
+
"ai": {
|
|
193
|
+
"compositionPattern": "compound",
|
|
194
|
+
"subComponents": [
|
|
195
|
+
"Textarea",
|
|
196
|
+
"Toolbar",
|
|
197
|
+
"Actions",
|
|
198
|
+
"Info",
|
|
199
|
+
"ActionButton",
|
|
200
|
+
"ModeButton",
|
|
201
|
+
"Usage",
|
|
202
|
+
"Submit"
|
|
203
|
+
]
|
|
204
|
+
},
|
|
205
|
+
"provenance": {
|
|
206
|
+
"source": "migrated",
|
|
207
|
+
"verified": false,
|
|
208
|
+
"frameworkSupport": "native",
|
|
209
|
+
"extractedAt": "2026-03-13T23:19:02.513Z"
|
|
210
|
+
}
|
|
211
|
+
}
|