@coinbase/cds-mcp-server 8.17.2 → 8.17.4

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.
Files changed (284) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/mcp-docs/mobile/components/Accordion.txt +188 -0
  3. package/mcp-docs/mobile/components/AccordionItem.txt +29 -0
  4. package/mcp-docs/mobile/components/Alert.txt +155 -0
  5. package/mcp-docs/mobile/components/AreaChart.txt +265 -0
  6. package/mcp-docs/mobile/components/Avatar.txt +195 -0
  7. package/mcp-docs/mobile/components/AvatarButton.txt +225 -0
  8. package/mcp-docs/mobile/components/Banner.txt +221 -0
  9. package/mcp-docs/mobile/components/BarChart.txt +815 -0
  10. package/mcp-docs/mobile/components/Box.txt +173 -0
  11. package/mcp-docs/mobile/components/BrowserBar.txt +146 -0
  12. package/mcp-docs/mobile/components/Button.txt +198 -0
  13. package/mcp-docs/mobile/components/ButtonGroup.txt +79 -0
  14. package/mcp-docs/mobile/components/Carousel.txt +1083 -0
  15. package/mcp-docs/mobile/components/CartesianChart.txt +825 -0
  16. package/mcp-docs/mobile/components/CellMedia.txt +70 -0
  17. package/mcp-docs/mobile/components/Checkbox.txt +245 -0
  18. package/mcp-docs/mobile/components/CheckboxCell.txt +201 -0
  19. package/mcp-docs/mobile/components/CheckboxGroup.txt +284 -0
  20. package/mcp-docs/mobile/components/Chip.txt +194 -0
  21. package/mcp-docs/mobile/components/Coachmark.txt +157 -0
  22. package/mcp-docs/mobile/components/Collapsible.txt +104 -0
  23. package/mcp-docs/mobile/components/ContainedAssetCard.txt +134 -0
  24. package/mcp-docs/mobile/components/ContentCard.txt +365 -0
  25. package/mcp-docs/mobile/components/ContentCardBody.txt +135 -0
  26. package/mcp-docs/mobile/components/ContentCardFooter.txt +127 -0
  27. package/mcp-docs/mobile/components/ContentCardHeader.txt +145 -0
  28. package/mcp-docs/mobile/components/ContentCell.txt +226 -0
  29. package/mcp-docs/mobile/components/ControlGroup.txt +443 -0
  30. package/mcp-docs/mobile/components/DatePicker.txt +496 -0
  31. package/mcp-docs/mobile/components/Divider.txt +138 -0
  32. package/mcp-docs/mobile/components/DotCount.txt +145 -0
  33. package/mcp-docs/mobile/components/DotStatusColor.txt +58 -0
  34. package/mcp-docs/mobile/components/DotSymbol.txt +134 -0
  35. package/mcp-docs/mobile/components/Fallback.txt +157 -0
  36. package/mcp-docs/mobile/components/FloatingAssetCard.txt +155 -0
  37. package/mcp-docs/mobile/components/HStack.txt +234 -0
  38. package/mcp-docs/mobile/components/HeroSquare.txt +47 -0
  39. package/mcp-docs/mobile/components/Icon.txt +51 -0
  40. package/mcp-docs/mobile/components/IconButton.txt +268 -0
  41. package/mcp-docs/mobile/components/InputChip.txt +187 -0
  42. package/mcp-docs/mobile/components/Interactable.txt +186 -0
  43. package/mcp-docs/mobile/components/LineChart.txt +1324 -0
  44. package/mcp-docs/mobile/components/Link.txt +291 -0
  45. package/mcp-docs/mobile/components/ListCell.txt +412 -0
  46. package/mcp-docs/mobile/components/LogoMark.txt +84 -0
  47. package/mcp-docs/mobile/components/LogoWordMark.txt +93 -0
  48. package/mcp-docs/mobile/components/Lottie.txt +138 -0
  49. package/mcp-docs/mobile/components/LottieStatusAnimation.txt +46 -0
  50. package/mcp-docs/mobile/components/Modal.txt +83 -0
  51. package/mcp-docs/mobile/components/ModalBody.txt +33 -0
  52. package/mcp-docs/mobile/components/ModalFooter.txt +24 -0
  53. package/mcp-docs/mobile/components/ModalHeader.txt +27 -0
  54. package/mcp-docs/mobile/components/MultiContentModule.txt +379 -0
  55. package/mcp-docs/mobile/components/NavigationTitle.txt +131 -0
  56. package/mcp-docs/mobile/components/NavigationTitleSelect.txt +141 -0
  57. package/mcp-docs/mobile/components/NudgeCard.txt +89 -0
  58. package/mcp-docs/mobile/components/Numpad.txt +340 -0
  59. package/mcp-docs/mobile/components/Overlay.txt +151 -0
  60. package/mcp-docs/mobile/components/PageFooter.txt +160 -0
  61. package/mcp-docs/mobile/components/PageHeader.txt +185 -0
  62. package/mcp-docs/mobile/components/PeriodSelector.txt +407 -0
  63. package/mcp-docs/mobile/components/Pictogram.txt +47 -0
  64. package/mcp-docs/mobile/components/Point.txt +204 -0
  65. package/mcp-docs/mobile/components/PortalProvider.txt +78 -0
  66. package/mcp-docs/mobile/components/Pressable.txt +210 -0
  67. package/mcp-docs/mobile/components/ProgressBar.txt +129 -0
  68. package/mcp-docs/mobile/components/ProgressBarWithFixedLabels.txt +160 -0
  69. package/mcp-docs/mobile/components/ProgressBarWithFloatLabel.txt +137 -0
  70. package/mcp-docs/mobile/components/ProgressCircle.txt +236 -0
  71. package/mcp-docs/mobile/components/Radio.txt +241 -0
  72. package/mcp-docs/mobile/components/RadioCell.txt +201 -0
  73. package/mcp-docs/mobile/components/RadioGroup.txt +281 -0
  74. package/mcp-docs/mobile/components/ReferenceLine.txt +152 -0
  75. package/mcp-docs/mobile/components/RemoteImage.txt +105 -0
  76. package/mcp-docs/mobile/components/RemoteImageGroup.txt +60 -0
  77. package/mcp-docs/mobile/components/RollingNumber.txt +788 -0
  78. package/mcp-docs/mobile/components/Scrubber.txt +203 -0
  79. package/mcp-docs/mobile/components/SearchInput.txt +191 -0
  80. package/mcp-docs/mobile/components/SectionHeader.txt +204 -0
  81. package/mcp-docs/mobile/components/SegmentedTabs.txt +315 -0
  82. package/mcp-docs/mobile/components/Select.txt +211 -0
  83. package/mcp-docs/mobile/components/SelectChip.txt +323 -0
  84. package/mcp-docs/mobile/components/SelectOption.txt +84 -0
  85. package/mcp-docs/mobile/components/SlideButton.txt +330 -0
  86. package/mcp-docs/mobile/components/Spacer.txt +83 -0
  87. package/mcp-docs/mobile/components/Sparkline.txt +122 -0
  88. package/mcp-docs/mobile/components/SparklineGradient.txt +106 -0
  89. package/mcp-docs/mobile/components/SparklineInteractive.txt +156 -0
  90. package/mcp-docs/mobile/components/SparklineInteractiveHeader.txt +72 -0
  91. package/mcp-docs/mobile/components/Spinner.txt +48 -0
  92. package/mcp-docs/mobile/components/SpotIcon.txt +47 -0
  93. package/mcp-docs/mobile/components/SpotRectangle.txt +47 -0
  94. package/mcp-docs/mobile/components/SpotSquare.txt +47 -0
  95. package/mcp-docs/mobile/components/Stepper.txt +527 -0
  96. package/mcp-docs/mobile/components/SubBrandLogoMark.txt +125 -0
  97. package/mcp-docs/mobile/components/SubBrandLogoWordMark.txt +125 -0
  98. package/mcp-docs/mobile/components/Switch.txt +97 -0
  99. package/mcp-docs/mobile/components/TabIndicator.txt +48 -0
  100. package/mcp-docs/mobile/components/TabLabel.txt +153 -0
  101. package/mcp-docs/mobile/components/TabNavigation.txt +146 -0
  102. package/mcp-docs/mobile/components/TabbedChips.txt +142 -0
  103. package/mcp-docs/mobile/components/Tabs.txt +190 -0
  104. package/mcp-docs/mobile/components/Tag.txt +300 -0
  105. package/mcp-docs/mobile/components/Text.txt +211 -0
  106. package/mcp-docs/mobile/components/TextInput.txt +717 -0
  107. package/mcp-docs/mobile/components/ThemeProvider.txt +132 -0
  108. package/mcp-docs/mobile/components/Toast.txt +196 -0
  109. package/mcp-docs/mobile/components/Tooltip.txt +59 -0
  110. package/mcp-docs/mobile/components/TopNavBar.txt +161 -0
  111. package/mcp-docs/mobile/components/Tour.txt +158 -0
  112. package/mcp-docs/mobile/components/Tray.txt +252 -0
  113. package/mcp-docs/mobile/components/UpsellCard.txt +321 -0
  114. package/mcp-docs/mobile/components/VStack.txt +222 -0
  115. package/mcp-docs/mobile/components/XAxis.txt +621 -0
  116. package/mcp-docs/mobile/components/YAxis.txt +567 -0
  117. package/mcp-docs/mobile/getting-started/ai-overview.txt +108 -0
  118. package/mcp-docs/mobile/getting-started/installation.txt +57 -0
  119. package/mcp-docs/mobile/getting-started/introduction.txt +102 -0
  120. package/mcp-docs/mobile/getting-started/playground.txt +28 -0
  121. package/mcp-docs/mobile/getting-started/styling.txt +84 -0
  122. package/mcp-docs/mobile/getting-started/theming.txt +286 -0
  123. package/mcp-docs/mobile/hooks/useDimensions.txt +72 -0
  124. package/mcp-docs/mobile/hooks/useEventHandler.txt +120 -0
  125. package/mcp-docs/mobile/hooks/useMergeRefs.txt +116 -0
  126. package/mcp-docs/mobile/hooks/useOverlayContentContext.txt +280 -0
  127. package/mcp-docs/mobile/hooks/usePreviousValue.txt +74 -0
  128. package/mcp-docs/mobile/hooks/useRefMap.txt +178 -0
  129. package/mcp-docs/mobile/hooks/useTheme.txt +321 -0
  130. package/mcp-docs/mobile/routes.txt +139 -0
  131. package/mcp-docs/web/components/Accordion.txt +189 -0
  132. package/mcp-docs/web/components/AccordionItem.txt +31 -0
  133. package/mcp-docs/web/components/Alert.txt +164 -0
  134. package/mcp-docs/web/components/AreaChart.txt +510 -0
  135. package/mcp-docs/web/components/Avatar.txt +211 -0
  136. package/mcp-docs/web/components/AvatarButton.txt +240 -0
  137. package/mcp-docs/web/components/Banner.txt +226 -0
  138. package/mcp-docs/web/components/BarChart.txt +1267 -0
  139. package/mcp-docs/web/components/Box.txt +175 -0
  140. package/mcp-docs/web/components/Button.txt +212 -0
  141. package/mcp-docs/web/components/ButtonGroup.txt +79 -0
  142. package/mcp-docs/web/components/Calendar.txt +181 -0
  143. package/mcp-docs/web/components/Carousel.txt +1575 -0
  144. package/mcp-docs/web/components/CartesianChart.txt +1044 -0
  145. package/mcp-docs/web/components/CellMedia.txt +56 -0
  146. package/mcp-docs/web/components/Checkbox.txt +188 -0
  147. package/mcp-docs/web/components/CheckboxCell.txt +202 -0
  148. package/mcp-docs/web/components/CheckboxGroup.txt +219 -0
  149. package/mcp-docs/web/components/Chip.txt +196 -0
  150. package/mcp-docs/web/components/Coachmark.txt +188 -0
  151. package/mcp-docs/web/components/Collapsible.txt +119 -0
  152. package/mcp-docs/web/components/ContainedAssetCard.txt +232 -0
  153. package/mcp-docs/web/components/ContentCard.txt +367 -0
  154. package/mcp-docs/web/components/ContentCardBody.txt +137 -0
  155. package/mcp-docs/web/components/ContentCardFooter.txt +129 -0
  156. package/mcp-docs/web/components/ContentCardHeader.txt +147 -0
  157. package/mcp-docs/web/components/ContentCell.txt +219 -0
  158. package/mcp-docs/web/components/ControlGroup.txt +436 -0
  159. package/mcp-docs/web/components/DatePicker.txt +505 -0
  160. package/mcp-docs/web/components/Divider.txt +143 -0
  161. package/mcp-docs/web/components/DotCount.txt +149 -0
  162. package/mcp-docs/web/components/DotStatusColor.txt +58 -0
  163. package/mcp-docs/web/components/DotSymbol.txt +137 -0
  164. package/mcp-docs/web/components/Dropdown.txt +119 -0
  165. package/mcp-docs/web/components/Fallback.txt +163 -0
  166. package/mcp-docs/web/components/FloatingAssetCard.txt +250 -0
  167. package/mcp-docs/web/components/FullscreenAlert.txt +69 -0
  168. package/mcp-docs/web/components/FullscreenModal.txt +145 -0
  169. package/mcp-docs/web/components/FullscreenModalLayout.txt +187 -0
  170. package/mcp-docs/web/components/Grid.txt +236 -0
  171. package/mcp-docs/web/components/GridColumn.txt +209 -0
  172. package/mcp-docs/web/components/HStack.txt +236 -0
  173. package/mcp-docs/web/components/HeroSquare.txt +48 -0
  174. package/mcp-docs/web/components/Icon.txt +145 -0
  175. package/mcp-docs/web/components/IconButton.txt +390 -0
  176. package/mcp-docs/web/components/InputChip.txt +187 -0
  177. package/mcp-docs/web/components/Interactable.txt +193 -0
  178. package/mcp-docs/web/components/LineChart.txt +1576 -0
  179. package/mcp-docs/web/components/Link.txt +243 -0
  180. package/mcp-docs/web/components/ListCell.txt +418 -0
  181. package/mcp-docs/web/components/LogoMark.txt +84 -0
  182. package/mcp-docs/web/components/LogoWordMark.txt +93 -0
  183. package/mcp-docs/web/components/Lottie.txt +157 -0
  184. package/mcp-docs/web/components/LottieStatusAnimation.txt +57 -0
  185. package/mcp-docs/web/components/MediaQueryProvider.txt +108 -0
  186. package/mcp-docs/web/components/Modal.txt +196 -0
  187. package/mcp-docs/web/components/ModalBody.txt +117 -0
  188. package/mcp-docs/web/components/ModalFooter.txt +119 -0
  189. package/mcp-docs/web/components/ModalHeader.txt +123 -0
  190. package/mcp-docs/web/components/MultiContentModule.txt +381 -0
  191. package/mcp-docs/web/components/NavigationBar.txt +102 -0
  192. package/mcp-docs/web/components/NavigationTitle.txt +25 -0
  193. package/mcp-docs/web/components/NavigationTitleSelect.txt +45 -0
  194. package/mcp-docs/web/components/NudgeCard.txt +181 -0
  195. package/mcp-docs/web/components/Overlay.txt +171 -0
  196. package/mcp-docs/web/components/PageFooter.txt +184 -0
  197. package/mcp-docs/web/components/PageHeader.txt +243 -0
  198. package/mcp-docs/web/components/Pagination.txt +499 -0
  199. package/mcp-docs/web/components/PeriodSelector.txt +703 -0
  200. package/mcp-docs/web/components/Pictogram.txt +48 -0
  201. package/mcp-docs/web/components/Point.txt +460 -0
  202. package/mcp-docs/web/components/PortalProvider.txt +76 -0
  203. package/mcp-docs/web/components/Pressable.txt +193 -0
  204. package/mcp-docs/web/components/ProgressBar.txt +163 -0
  205. package/mcp-docs/web/components/ProgressBarWithFixedLabels.txt +212 -0
  206. package/mcp-docs/web/components/ProgressBarWithFloatLabel.txt +181 -0
  207. package/mcp-docs/web/components/ProgressCircle.txt +443 -0
  208. package/mcp-docs/web/components/Radio.txt +219 -0
  209. package/mcp-docs/web/components/RadioCell.txt +215 -0
  210. package/mcp-docs/web/components/RadioGroup.txt +288 -0
  211. package/mcp-docs/web/components/ReferenceLine.txt +451 -0
  212. package/mcp-docs/web/components/RemoteImage.txt +165 -0
  213. package/mcp-docs/web/components/RemoteImageGroup.txt +86 -0
  214. package/mcp-docs/web/components/RollingNumber.txt +1021 -0
  215. package/mcp-docs/web/components/Scrubber.txt +231 -0
  216. package/mcp-docs/web/components/SearchInput.txt +117 -0
  217. package/mcp-docs/web/components/SectionHeader.txt +217 -0
  218. package/mcp-docs/web/components/SegmentedTabs.txt +324 -0
  219. package/mcp-docs/web/components/Select.txt +224 -0
  220. package/mcp-docs/web/components/SelectChip.txt +314 -0
  221. package/mcp-docs/web/components/SelectOption.txt +165 -0
  222. package/mcp-docs/web/components/Sidebar.txt +349 -0
  223. package/mcp-docs/web/components/SidebarItem.txt +131 -0
  224. package/mcp-docs/web/components/SidebarMoreMenu.txt +30 -0
  225. package/mcp-docs/web/components/Spacer.txt +173 -0
  226. package/mcp-docs/web/components/Sparkline.txt +122 -0
  227. package/mcp-docs/web/components/SparklineGradient.txt +106 -0
  228. package/mcp-docs/web/components/SparklineInteractive.txt +153 -0
  229. package/mcp-docs/web/components/SparklineInteractiveHeader.txt +76 -0
  230. package/mcp-docs/web/components/Spinner.txt +128 -0
  231. package/mcp-docs/web/components/SpotIcon.txt +48 -0
  232. package/mcp-docs/web/components/SpotRectangle.txt +48 -0
  233. package/mcp-docs/web/components/SpotSquare.txt +48 -0
  234. package/mcp-docs/web/components/Stepper.txt +682 -0
  235. package/mcp-docs/web/components/SubBrandLogoMark.txt +125 -0
  236. package/mcp-docs/web/components/SubBrandLogoWordMark.txt +125 -0
  237. package/mcp-docs/web/components/Switch.txt +85 -0
  238. package/mcp-docs/web/components/TabIndicator.txt +48 -0
  239. package/mcp-docs/web/components/TabLabel.txt +158 -0
  240. package/mcp-docs/web/components/TabNavigation.txt +159 -0
  241. package/mcp-docs/web/components/TabbedChips.txt +155 -0
  242. package/mcp-docs/web/components/Table.txt +367 -0
  243. package/mcp-docs/web/components/TableBody.txt +83 -0
  244. package/mcp-docs/web/components/TableCaption.txt +102 -0
  245. package/mcp-docs/web/components/TableCell.txt +165 -0
  246. package/mcp-docs/web/components/TableCellFallback.txt +97 -0
  247. package/mcp-docs/web/components/TableFooter.txt +83 -0
  248. package/mcp-docs/web/components/TableHeader.txt +100 -0
  249. package/mcp-docs/web/components/TableRow.txt +140 -0
  250. package/mcp-docs/web/components/Tabs.txt +212 -0
  251. package/mcp-docs/web/components/Tag.txt +304 -0
  252. package/mcp-docs/web/components/Text.txt +232 -0
  253. package/mcp-docs/web/components/TextInput.txt +652 -0
  254. package/mcp-docs/web/components/ThemeProvider.txt +199 -0
  255. package/mcp-docs/web/components/TileButton.txt +158 -0
  256. package/mcp-docs/web/components/Toast.txt +203 -0
  257. package/mcp-docs/web/components/Tooltip.txt +89 -0
  258. package/mcp-docs/web/components/Tour.txt +179 -0
  259. package/mcp-docs/web/components/Tray.txt +288 -0
  260. package/mcp-docs/web/components/UpsellCard.txt +319 -0
  261. package/mcp-docs/web/components/VStack.txt +224 -0
  262. package/mcp-docs/web/components/XAxis.txt +619 -0
  263. package/mcp-docs/web/components/YAxis.txt +548 -0
  264. package/mcp-docs/web/getting-started/ai-overview.txt +108 -0
  265. package/mcp-docs/web/getting-started/installation.txt +103 -0
  266. package/mcp-docs/web/getting-started/introduction.txt +102 -0
  267. package/mcp-docs/web/getting-started/playground.txt +28 -0
  268. package/mcp-docs/web/getting-started/styling.txt +161 -0
  269. package/mcp-docs/web/getting-started/templates.txt +121 -0
  270. package/mcp-docs/web/getting-started/theming.txt +426 -0
  271. package/mcp-docs/web/hooks/useBreakpoints.txt +61 -0
  272. package/mcp-docs/web/hooks/useDimensions.txt +114 -0
  273. package/mcp-docs/web/hooks/useEventHandler.txt +120 -0
  274. package/mcp-docs/web/hooks/useHasMounted.txt +75 -0
  275. package/mcp-docs/web/hooks/useIsoEffect.txt +58 -0
  276. package/mcp-docs/web/hooks/useMediaQuery.txt +114 -0
  277. package/mcp-docs/web/hooks/useMergeRefs.txt +116 -0
  278. package/mcp-docs/web/hooks/useOverlayContentContext.txt +279 -0
  279. package/mcp-docs/web/hooks/usePreviousValue.txt +74 -0
  280. package/mcp-docs/web/hooks/useRefMap.txt +178 -0
  281. package/mcp-docs/web/hooks/useScrollBlocker.txt +82 -0
  282. package/mcp-docs/web/hooks/useTheme.txt +364 -0
  283. package/mcp-docs/web/routes.txt +163 -0
  284. package/package.json +1 -1
@@ -0,0 +1,652 @@
1
+ # TextInput
2
+
3
+ A control for entering text.
4
+
5
+ ## Import
6
+
7
+ ```tsx
8
+ import { TextInput } from '@coinbase/cds-web/controls/TextInput'
9
+ ```
10
+
11
+ ## Examples
12
+
13
+ **Note** TextField extends props from [HTMLInputElement](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attributes) on web. On mobile, it extends [TextInputProps](https://reactnative.dev/docs/textinput#props) from react-native.
14
+
15
+ #### Input Label
16
+
17
+ Default composition of Inputs.
18
+
19
+ ```jsx live
20
+ <VStack gap={3}>
21
+ <TextInput
22
+ label="API Access Token"
23
+ placeholder="HaeJiWplJohn6W42eCq0Qqft0"
24
+ end={
25
+ <Box paddingX={2}>
26
+ <Link variant="caption" color="primary" to="">
27
+ COPY
28
+ </Link>
29
+ </Box>
30
+ }
31
+ />
32
+
33
+ <VStack>
34
+ <Text as="p">Use the compact variant when space is tight.</Text>
35
+ <TextInput
36
+ compact
37
+ type="number"
38
+ step="0.01"
39
+ label="Amount"
40
+ placeholder="8293323.23"
41
+ suffix="USD"
42
+ />
43
+ </VStack>
44
+ </VStack>
45
+ ```
46
+
47
+ #### Accessible Text Inputs
48
+
49
+ TextInput comes with an accessibilityLabel prop. If no accessibilityLabel is passed, it will use the label as the accessibilityLabel. If you want an accessibilityLabel that differs from the Label, you can set this prop.
50
+
51
+ Here, since no accessibilityLabel is passed, the accessibilityLabel will be "Email".
52
+
53
+ ```jsx
54
+ <TextInput label="Email" />
55
+ ```
56
+
57
+ Example of passing an accessibilityLabel. For web, this will set aria-label="Enter a Coinbase Email" under the hood
58
+
59
+ ```jsx
60
+ <TextInput accessibilityLabel="Enter a Coinbase Email" label="Email" />
61
+ ```
62
+
63
+ :::tip Accessibility tip
64
+
65
+ Like any component system, much of the responsibility for building accessible UIs is in your hands as the consumer to properly implement the component composition. We'll do our best to provide sane fallbacks, but here are the biggest gotchas for `TextInput`s you can watch out for.
66
+
67
+ <br />
68
+
69
+ ##### `aria-*` attr overrides
70
+
71
+ Any time you use `variant='negative'`, we assume you're showing an error state. If for some reason this is _not_ the case, you will want to use `aria-invalid={false}` to override the default configuration.
72
+
73
+ <br />
74
+
75
+ ##### Message format
76
+
77
+ It's also advised you always format `helperText` with `Error: ${errorMessage}`. We'd do that for you, but _i18n_ isn't baked into CDS. Take a look at the example below:
78
+
79
+ :::
80
+
81
+ ```jsx live
82
+ <VStack gap={4}>
83
+ <TextInput
84
+ label="Text Input rendered in an errored state"
85
+ placeholder="Enter a color"
86
+ helperText="Error: Your favorite color is not orange"
87
+ variant="negative"
88
+ />
89
+ <TextInput
90
+ label="Text Input that's red but not in an errored state"
91
+ placeholder="Enter a color"
92
+ helperText="You like red?"
93
+ variant="negative"
94
+ // Override the default behavior when variant="negative"
95
+ aria-invalid={false}
96
+ />
97
+ </VStack>
98
+ ```
99
+
100
+ #### Placeholder Text
101
+
102
+ ```jsx live
103
+ <TextInput label="Label" placeholder="Placeholder" />
104
+ ```
105
+
106
+ #### Borderless TextInput (web)
107
+
108
+ A borderless TextInput SHOULD NOT be used alone. It should be used
109
+ with a TypeAhead component.
110
+
111
+ ```jsx live
112
+ <HStack padding={2}>
113
+ <TextInput
114
+ label="Borderless TextInput"
115
+ placeholder="placeholder"
116
+ helperText="helperText"
117
+ bordered={false}
118
+ />
119
+ </HStack>
120
+ ```
121
+
122
+ #### Helper Text
123
+
124
+ ##### Default Sentiment
125
+
126
+ ```jsx live
127
+ <VStack gap={3}>
128
+ <VStack>
129
+ <TextHeadline as="p">Default sentiment</TextHeadline>
130
+ <TextInput
131
+ label="Campaign title"
132
+ placeholder="Title"
133
+ helperText="This won't be displayed to user"
134
+ />
135
+ </VStack>
136
+
137
+ <VStack>
138
+ <TextHeadline as="p">Positive sentiment</TextHeadline>
139
+ <TextInput
140
+ label="Address"
141
+ helperText="Valid BTC address"
142
+ variant="positive"
143
+ placeholder="HaeJiWplJohn6W42eCq0Qqft0"
144
+ end={<InputIcon active color="fgPositive" name="visible" />}
145
+ />
146
+ </VStack>
147
+
148
+ <VStack>
149
+ <TextHeadline as="p">Negative Sentiment</TextHeadline>
150
+ <TextInput
151
+ label="Address"
152
+ helperText="Invalid BTC address"
153
+ variant="negative"
154
+ placeholder="HaeJiWplJohn6W42eCq0Qqft0"
155
+ end={<InputIcon active color="fgNegative" name="visible" />}
156
+ />
157
+ </VStack>
158
+ </VStack>
159
+ ```
160
+
161
+ #### Color Surge Enabled
162
+
163
+ ```jsx live
164
+ <VStack gap={3}>
165
+ <TextInput
166
+ label="Default Color Surge"
167
+ placeholder="Focus me"
168
+ helperText="This won't be displayed to user"
169
+ enableColorSurge
170
+ />
171
+
172
+ <TextInput
173
+ label="Positive Color Surge"
174
+ placeholder="Focus me"
175
+ helperText="Valid BTC address"
176
+ variant="positive"
177
+ enableColorSurge
178
+ />
179
+
180
+ <TextInput
181
+ label="Negative Color Surge"
182
+ placeholder="Focus me"
183
+ helperText="Invalid BTC address"
184
+ variant="negative"
185
+ enableColorSurge
186
+ />
187
+ </VStack>
188
+ ```
189
+
190
+ #### Content Alignment
191
+
192
+ ```jsx live
193
+ <VStack gap={3}>
194
+ <VStack>
195
+ <Text as="p">
196
+ <strong>Left aligned (default): </strong>
197
+ </Text>
198
+ <TextInput label="City/town" placeholder="Oakland" />
199
+ </VStack>
200
+
201
+ <VStack>
202
+ <Text as="p">Right aligned (with compact):</Text>
203
+ <TextInput
204
+ label="Limit price"
205
+ compact
206
+ align="end"
207
+ type="number"
208
+ step="0.01"
209
+ placeholder="29.3"
210
+ suffix="USD"
211
+ />
212
+ </VStack>
213
+ </VStack>
214
+ ```
215
+
216
+ #### Label Variants
217
+
218
+ TextInput supports two label variants: `outside` (default) and `inside`. Note that the `compact` prop, when set to true, will override label variant preference.
219
+
220
+ :::warning
221
+
222
+ When using the `inside` label variant, you should always include a `placeholder` prop.
223
+
224
+ :::
225
+
226
+ ```jsx live
227
+ <VStack gap={3}>
228
+ <VStack>
229
+ <Text as="p">
230
+ <strong>Outside label (default):</strong>
231
+ </Text>
232
+ <TextInput label="Email Address" placeholder="Enter your email" />
233
+ </VStack>
234
+
235
+ <VStack>
236
+ <Text as="p">
237
+ <strong>Inside label:</strong>
238
+ </Text>
239
+ <TextInput label="Email Address" labelVariant="inside" placeholder="Enter your email" />
240
+ </VStack>
241
+
242
+ <VStack>
243
+ <Text as="p">
244
+ <strong>Inside label (with start content):</strong>
245
+ </Text>
246
+ <TextInput
247
+ label="Search"
248
+ labelVariant="inside"
249
+ start={<InputIconButton name="search" />}
250
+ placeholder="Search for anything"
251
+ />
252
+ </VStack>
253
+
254
+ <VStack>
255
+ <Text as="p">
256
+ <strong>Inside label (with end content):</strong>
257
+ </Text>
258
+ <TextInput
259
+ label="Password"
260
+ labelVariant="inside"
261
+ type="password"
262
+ end={<InputIconButton name="visibleInactive" />}
263
+ placeholder="Enter your password"
264
+ />
265
+ </VStack>
266
+ </VStack>
267
+ ```
268
+
269
+ #### StartContent & EndContent
270
+
271
+ ##### Examples of Input Objects placed at the Start
272
+
273
+ ```jsx live
274
+ function StartContentExamples() {
275
+ return (
276
+ <VStack gap={3}>
277
+ <VStack>
278
+ <Text as="p">
279
+ <strong>Asset</strong>: Asset objects are not interactive
280
+ </Text>
281
+ <TextInput
282
+ label="Address"
283
+ start={
284
+ <Box paddingX={2}>
285
+ <Avatar
286
+ size="l"
287
+ src="https://dynamic-assets.coinbase.com/e785e0181f1a23a30d9476038d9be91e9f6c63959b538eabbc51a1abc8898940383291eede695c3b8dfaa1829a9b57f5a2d0a16b0523580346c6b8fab67af14b/asset_icons/b57ac673f06a4b0338a596817eb0a50ce16e2059f327dc117744449a47915cb2.png"
288
+ alt="address"
289
+ />
290
+ </Box>
291
+ }
292
+ placeholder="HaeJiWplJohn6W42eCq0Qqft0"
293
+ />
294
+ </VStack>
295
+
296
+ <VStack>
297
+ <Text as="p">
298
+ <strong>Icon</strong>: Icon objects are not interactive.
299
+ </Text>
300
+ <TextInput label="Amount" start={<InputIcon name="cashUSD" />} placeholder="1234" />
301
+ </VStack>
302
+
303
+ <VStack>
304
+ <Text as="p">
305
+ <strong>IconButton</strong>: The most common use case for Icon Button at the start of a
306
+ Text Field is search.
307
+ </Text>
308
+ <TextInput
309
+ label="Search"
310
+ start={<InputIconButton name="search" />}
311
+ placeholder="Search for anything"
312
+ />
313
+ </VStack>
314
+ </VStack>
315
+ );
316
+ }
317
+ ```
318
+
319
+ #### Read Only
320
+
321
+ TextInput supports a read-only state which is visually distinct from the disabled state. Read-only inputs have a secondary background color and can still be focused.
322
+
323
+ ```jsx live
324
+ <VStack gap={3}>
325
+ <TextInput label="Read Only Input" readOnly value="This value cannot be edited" />
326
+ <TextInput label="Read Only with Suffix" readOnly value="1234.56" suffix="USD" />
327
+ <TextInput
328
+ label="Read Only with Start Content"
329
+ readOnly
330
+ value="BTC Address"
331
+ start={<InputIconButton name="search" />}
332
+ />
333
+ </VStack>
334
+ ```
335
+
336
+ ### Example of Input Objects placed at the End
337
+
338
+ Here are some examples and best practices when using end content in a TextField.
339
+
340
+ ```jsx live
341
+ <VStack gap={3}>
342
+ <VStack>
343
+ <Text as="p">
344
+ <strong>Icon</strong>: Icon objects are not interactive.
345
+ </Text>
346
+ <TextInput
347
+ label="Address"
348
+ placeholder="1234 Abc Way"
349
+ end={<InputIcon name="checkmark" color="fgPositive" />}
350
+ />
351
+ </VStack>
352
+
353
+ <VStack>
354
+ <Text as="p">
355
+ The most common use case for placing a text object at the end of an input is currency. This
356
+ object is not interactive.
357
+ </Text>
358
+ <TextInput
359
+ label="Amount"
360
+ type="number"
361
+ step="0.01"
362
+ compact
363
+ placeholder="98329.23"
364
+ suffix="USD"
365
+ />
366
+ </VStack>
367
+
368
+ <VStack>
369
+ <Text as="p">
370
+ You can add a Text Button object at the end of an Input. "Copy" is a great example of this.
371
+ </Text>
372
+ <TextInput
373
+ label="API Access Token"
374
+ placeholder="HaeJiWplJohn6W42eCq0Qqft0"
375
+ end={
376
+ <Box spacingEnd={2}>
377
+ <Link variant="caption" color="primary" to="">
378
+ COPY
379
+ </Link>
380
+ </Box>
381
+ }
382
+ />
383
+ </VStack>
384
+ </VStack>
385
+ ```
386
+
387
+ #### Password input
388
+
389
+ Password Input - Use Icon Buttons at the end for actions like showing a password or clearing text from an input.
390
+
391
+ > a11y tip: Always provide an `accessibilityLabel` to start/end nodes to clearly communicate state/actions
392
+
393
+ ```jsx live
394
+ function PasswordInput() {
395
+ const [isVisible, setIsVisible] = useState(false);
396
+ const type = useMemo(() => (isVisible ? 'text' : 'password'), [isVisible]);
397
+
398
+ return (
399
+ <TextInput
400
+ label="Password"
401
+ type={type}
402
+ end={
403
+ <InputIconButton
404
+ name={isVisible ? 'visibleActive' : 'visibleInactive'}
405
+ onClick={() => setIsVisible((isVisible) => !setIsVisible)}
406
+ accessibilityLabel={isVisible ? 'Hide password' : 'Show password'}
407
+ />
408
+ }
409
+ />
410
+ );
411
+ }
412
+ ```
413
+
414
+ #### Link + Icon Button
415
+
416
+ If needed, you can add a Link + Icon Button like this example here. Use this sparingly and only at the End of an Input.
417
+
418
+ ```jsx live
419
+ function CopyTextField() {
420
+ const [copied, setCopied] = useState(false);
421
+ const [variant, setVariant] = useState('foregroundMuted');
422
+ const [helperText, setHelperText] = useState('');
423
+
424
+ useEffect(() => {
425
+ if (copied) {
426
+ setVariant('positive');
427
+ setHelperText('Your token has been copied!');
428
+ } else {
429
+ setVariant('foregroundMuted');
430
+ setHelperText('');
431
+ }
432
+ }, [copied]);
433
+
434
+ const handleOnChange = useCallback(() => {
435
+ setVariant('foregroundMuted');
436
+ setCopied(false);
437
+ setHelperText('');
438
+ }, []);
439
+
440
+ return (
441
+ <TextInput
442
+ end={
443
+ <HStack>
444
+ <Link onClick={() => setCopied(true)} variant="caption" color={variant}>
445
+ {copied ? 'copied' : 'copy'}
446
+ </Link>
447
+ <InputIcon active color="primary" name="visible" />
448
+ </HStack>
449
+ }
450
+ onChange={handleOnChange}
451
+ variant={variant}
452
+ helperText={helperText}
453
+ label="API Access Token"
454
+ />
455
+ );
456
+ }
457
+ ```
458
+
459
+ #### Disabled
460
+
461
+ ```jsx live
462
+ <VStack gap={3}>
463
+ <TextInput label="Label" disabled />
464
+ <TextInput label="Label" compact disabled />
465
+ </VStack>
466
+ ```
467
+
468
+ #### TextArea Example (mobile)
469
+
470
+ On mobile, TextInput is versatile enough to support
471
+ a "TextArea" as well. You just need to add multiline prop.
472
+ Here is an example
473
+
474
+ ```jsx
475
+ const [text, onChangeText] = useState('');
476
+
477
+ <MockTextInput
478
+ onChangeText={onChangeText}
479
+ value={text}
480
+ label="Textarea"
481
+ helperText="Write about yourself"
482
+ variant="foregroundMuted"
483
+ multiline
484
+ value="
485
+ A really really really really
486
+ long piece
487
+ of text
488
+ displayed. A really really really really
489
+ long piece
490
+ of text
491
+ displayed.
492
+ A really really really really
493
+ long piece
494
+ of text
495
+ displayed
496
+ "
497
+ />;
498
+ ```
499
+
500
+ #### Example of a Form
501
+
502
+ We recommend that you use spacing 3 when building stacked forms.
503
+
504
+ ```jsx live
505
+ function FormExample() {
506
+ const gap = 3;
507
+
508
+ const onSubmit = useCallback((e) => {
509
+ e.preventDefault();
510
+ console.log(e.currentTarget.nodeValue);
511
+ alert('Submitted');
512
+ }, []);
513
+
514
+ return (
515
+ <form onSubmit={onSubmit} action={undefined}>
516
+ <VStack gap={gap}>
517
+ <TextInput
518
+ label="Street address"
519
+ placeholder="4321 Jade Palace"
520
+ helperText="Please enter your primary address."
521
+ />
522
+ <TextInput label="Unit #" aria-required="true" />
523
+ <HStack gap={gap}>
524
+ <TextInput label="City/town" width="70%" />
525
+ <TextInput label="State" width="30%" />
526
+ </HStack>
527
+ <HStack gap={gap}>
528
+ <TextInput label="Postal code" width="40%" />
529
+ <TextInput label="Country" width="60%" />
530
+ </HStack>
531
+ <ButtonGroup>
532
+ <Button type="submit">Save</Button>
533
+ </ButtonGroup>
534
+ </VStack>
535
+ </form>
536
+ );
537
+ }
538
+ ```
539
+
540
+ #### Example of a Sign Up Form
541
+
542
+ ```jsx live
543
+ <HStack gap={2} alignItems="center">
544
+ <TextInput
545
+ label="Email"
546
+ placeholder="satoshi@nakamoto.com"
547
+ helperText="Please enter a valid email address"
548
+ />
549
+ <Box spacingTop={0.5}>
550
+ <Button variant="primary">Submit</Button>
551
+ </Box>
552
+ </HStack>
553
+ ```
554
+
555
+ ### Testing
556
+
557
+ #### Testing different parts of the input
558
+
559
+ You can also use the testIDMap to test different parts
560
+ of the TextInput. If you use testID, it will add the testID to the root
561
+ of the TextInput.
562
+
563
+ ```jsx live
564
+ function testExample() {
565
+ const testIDMap = useMemo(() => {
566
+ return {
567
+ input: 'input-id',
568
+ helperText: 'helperText-id',
569
+ label: 'label-id',
570
+ start: 'start-id',
571
+ end: 'end-id',
572
+ };
573
+ }, []);
574
+ return (
575
+ <TextInput
576
+ label="Email"
577
+ placeholder="satoshi@nakamoto.com"
578
+ helperText="Please enter a valid email address"
579
+ testIDMap={testIDMap}
580
+ start={
581
+ <Box paddingX={2}>
582
+ <Avatar
583
+ size="l"
584
+ src="https://dynamic-assets.coinbase.com/e785e0181f1a23a30d9476038d9be91e9f6c63959b538eabbc51a1abc8898940383291eede695c3b8dfaa1829a9b57f5a2d0a16b0523580346c6b8fab67af14b/asset_icons/b57ac673f06a4b0338a596817eb0a50ce16e2059f327dc117744449a47915cb2.png"
585
+ alt="address"
586
+ />
587
+ </Box>
588
+ }
589
+ end={<InputIcon active color="primary" name="visible" />}
590
+ />
591
+ );
592
+ }
593
+ ```
594
+
595
+ ### Date Picker Example
596
+
597
+ You can construct a DatePicker using TextInput
598
+
599
+ ```jsx live
600
+ function DatePicker() {
601
+ return <TextInput label="Pick a date" type="date" />;
602
+ }
603
+ ```
604
+
605
+ ### TextInput While Keyboard Is Open (mobile)
606
+
607
+ If you have the keyboard open, then closing the keyboard and interacting with the text input requires 2 taps, which isn't a great user experience.
608
+
609
+ To fix this issue, you can wrap the TextInput in a ScrollView, and set keyboardShouldPersistTaps="always".
610
+
611
+ ```jsx
612
+ function TextInputKeyboardExample() {
613
+ return (
614
+ <ScrollView style={{ height: '100%' }} keyboardShouldPersistTaps="always">
615
+ <TextInput label="Amount" type="number" compact placeholder="98329.23" suffix="USD" />
616
+ </ScrollView>
617
+ );
618
+ }
619
+ ```
620
+
621
+ ## Props
622
+
623
+ | Prop | Type | Required | Default | Description |
624
+ | --- | --- | --- | --- | --- |
625
+ | `align` | `center \| start \| end \| justify` | No | `start` | Aligns text inside input and helperText |
626
+ | `borderRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `200` | Leverage one of the borderRadius styles we offer to round the corners of the input. |
627
+ | `bordered` | `boolean` | No | `true` | Adds border to input |
628
+ | `compact` | `boolean` | No | `false` | Enables compact variation |
629
+ | `disabled` | `boolean` | No | `false` | Toggles input interactability and opacity |
630
+ | `enableColorSurge` | `boolean` | No | `-` | Enable Color Surge motion |
631
+ | `end` | `null \| string \| number \| false \| true \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal` | No | `-` | Adds content to the end of the inner input. Refer to diagram for location of endNode in InputStack component |
632
+ | `height` | `((Height<string \| number> \| { base?: Height<string \| number>; phone?: Height<string \| number> \| undefined; tablet?: Height<string \| number> \| undefined; desktop?: Height<string \| number> \| undefined; }) & (string \| number)) \| undefined` | No | `-` | Height of input |
633
+ | `helperText` | `null \| string \| number \| false \| true \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal` | No | `-` | For cases where label is not enough information to describe what the text input is for. Can also be used for showing positive/negative messages |
634
+ | `helperTextErrorIconAccessibilityLabel` | `string` | No | `'error'` | Accessibility label for helper text error icon when variant=negative |
635
+ | `inputNode` | `ReactElement` | No | `-` | Customize the element which the input area will be rendered as. Adds ability to render the input area as a <textarea />, <input /> etc... By default, the input area will be rendered as an <input />. |
636
+ | `key` | `Key \| null` | No | `-` | - |
637
+ | `label` | `string` | No | `-` | Short messageArea indicating purpose of input |
638
+ | `labelVariant` | `inside \| outside` | No | `'outside'` | The variant of the label. Only used when compact is not true. |
639
+ | `onChange` | `ChangeEventHandler<HTMLInputElement>` | No | `-` | - |
640
+ | `onClick` | `(MouseEventHandler<Element> & MouseEventHandler<HTMLInputElement>)` | No | `-` | Callback fired when pressed/clicked |
641
+ | `placeholder` | `string` | No | `-` | Placeholder text displayed inside of the input. Will be replaced if there is a value. |
642
+ | `ref` | `((instance: HTMLInputElement \| null) => void) \| RefObject<HTMLInputElement> \| null` | No | `-` | - |
643
+ | `start` | `null \| string \| number \| false \| true \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal` | No | `-` | Adds content to the start of the inner input. Refer to diagram for location of startNode in InputStack component |
644
+ | `suffix` | `string` | No | `-` | Adds suffix text to the end of input |
645
+ | `testID` | `string` | No | `-` | Used to locate this element in unit and end-to-end tests. Under the hood, testID translates to data-testid on Web. On Mobile, testID stays the same - testID |
646
+ | `testIDMap` | `{ start?: string; end?: string \| undefined; label?: string \| undefined; helperText?: string \| undefined; } \| undefined` | No | `-` | Add ability to test individual parts of the input |
647
+ | `type` | `number \| color \| button \| search \| time \| image \| text \| hidden \| string & {} \| email \| checkbox \| radio \| tel \| url \| date \| submit \| reset \| datetime-local \| file \| month \| password \| range \| week` | No | `-` | - |
648
+ | `value` | `string \| number \| readonly string[]` | No | `-` | - |
649
+ | `variant` | `primary \| secondary \| positive \| negative \| foregroundMuted \| foreground` | No | `foregroundMuted` | Determines the sentiment of the input. Because we allow startContent and endContent to be custom ReactNode, the content placed inside these slots will not change colors according to the variant. You will have to add that yourself |
650
+ | `width` | `ResponsiveProp<Width<string \| number>>` | No | `100%` | Width of input as a percentage string. |
651
+
652
+