@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.
- package/CHANGELOG.md +8 -0
- package/mcp-docs/mobile/components/Accordion.txt +188 -0
- package/mcp-docs/mobile/components/AccordionItem.txt +29 -0
- package/mcp-docs/mobile/components/Alert.txt +155 -0
- package/mcp-docs/mobile/components/AreaChart.txt +265 -0
- package/mcp-docs/mobile/components/Avatar.txt +195 -0
- package/mcp-docs/mobile/components/AvatarButton.txt +225 -0
- package/mcp-docs/mobile/components/Banner.txt +221 -0
- package/mcp-docs/mobile/components/BarChart.txt +815 -0
- package/mcp-docs/mobile/components/Box.txt +173 -0
- package/mcp-docs/mobile/components/BrowserBar.txt +146 -0
- package/mcp-docs/mobile/components/Button.txt +198 -0
- package/mcp-docs/mobile/components/ButtonGroup.txt +79 -0
- package/mcp-docs/mobile/components/Carousel.txt +1083 -0
- package/mcp-docs/mobile/components/CartesianChart.txt +825 -0
- package/mcp-docs/mobile/components/CellMedia.txt +70 -0
- package/mcp-docs/mobile/components/Checkbox.txt +245 -0
- package/mcp-docs/mobile/components/CheckboxCell.txt +201 -0
- package/mcp-docs/mobile/components/CheckboxGroup.txt +284 -0
- package/mcp-docs/mobile/components/Chip.txt +194 -0
- package/mcp-docs/mobile/components/Coachmark.txt +157 -0
- package/mcp-docs/mobile/components/Collapsible.txt +104 -0
- package/mcp-docs/mobile/components/ContainedAssetCard.txt +134 -0
- package/mcp-docs/mobile/components/ContentCard.txt +365 -0
- package/mcp-docs/mobile/components/ContentCardBody.txt +135 -0
- package/mcp-docs/mobile/components/ContentCardFooter.txt +127 -0
- package/mcp-docs/mobile/components/ContentCardHeader.txt +145 -0
- package/mcp-docs/mobile/components/ContentCell.txt +226 -0
- package/mcp-docs/mobile/components/ControlGroup.txt +443 -0
- package/mcp-docs/mobile/components/DatePicker.txt +496 -0
- package/mcp-docs/mobile/components/Divider.txt +138 -0
- package/mcp-docs/mobile/components/DotCount.txt +145 -0
- package/mcp-docs/mobile/components/DotStatusColor.txt +58 -0
- package/mcp-docs/mobile/components/DotSymbol.txt +134 -0
- package/mcp-docs/mobile/components/Fallback.txt +157 -0
- package/mcp-docs/mobile/components/FloatingAssetCard.txt +155 -0
- package/mcp-docs/mobile/components/HStack.txt +234 -0
- package/mcp-docs/mobile/components/HeroSquare.txt +47 -0
- package/mcp-docs/mobile/components/Icon.txt +51 -0
- package/mcp-docs/mobile/components/IconButton.txt +268 -0
- package/mcp-docs/mobile/components/InputChip.txt +187 -0
- package/mcp-docs/mobile/components/Interactable.txt +186 -0
- package/mcp-docs/mobile/components/LineChart.txt +1324 -0
- package/mcp-docs/mobile/components/Link.txt +291 -0
- package/mcp-docs/mobile/components/ListCell.txt +412 -0
- package/mcp-docs/mobile/components/LogoMark.txt +84 -0
- package/mcp-docs/mobile/components/LogoWordMark.txt +93 -0
- package/mcp-docs/mobile/components/Lottie.txt +138 -0
- package/mcp-docs/mobile/components/LottieStatusAnimation.txt +46 -0
- package/mcp-docs/mobile/components/Modal.txt +83 -0
- package/mcp-docs/mobile/components/ModalBody.txt +33 -0
- package/mcp-docs/mobile/components/ModalFooter.txt +24 -0
- package/mcp-docs/mobile/components/ModalHeader.txt +27 -0
- package/mcp-docs/mobile/components/MultiContentModule.txt +379 -0
- package/mcp-docs/mobile/components/NavigationTitle.txt +131 -0
- package/mcp-docs/mobile/components/NavigationTitleSelect.txt +141 -0
- package/mcp-docs/mobile/components/NudgeCard.txt +89 -0
- package/mcp-docs/mobile/components/Numpad.txt +340 -0
- package/mcp-docs/mobile/components/Overlay.txt +151 -0
- package/mcp-docs/mobile/components/PageFooter.txt +160 -0
- package/mcp-docs/mobile/components/PageHeader.txt +185 -0
- package/mcp-docs/mobile/components/PeriodSelector.txt +407 -0
- package/mcp-docs/mobile/components/Pictogram.txt +47 -0
- package/mcp-docs/mobile/components/Point.txt +204 -0
- package/mcp-docs/mobile/components/PortalProvider.txt +78 -0
- package/mcp-docs/mobile/components/Pressable.txt +210 -0
- package/mcp-docs/mobile/components/ProgressBar.txt +129 -0
- package/mcp-docs/mobile/components/ProgressBarWithFixedLabels.txt +160 -0
- package/mcp-docs/mobile/components/ProgressBarWithFloatLabel.txt +137 -0
- package/mcp-docs/mobile/components/ProgressCircle.txt +236 -0
- package/mcp-docs/mobile/components/Radio.txt +241 -0
- package/mcp-docs/mobile/components/RadioCell.txt +201 -0
- package/mcp-docs/mobile/components/RadioGroup.txt +281 -0
- package/mcp-docs/mobile/components/ReferenceLine.txt +152 -0
- package/mcp-docs/mobile/components/RemoteImage.txt +105 -0
- package/mcp-docs/mobile/components/RemoteImageGroup.txt +60 -0
- package/mcp-docs/mobile/components/RollingNumber.txt +788 -0
- package/mcp-docs/mobile/components/Scrubber.txt +203 -0
- package/mcp-docs/mobile/components/SearchInput.txt +191 -0
- package/mcp-docs/mobile/components/SectionHeader.txt +204 -0
- package/mcp-docs/mobile/components/SegmentedTabs.txt +315 -0
- package/mcp-docs/mobile/components/Select.txt +211 -0
- package/mcp-docs/mobile/components/SelectChip.txt +323 -0
- package/mcp-docs/mobile/components/SelectOption.txt +84 -0
- package/mcp-docs/mobile/components/SlideButton.txt +330 -0
- package/mcp-docs/mobile/components/Spacer.txt +83 -0
- package/mcp-docs/mobile/components/Sparkline.txt +122 -0
- package/mcp-docs/mobile/components/SparklineGradient.txt +106 -0
- package/mcp-docs/mobile/components/SparklineInteractive.txt +156 -0
- package/mcp-docs/mobile/components/SparklineInteractiveHeader.txt +72 -0
- package/mcp-docs/mobile/components/Spinner.txt +48 -0
- package/mcp-docs/mobile/components/SpotIcon.txt +47 -0
- package/mcp-docs/mobile/components/SpotRectangle.txt +47 -0
- package/mcp-docs/mobile/components/SpotSquare.txt +47 -0
- package/mcp-docs/mobile/components/Stepper.txt +527 -0
- package/mcp-docs/mobile/components/SubBrandLogoMark.txt +125 -0
- package/mcp-docs/mobile/components/SubBrandLogoWordMark.txt +125 -0
- package/mcp-docs/mobile/components/Switch.txt +97 -0
- package/mcp-docs/mobile/components/TabIndicator.txt +48 -0
- package/mcp-docs/mobile/components/TabLabel.txt +153 -0
- package/mcp-docs/mobile/components/TabNavigation.txt +146 -0
- package/mcp-docs/mobile/components/TabbedChips.txt +142 -0
- package/mcp-docs/mobile/components/Tabs.txt +190 -0
- package/mcp-docs/mobile/components/Tag.txt +300 -0
- package/mcp-docs/mobile/components/Text.txt +211 -0
- package/mcp-docs/mobile/components/TextInput.txt +717 -0
- package/mcp-docs/mobile/components/ThemeProvider.txt +132 -0
- package/mcp-docs/mobile/components/Toast.txt +196 -0
- package/mcp-docs/mobile/components/Tooltip.txt +59 -0
- package/mcp-docs/mobile/components/TopNavBar.txt +161 -0
- package/mcp-docs/mobile/components/Tour.txt +158 -0
- package/mcp-docs/mobile/components/Tray.txt +252 -0
- package/mcp-docs/mobile/components/UpsellCard.txt +321 -0
- package/mcp-docs/mobile/components/VStack.txt +222 -0
- package/mcp-docs/mobile/components/XAxis.txt +621 -0
- package/mcp-docs/mobile/components/YAxis.txt +567 -0
- package/mcp-docs/mobile/getting-started/ai-overview.txt +108 -0
- package/mcp-docs/mobile/getting-started/installation.txt +57 -0
- package/mcp-docs/mobile/getting-started/introduction.txt +102 -0
- package/mcp-docs/mobile/getting-started/playground.txt +28 -0
- package/mcp-docs/mobile/getting-started/styling.txt +84 -0
- package/mcp-docs/mobile/getting-started/theming.txt +286 -0
- package/mcp-docs/mobile/hooks/useDimensions.txt +72 -0
- package/mcp-docs/mobile/hooks/useEventHandler.txt +120 -0
- package/mcp-docs/mobile/hooks/useMergeRefs.txt +116 -0
- package/mcp-docs/mobile/hooks/useOverlayContentContext.txt +280 -0
- package/mcp-docs/mobile/hooks/usePreviousValue.txt +74 -0
- package/mcp-docs/mobile/hooks/useRefMap.txt +178 -0
- package/mcp-docs/mobile/hooks/useTheme.txt +321 -0
- package/mcp-docs/mobile/routes.txt +139 -0
- package/mcp-docs/web/components/Accordion.txt +189 -0
- package/mcp-docs/web/components/AccordionItem.txt +31 -0
- package/mcp-docs/web/components/Alert.txt +164 -0
- package/mcp-docs/web/components/AreaChart.txt +510 -0
- package/mcp-docs/web/components/Avatar.txt +211 -0
- package/mcp-docs/web/components/AvatarButton.txt +240 -0
- package/mcp-docs/web/components/Banner.txt +226 -0
- package/mcp-docs/web/components/BarChart.txt +1267 -0
- package/mcp-docs/web/components/Box.txt +175 -0
- package/mcp-docs/web/components/Button.txt +212 -0
- package/mcp-docs/web/components/ButtonGroup.txt +79 -0
- package/mcp-docs/web/components/Calendar.txt +181 -0
- package/mcp-docs/web/components/Carousel.txt +1575 -0
- package/mcp-docs/web/components/CartesianChart.txt +1044 -0
- package/mcp-docs/web/components/CellMedia.txt +56 -0
- package/mcp-docs/web/components/Checkbox.txt +188 -0
- package/mcp-docs/web/components/CheckboxCell.txt +202 -0
- package/mcp-docs/web/components/CheckboxGroup.txt +219 -0
- package/mcp-docs/web/components/Chip.txt +196 -0
- package/mcp-docs/web/components/Coachmark.txt +188 -0
- package/mcp-docs/web/components/Collapsible.txt +119 -0
- package/mcp-docs/web/components/ContainedAssetCard.txt +232 -0
- package/mcp-docs/web/components/ContentCard.txt +367 -0
- package/mcp-docs/web/components/ContentCardBody.txt +137 -0
- package/mcp-docs/web/components/ContentCardFooter.txt +129 -0
- package/mcp-docs/web/components/ContentCardHeader.txt +147 -0
- package/mcp-docs/web/components/ContentCell.txt +219 -0
- package/mcp-docs/web/components/ControlGroup.txt +436 -0
- package/mcp-docs/web/components/DatePicker.txt +505 -0
- package/mcp-docs/web/components/Divider.txt +143 -0
- package/mcp-docs/web/components/DotCount.txt +149 -0
- package/mcp-docs/web/components/DotStatusColor.txt +58 -0
- package/mcp-docs/web/components/DotSymbol.txt +137 -0
- package/mcp-docs/web/components/Dropdown.txt +119 -0
- package/mcp-docs/web/components/Fallback.txt +163 -0
- package/mcp-docs/web/components/FloatingAssetCard.txt +250 -0
- package/mcp-docs/web/components/FullscreenAlert.txt +69 -0
- package/mcp-docs/web/components/FullscreenModal.txt +145 -0
- package/mcp-docs/web/components/FullscreenModalLayout.txt +187 -0
- package/mcp-docs/web/components/Grid.txt +236 -0
- package/mcp-docs/web/components/GridColumn.txt +209 -0
- package/mcp-docs/web/components/HStack.txt +236 -0
- package/mcp-docs/web/components/HeroSquare.txt +48 -0
- package/mcp-docs/web/components/Icon.txt +145 -0
- package/mcp-docs/web/components/IconButton.txt +390 -0
- package/mcp-docs/web/components/InputChip.txt +187 -0
- package/mcp-docs/web/components/Interactable.txt +193 -0
- package/mcp-docs/web/components/LineChart.txt +1576 -0
- package/mcp-docs/web/components/Link.txt +243 -0
- package/mcp-docs/web/components/ListCell.txt +418 -0
- package/mcp-docs/web/components/LogoMark.txt +84 -0
- package/mcp-docs/web/components/LogoWordMark.txt +93 -0
- package/mcp-docs/web/components/Lottie.txt +157 -0
- package/mcp-docs/web/components/LottieStatusAnimation.txt +57 -0
- package/mcp-docs/web/components/MediaQueryProvider.txt +108 -0
- package/mcp-docs/web/components/Modal.txt +196 -0
- package/mcp-docs/web/components/ModalBody.txt +117 -0
- package/mcp-docs/web/components/ModalFooter.txt +119 -0
- package/mcp-docs/web/components/ModalHeader.txt +123 -0
- package/mcp-docs/web/components/MultiContentModule.txt +381 -0
- package/mcp-docs/web/components/NavigationBar.txt +102 -0
- package/mcp-docs/web/components/NavigationTitle.txt +25 -0
- package/mcp-docs/web/components/NavigationTitleSelect.txt +45 -0
- package/mcp-docs/web/components/NudgeCard.txt +181 -0
- package/mcp-docs/web/components/Overlay.txt +171 -0
- package/mcp-docs/web/components/PageFooter.txt +184 -0
- package/mcp-docs/web/components/PageHeader.txt +243 -0
- package/mcp-docs/web/components/Pagination.txt +499 -0
- package/mcp-docs/web/components/PeriodSelector.txt +703 -0
- package/mcp-docs/web/components/Pictogram.txt +48 -0
- package/mcp-docs/web/components/Point.txt +460 -0
- package/mcp-docs/web/components/PortalProvider.txt +76 -0
- package/mcp-docs/web/components/Pressable.txt +193 -0
- package/mcp-docs/web/components/ProgressBar.txt +163 -0
- package/mcp-docs/web/components/ProgressBarWithFixedLabels.txt +212 -0
- package/mcp-docs/web/components/ProgressBarWithFloatLabel.txt +181 -0
- package/mcp-docs/web/components/ProgressCircle.txt +443 -0
- package/mcp-docs/web/components/Radio.txt +219 -0
- package/mcp-docs/web/components/RadioCell.txt +215 -0
- package/mcp-docs/web/components/RadioGroup.txt +288 -0
- package/mcp-docs/web/components/ReferenceLine.txt +451 -0
- package/mcp-docs/web/components/RemoteImage.txt +165 -0
- package/mcp-docs/web/components/RemoteImageGroup.txt +86 -0
- package/mcp-docs/web/components/RollingNumber.txt +1021 -0
- package/mcp-docs/web/components/Scrubber.txt +231 -0
- package/mcp-docs/web/components/SearchInput.txt +117 -0
- package/mcp-docs/web/components/SectionHeader.txt +217 -0
- package/mcp-docs/web/components/SegmentedTabs.txt +324 -0
- package/mcp-docs/web/components/Select.txt +224 -0
- package/mcp-docs/web/components/SelectChip.txt +314 -0
- package/mcp-docs/web/components/SelectOption.txt +165 -0
- package/mcp-docs/web/components/Sidebar.txt +349 -0
- package/mcp-docs/web/components/SidebarItem.txt +131 -0
- package/mcp-docs/web/components/SidebarMoreMenu.txt +30 -0
- package/mcp-docs/web/components/Spacer.txt +173 -0
- package/mcp-docs/web/components/Sparkline.txt +122 -0
- package/mcp-docs/web/components/SparklineGradient.txt +106 -0
- package/mcp-docs/web/components/SparklineInteractive.txt +153 -0
- package/mcp-docs/web/components/SparklineInteractiveHeader.txt +76 -0
- package/mcp-docs/web/components/Spinner.txt +128 -0
- package/mcp-docs/web/components/SpotIcon.txt +48 -0
- package/mcp-docs/web/components/SpotRectangle.txt +48 -0
- package/mcp-docs/web/components/SpotSquare.txt +48 -0
- package/mcp-docs/web/components/Stepper.txt +682 -0
- package/mcp-docs/web/components/SubBrandLogoMark.txt +125 -0
- package/mcp-docs/web/components/SubBrandLogoWordMark.txt +125 -0
- package/mcp-docs/web/components/Switch.txt +85 -0
- package/mcp-docs/web/components/TabIndicator.txt +48 -0
- package/mcp-docs/web/components/TabLabel.txt +158 -0
- package/mcp-docs/web/components/TabNavigation.txt +159 -0
- package/mcp-docs/web/components/TabbedChips.txt +155 -0
- package/mcp-docs/web/components/Table.txt +367 -0
- package/mcp-docs/web/components/TableBody.txt +83 -0
- package/mcp-docs/web/components/TableCaption.txt +102 -0
- package/mcp-docs/web/components/TableCell.txt +165 -0
- package/mcp-docs/web/components/TableCellFallback.txt +97 -0
- package/mcp-docs/web/components/TableFooter.txt +83 -0
- package/mcp-docs/web/components/TableHeader.txt +100 -0
- package/mcp-docs/web/components/TableRow.txt +140 -0
- package/mcp-docs/web/components/Tabs.txt +212 -0
- package/mcp-docs/web/components/Tag.txt +304 -0
- package/mcp-docs/web/components/Text.txt +232 -0
- package/mcp-docs/web/components/TextInput.txt +652 -0
- package/mcp-docs/web/components/ThemeProvider.txt +199 -0
- package/mcp-docs/web/components/TileButton.txt +158 -0
- package/mcp-docs/web/components/Toast.txt +203 -0
- package/mcp-docs/web/components/Tooltip.txt +89 -0
- package/mcp-docs/web/components/Tour.txt +179 -0
- package/mcp-docs/web/components/Tray.txt +288 -0
- package/mcp-docs/web/components/UpsellCard.txt +319 -0
- package/mcp-docs/web/components/VStack.txt +224 -0
- package/mcp-docs/web/components/XAxis.txt +619 -0
- package/mcp-docs/web/components/YAxis.txt +548 -0
- package/mcp-docs/web/getting-started/ai-overview.txt +108 -0
- package/mcp-docs/web/getting-started/installation.txt +103 -0
- package/mcp-docs/web/getting-started/introduction.txt +102 -0
- package/mcp-docs/web/getting-started/playground.txt +28 -0
- package/mcp-docs/web/getting-started/styling.txt +161 -0
- package/mcp-docs/web/getting-started/templates.txt +121 -0
- package/mcp-docs/web/getting-started/theming.txt +426 -0
- package/mcp-docs/web/hooks/useBreakpoints.txt +61 -0
- package/mcp-docs/web/hooks/useDimensions.txt +114 -0
- package/mcp-docs/web/hooks/useEventHandler.txt +120 -0
- package/mcp-docs/web/hooks/useHasMounted.txt +75 -0
- package/mcp-docs/web/hooks/useIsoEffect.txt +58 -0
- package/mcp-docs/web/hooks/useMediaQuery.txt +114 -0
- package/mcp-docs/web/hooks/useMergeRefs.txt +116 -0
- package/mcp-docs/web/hooks/useOverlayContentContext.txt +279 -0
- package/mcp-docs/web/hooks/usePreviousValue.txt +74 -0
- package/mcp-docs/web/hooks/useRefMap.txt +178 -0
- package/mcp-docs/web/hooks/useScrollBlocker.txt +82 -0
- package/mcp-docs/web/hooks/useTheme.txt +364 -0
- package/mcp-docs/web/routes.txt +163 -0
- package/package.json +1 -1
|
@@ -0,0 +1,717 @@
|
|
|
1
|
+
# TextInput
|
|
2
|
+
|
|
3
|
+
A control for entering text.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { TextInput } from '@coinbase/cds-mobile/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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
193
|
+
<VStack gap={3}>
|
|
194
|
+
<VStack>
|
|
195
|
+
<Text as="p">
|
|
196
|
+
<strong>Left aligned: </strong>This is the default setting.
|
|
197
|
+
</Text>
|
|
198
|
+
<TextInput label="City/town" placeholder="Oakland" />
|
|
199
|
+
</VStack>
|
|
200
|
+
|
|
201
|
+
<VStack>
|
|
202
|
+
<Text as="p">Right aligned Used 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
|
+
#### StartContent & EndContent
|
|
217
|
+
|
|
218
|
+
##### Examples of Input Objects placed at the Start
|
|
219
|
+
|
|
220
|
+
```jsx
|
|
221
|
+
function StartContentExamples() {
|
|
222
|
+
return (
|
|
223
|
+
<VStack gap={3}>
|
|
224
|
+
<VStack>
|
|
225
|
+
<Text as="p">
|
|
226
|
+
<strong>Asset</strong>: Asset objects are not interactive
|
|
227
|
+
</Text>
|
|
228
|
+
<TextInput
|
|
229
|
+
label="Address"
|
|
230
|
+
start={
|
|
231
|
+
<Box paddingX={2}>
|
|
232
|
+
<Avatar
|
|
233
|
+
size="l"
|
|
234
|
+
src="https://dynamic-assets.coinbase.com/e785e0181f1a23a30d9476038d9be91e9f6c63959b538eabbc51a1abc8898940383291eede695c3b8dfaa1829a9b57f5a2d0a16b0523580346c6b8fab67af14b/asset_icons/b57ac673f06a4b0338a596817eb0a50ce16e2059f327dc117744449a47915cb2.png"
|
|
235
|
+
alt="address"
|
|
236
|
+
/>
|
|
237
|
+
</Box>
|
|
238
|
+
}
|
|
239
|
+
placeholder="HaeJiWplJohn6W42eCq0Qqft0"
|
|
240
|
+
/>
|
|
241
|
+
</VStack>
|
|
242
|
+
|
|
243
|
+
<VStack>
|
|
244
|
+
<Text as="p">
|
|
245
|
+
<strong>Icon</strong>: Icon objects are not interactive.
|
|
246
|
+
</Text>
|
|
247
|
+
<TextInput label="Amount" start={<InputIcon name="cashUSD" />} placeholder="1234" />
|
|
248
|
+
</VStack>
|
|
249
|
+
|
|
250
|
+
<VStack>
|
|
251
|
+
<Text as="p">
|
|
252
|
+
<strong>IconButton</strong>: The most common use case for Icon Button at the start of a
|
|
253
|
+
Text Field is search.
|
|
254
|
+
</Text>
|
|
255
|
+
<TextInput
|
|
256
|
+
label="Search"
|
|
257
|
+
start={<InputIconButton name="search" />}
|
|
258
|
+
placeholder="Search for anything"
|
|
259
|
+
/>
|
|
260
|
+
</VStack>
|
|
261
|
+
</VStack>
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
#### Read only
|
|
267
|
+
|
|
268
|
+
```jsx
|
|
269
|
+
<VStack gap={3}>
|
|
270
|
+
<TextInput label="Read Only Input" readOnly value="This value cannot be edited" />
|
|
271
|
+
<TextInput label="Read Only with Suffix" readOnly value="1234.56" suffix="USD" />
|
|
272
|
+
<TextInput
|
|
273
|
+
label="Read Only with Start Content"
|
|
274
|
+
readOnly
|
|
275
|
+
value="BTC Address"
|
|
276
|
+
start={<InputIconButton name="search" />}
|
|
277
|
+
/>
|
|
278
|
+
</VStack>
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
#### Label Variants
|
|
282
|
+
|
|
283
|
+
TextInput supports two label variants: `outside` (default) and `inside`. Note that the `compact` prop, when set to true, will override label variant preference.
|
|
284
|
+
|
|
285
|
+
:::warning
|
|
286
|
+
|
|
287
|
+
When using the `inside` label variant, you should always include a `placeholder` prop.
|
|
288
|
+
|
|
289
|
+
:::
|
|
290
|
+
|
|
291
|
+
##### Outside label (default)
|
|
292
|
+
|
|
293
|
+
```jsx
|
|
294
|
+
<TextInput label="Email Address" placeholder="Enter your email" />
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
##### Inside label
|
|
298
|
+
|
|
299
|
+
```jsx
|
|
300
|
+
<TextInput label="Email Address" labelVariant="inside" placeholder="Enter your email" />
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
##### Inside label (with start content)
|
|
304
|
+
|
|
305
|
+
```jsx
|
|
306
|
+
<TextInput
|
|
307
|
+
label="Search"
|
|
308
|
+
labelVariant="inside"
|
|
309
|
+
start={<InputIconButton name="search" />}
|
|
310
|
+
placeholder="Search for anything"
|
|
311
|
+
/>
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
##### Inside label (with end content)
|
|
315
|
+
|
|
316
|
+
```jsx
|
|
317
|
+
<TextInput
|
|
318
|
+
label="Password"
|
|
319
|
+
labelVariant="inside"
|
|
320
|
+
secureTextEntry
|
|
321
|
+
end={<InputIconButton name="visibleInactive" />}
|
|
322
|
+
placeholder="Enter your password"
|
|
323
|
+
/>
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### Example of Input Objects placed at the End
|
|
327
|
+
|
|
328
|
+
Here are some examples and best practices when using end content in a TextField.
|
|
329
|
+
|
|
330
|
+
```jsx
|
|
331
|
+
<VStack gap={3}>
|
|
332
|
+
<VStack>
|
|
333
|
+
<Text as="p">
|
|
334
|
+
<strong>Icon</strong>: Icon objects are not interactive.
|
|
335
|
+
</Text>
|
|
336
|
+
<TextInput
|
|
337
|
+
label="Address"
|
|
338
|
+
placeholder="1234 Abc Way"
|
|
339
|
+
end={<InputIcon name="checkmark" color="fgPositive" />}
|
|
340
|
+
/>
|
|
341
|
+
</VStack>
|
|
342
|
+
|
|
343
|
+
<VStack>
|
|
344
|
+
<Text as="p">
|
|
345
|
+
The most common use case for placing a text object at the end of an input is currency. This
|
|
346
|
+
object is not interactive.
|
|
347
|
+
</Text>
|
|
348
|
+
<TextInput
|
|
349
|
+
label="Amount"
|
|
350
|
+
type="number"
|
|
351
|
+
step="0.01"
|
|
352
|
+
compact
|
|
353
|
+
placeholder="98329.23"
|
|
354
|
+
suffix="USD"
|
|
355
|
+
/>
|
|
356
|
+
</VStack>
|
|
357
|
+
|
|
358
|
+
<VStack>
|
|
359
|
+
<Text as="p">
|
|
360
|
+
You can add a Text Button object at the end of an Input. "Copy" is a great example of this.
|
|
361
|
+
</Text>
|
|
362
|
+
<TextInput
|
|
363
|
+
label="API Access Token"
|
|
364
|
+
placeholder="HaeJiWplJohn6W42eCq0Qqft0"
|
|
365
|
+
end={
|
|
366
|
+
<Box spacingEnd={2}>
|
|
367
|
+
<Link variant="caption" color="primary" to="">
|
|
368
|
+
COPY
|
|
369
|
+
</Link>
|
|
370
|
+
</Box>
|
|
371
|
+
}
|
|
372
|
+
/>
|
|
373
|
+
</VStack>
|
|
374
|
+
</VStack>
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
#### Password input
|
|
378
|
+
|
|
379
|
+
Password Input - Use Icon Buttons at the end for actions like showing a password or clearing text from an input.
|
|
380
|
+
|
|
381
|
+
> a11y tip: Always provide an `accessibilityLabel` to start/end nodes to clearly communicate state/actions
|
|
382
|
+
|
|
383
|
+
```jsx
|
|
384
|
+
function PasswordInput() {
|
|
385
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
386
|
+
const type = useMemo(() => (isVisible ? 'text' : 'password'), [isVisible]);
|
|
387
|
+
|
|
388
|
+
return (
|
|
389
|
+
<TextInput
|
|
390
|
+
label="Password"
|
|
391
|
+
type={type}
|
|
392
|
+
end={
|
|
393
|
+
<InputIconButton
|
|
394
|
+
name={isVisible ? 'visibleActive' : 'visibleInactive'}
|
|
395
|
+
onPress={() => setIsVisible((isVisible) => !setIsVisible)}
|
|
396
|
+
accessibilityLabel={isVisible ? 'Hide password' : 'Show password'}
|
|
397
|
+
/>
|
|
398
|
+
}
|
|
399
|
+
/>
|
|
400
|
+
);
|
|
401
|
+
}
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
#### Link + Icon Button
|
|
405
|
+
|
|
406
|
+
If needed, you can add a Link + Icon Button like this example here. Use this sparingly and only at the End of an Input.
|
|
407
|
+
|
|
408
|
+
```jsx
|
|
409
|
+
function CopyTextField() {
|
|
410
|
+
const [copied, setCopied] = useState(false);
|
|
411
|
+
const [variant, setVariant] = useState('foregroundMuted');
|
|
412
|
+
const [helperText, setHelperText] = useState('');
|
|
413
|
+
|
|
414
|
+
useEffect(() => {
|
|
415
|
+
if (copied) {
|
|
416
|
+
setVariant('positive');
|
|
417
|
+
setHelperText('Your token has been copied!');
|
|
418
|
+
} else {
|
|
419
|
+
setVariant('foregroundMuted');
|
|
420
|
+
setHelperText('');
|
|
421
|
+
}
|
|
422
|
+
}, [copied]);
|
|
423
|
+
|
|
424
|
+
const handleOnChange = useCallback(() => {
|
|
425
|
+
setVariant('foregroundMuted');
|
|
426
|
+
setCopied(false);
|
|
427
|
+
setHelperText('');
|
|
428
|
+
}, []);
|
|
429
|
+
|
|
430
|
+
return (
|
|
431
|
+
<TextInput
|
|
432
|
+
end={
|
|
433
|
+
<HStack>
|
|
434
|
+
<Link onPress={() => setCopied(true)} variant="caption" color={variant}>
|
|
435
|
+
{copied ? 'copied' : 'copy'}
|
|
436
|
+
</Link>
|
|
437
|
+
<InputIcon active color="primary" name="visible" />
|
|
438
|
+
</HStack>
|
|
439
|
+
}
|
|
440
|
+
onChange={handleOnChange}
|
|
441
|
+
variant={variant}
|
|
442
|
+
helperText={helperText}
|
|
443
|
+
label="API Access Token"
|
|
444
|
+
/>
|
|
445
|
+
);
|
|
446
|
+
}
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
#### Disabled
|
|
450
|
+
|
|
451
|
+
```jsx
|
|
452
|
+
<VStack gap={3}>
|
|
453
|
+
<TextInput label="Label" disabled />
|
|
454
|
+
<TextInput label="Label" compact disabled />
|
|
455
|
+
</VStack>
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
#### TextArea Example (mobile)
|
|
459
|
+
|
|
460
|
+
On mobile, TextInput is versatile enough to support
|
|
461
|
+
a "TextArea" as well. You just need to add multiline prop.
|
|
462
|
+
Here is an example
|
|
463
|
+
|
|
464
|
+
```jsx
|
|
465
|
+
const [text, onChangeText] = useState('');
|
|
466
|
+
|
|
467
|
+
<MockTextInput
|
|
468
|
+
onChangeText={onChangeText}
|
|
469
|
+
value={text}
|
|
470
|
+
label="Textarea"
|
|
471
|
+
helperText="Write about yourself"
|
|
472
|
+
variant="foregroundMuted"
|
|
473
|
+
multiline
|
|
474
|
+
value="
|
|
475
|
+
A really really really really
|
|
476
|
+
long piece
|
|
477
|
+
of text
|
|
478
|
+
displayed. A really really really really
|
|
479
|
+
long piece
|
|
480
|
+
of text
|
|
481
|
+
displayed.
|
|
482
|
+
A really really really really
|
|
483
|
+
long piece
|
|
484
|
+
of text
|
|
485
|
+
displayed
|
|
486
|
+
"
|
|
487
|
+
/>;
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
#### Example of a Form
|
|
491
|
+
|
|
492
|
+
We recommend that you use spacing 3 when building stacked forms.
|
|
493
|
+
|
|
494
|
+
```jsx
|
|
495
|
+
function FormExample() {
|
|
496
|
+
const gap = 3;
|
|
497
|
+
|
|
498
|
+
const onSubmit = useCallback((e) => {
|
|
499
|
+
e.preventDefault();
|
|
500
|
+
console.log(e.currentTarget.nodeValue);
|
|
501
|
+
alert('Submitted');
|
|
502
|
+
}, []);
|
|
503
|
+
|
|
504
|
+
return (
|
|
505
|
+
<form onSubmit={onSubmit} action={undefined}>
|
|
506
|
+
<VStack gap={gap}>
|
|
507
|
+
<TextInput
|
|
508
|
+
label="Street address"
|
|
509
|
+
placeholder="4321 Jade Palace"
|
|
510
|
+
helperText="Please enter your primary address."
|
|
511
|
+
/>
|
|
512
|
+
<TextInput label="Unit #" aria-required="true" />
|
|
513
|
+
<HStack gap={gap}>
|
|
514
|
+
<TextInput label="City/town" width="70%" />
|
|
515
|
+
<TextInput label="State" width="30%" />
|
|
516
|
+
</HStack>
|
|
517
|
+
<HStack gap={gap}>
|
|
518
|
+
<TextInput label="Postal code" width="40%" />
|
|
519
|
+
<TextInput label="Country" width="60%" />
|
|
520
|
+
</HStack>
|
|
521
|
+
<ButtonGroup>
|
|
522
|
+
<Button type="submit">Save</Button>
|
|
523
|
+
</ButtonGroup>
|
|
524
|
+
</VStack>
|
|
525
|
+
</form>
|
|
526
|
+
);
|
|
527
|
+
}
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
#### Example of a Sign Up Form
|
|
531
|
+
|
|
532
|
+
```jsx
|
|
533
|
+
<HStack gap={2} alignItems="center">
|
|
534
|
+
<TextInput
|
|
535
|
+
label="Email"
|
|
536
|
+
placeholder="satoshi@nakamoto.com"
|
|
537
|
+
helperText="Please enter a valid email address"
|
|
538
|
+
/>
|
|
539
|
+
<Box spacingTop={0.5}>
|
|
540
|
+
<Button variant="primary">Submit</Button>
|
|
541
|
+
</Box>
|
|
542
|
+
</HStack>
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
### Testing
|
|
546
|
+
|
|
547
|
+
#### Testing different parts of the input
|
|
548
|
+
|
|
549
|
+
You can also use the testIDMap to test different parts
|
|
550
|
+
of the TextInput. If you use testID, it will add the testID to the root
|
|
551
|
+
of the TextInput.
|
|
552
|
+
|
|
553
|
+
```jsx
|
|
554
|
+
function testExample() {
|
|
555
|
+
const testIDMap = useMemo(() => {
|
|
556
|
+
return {
|
|
557
|
+
input: 'input-id',
|
|
558
|
+
helperText: 'helperText-id',
|
|
559
|
+
label: 'label-id',
|
|
560
|
+
start: 'start-id',
|
|
561
|
+
end: 'end-id',
|
|
562
|
+
};
|
|
563
|
+
}, []);
|
|
564
|
+
return (
|
|
565
|
+
<TextInput
|
|
566
|
+
label="Email"
|
|
567
|
+
placeholder="satoshi@nakamoto.com"
|
|
568
|
+
helperText="Please enter a valid email address"
|
|
569
|
+
testIDMap={testIDMap}
|
|
570
|
+
start={
|
|
571
|
+
<Box paddingX={2}>
|
|
572
|
+
<Avatar
|
|
573
|
+
size="l"
|
|
574
|
+
src="https://dynamic-assets.coinbase.com/e785e0181f1a23a30d9476038d9be91e9f6c63959b538eabbc51a1abc8898940383291eede695c3b8dfaa1829a9b57f5a2d0a16b0523580346c6b8fab67af14b/asset_icons/b57ac673f06a4b0338a596817eb0a50ce16e2059f327dc117744449a47915cb2.png"
|
|
575
|
+
alt="address"
|
|
576
|
+
/>
|
|
577
|
+
</Box>
|
|
578
|
+
}
|
|
579
|
+
end={<InputIcon active color="primary" name="visible" />}
|
|
580
|
+
/>
|
|
581
|
+
);
|
|
582
|
+
}
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
### Date Picker Example
|
|
586
|
+
|
|
587
|
+
You can construct a DatePicker using TextInput
|
|
588
|
+
|
|
589
|
+
```jsx
|
|
590
|
+
function DatePicker() {
|
|
591
|
+
return <TextInput label="Pick a date" type="date" />;
|
|
592
|
+
}
|
|
593
|
+
```
|
|
594
|
+
|
|
595
|
+
### TextInput While Keyboard Is Open (mobile)
|
|
596
|
+
|
|
597
|
+
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.
|
|
598
|
+
|
|
599
|
+
To fix this issue, you can wrap the TextInput in a ScrollView, and set keyboardShouldPersistTaps="always".
|
|
600
|
+
|
|
601
|
+
```jsx
|
|
602
|
+
function TextInputKeyboardExample() {
|
|
603
|
+
return (
|
|
604
|
+
<ScrollView style={{ height: '100%' }} keyboardShouldPersistTaps="always">
|
|
605
|
+
<TextInput label="Amount" type="number" compact placeholder="98329.23" suffix="USD" />
|
|
606
|
+
</ScrollView>
|
|
607
|
+
);
|
|
608
|
+
}
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
## Props
|
|
612
|
+
|
|
613
|
+
| Prop | Type | Required | Default | Description |
|
|
614
|
+
| --- | --- | --- | --- | --- |
|
|
615
|
+
| `align` | `end \| start \| center \| justify` | No | `start` | Aligns text inside input and helperText |
|
|
616
|
+
| `allowFontScaling` | `boolean` | No | `-` | Specifies whether fonts should scale to respect Text Size accessibility settings. The default is true. |
|
|
617
|
+
| `autoCapitalize` | `none \| sentences \| words \| characters` | No | `-` | Can tell TextInput to automatically capitalize certain characters. characters: all characters, words: first letter of each word sentences: first letter of each sentence (default) none: dont auto capitalize anything https://reactnative.dev/docs/textinput#autocapitalize |
|
|
618
|
+
| `autoComplete` | `email \| off \| name \| additional-name \| address-line1 \| address-line2 \| birthdate-day \| birthdate-full \| birthdate-month \| birthdate-year \| cc-csc \| cc-exp \| cc-exp-day \| cc-exp-month \| cc-exp-year \| cc-number \| cc-name \| cc-given-name \| cc-middle-name \| cc-family-name \| cc-type \| country \| current-password \| family-name \| gender \| given-name \| honorific-prefix \| honorific-suffix \| name-family \| name-given \| name-middle \| name-middle-initial \| name-prefix \| name-suffix \| new-password \| nickname \| one-time-code \| organization \| organization-title \| password \| password-new \| postal-address \| postal-address-country \| postal-address-extended \| postal-address-extended-postal-code \| postal-address-locality \| postal-address-region \| postal-code \| street-address \| sms-otp \| tel \| tel-country-code \| tel-national \| tel-device \| url \| username \| username-new` | No | `-` | Specifies autocomplete hints for the system, so it can provide autofill. On Android, the system will always attempt to offer autofill by using heuristics to identify the type of content. To disable autocomplete, set autoComplete to off. The following values work across platforms: - additional-name - address-line1 - address-line2 - cc-number - country - current-password - email - family-name - given-name - honorific-prefix - honorific-suffix - name - new-password - off - one-time-code - postal-code - street-address - tel - username The following values work on iOS only: - nickname - organization - organization-title - url The following values work on Android only: - birthdate-day - birthdate-full - birthdate-month - birthdate-year - cc-csc - cc-exp - cc-exp-day - cc-exp-month - cc-exp-year - gender - name-family - name-given - name-middle - name-middle-initial - name-prefix - name-suffix - password - password-new - postal-address - postal-address-country - postal-address-extended - postal-address-extended-postal-code - postal-address-locality - postal-address-region - sms-otp - tel-country-code - tel-national - tel-device - username-new |
|
|
619
|
+
| `autoCorrect` | `boolean` | No | `-` | If false, disables auto-correct. The default value is true. |
|
|
620
|
+
| `autoFocus` | `boolean` | No | `-` | If true, focuses the input on componentDidMount. The default value is false. |
|
|
621
|
+
| `blurOnSubmit` | `boolean` | No | `-` | If true, the text field will blur when submitted. The default value is true. |
|
|
622
|
+
| `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. |
|
|
623
|
+
| `bordered` | `boolean` | No | `true` | Determines if the input should have a border |
|
|
624
|
+
| `caretHidden` | `boolean` | No | `-` | If true, caret is hidden. The default value is false. |
|
|
625
|
+
| `clearButtonMode` | `never \| while-editing \| unless-editing \| always` | No | `-` | enum(never, while-editing, unless-editing, always) When the clear button should appear on the right side of the text view |
|
|
626
|
+
| `clearTextOnFocus` | `boolean` | No | `-` | If true, clears the text field automatically when editing begins |
|
|
627
|
+
| `compact` | `boolean` | No | `false` | Enables compact variation |
|
|
628
|
+
| `contextMenuHidden` | `boolean` | No | `-` | If true, context menu is hidden. The default value is false. |
|
|
629
|
+
| `cursorColor` | `ColorValue \| null` | No | `-` | When provided it will set the color of the cursor (or caret) in the component. Unlike the behavior of selectionColor the cursor color will be set independently from the color of the text selection box. |
|
|
630
|
+
| `dataDetectorTypes` | `DataDetectorTypes \| DataDetectorTypes[]` | No | `-` | Determines the types of data converted to clickable URLs in the text input. Only valid if multiline={true} and editable={false}. By default no data types are detected. You can provide one type or an array of many types. Possible values for dataDetectorTypes are: - phoneNumber - link - address - calendarEvent - none - all |
|
|
631
|
+
| `defaultValue` | `string` | No | `-` | Provides an initial value that will change when the user starts typing. Useful for simple use-cases where you dont want to deal with listening to events and updating the value prop to keep the controlled state in sync. |
|
|
632
|
+
| `disableFullscreenUI` | `boolean` | No | `-` | When false, if there is a small amount of space available around a text input (e.g. landscape orientation on a phone), the OS may choose to have the user edit the text inside of a full screen text input mode. When true, this feature is disabled and users will always edit the text directly inside of the text input. Defaults to false. |
|
|
633
|
+
| `disabled` | `boolean` | No | `false` | Toggles input interactability and opacity |
|
|
634
|
+
| `editable` | `boolean` | No | `-` | If false, text is not editable. The default value is true. |
|
|
635
|
+
| `enableColorSurge` | `boolean` | No | `-` | Enable Color Surge motion |
|
|
636
|
+
| `enablesReturnKeyAutomatically` | `boolean` | No | `-` | If true, the keyboard disables the return key when there is no text and automatically enables it when there is text. The default value is false. |
|
|
637
|
+
| `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 |
|
|
638
|
+
| `enterKeyHint` | `search \| done \| go \| next \| send \| previous \| enter` | No | `-` | Determines what text should be shown to the return key on virtual keyboards. Has precedence over the returnKeyType prop. |
|
|
639
|
+
| `height` | `string \| number` | No | `-` | Height of input |
|
|
640
|
+
| `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 |
|
|
641
|
+
| `helperTextErrorIconAccessibilityLabel` | `string` | No | `'error'` | Accessibility label for helper text error icon when variant=negative |
|
|
642
|
+
| `importantForAutofill` | `auto \| yes \| no \| noExcludeDescendants \| yesExcludeDescendants` | No | `-` | Determines whether the individual fields in your app should be included in a view structure for autofill purposes on Android API Level 26+. Defaults to auto. To disable auto complete, use off. *Android Only* The following values work on Android only: - auto - let Android decide - no - not important for autofill - noExcludeDescendants - this view and its children arent important for autofill - yes - is important for autofill - yesExcludeDescendants - this view is important for autofill but its children arent |
|
|
643
|
+
| `inlineImageLeft` | `string` | No | `-` | If defined, the provided image resource will be rendered on the left. |
|
|
644
|
+
| `inlineImagePadding` | `number` | No | `-` | Padding between the inline image, if any, and the text input itself. |
|
|
645
|
+
| `inputAccessoryViewID` | `string` | No | `-` | Used to connect to an InputAccessoryView. Not part of react-natives documentation, but present in examples and code. See https://reactnative.dev/docs/inputaccessoryview for more information. |
|
|
646
|
+
| `inputMode` | `search \| none \| text \| email \| tel \| url \| numeric \| decimal` | No | `-` | Works like the inputmode attribute in HTML, it determines which keyboard to open, e.g. numeric and has precedence over keyboardType. |
|
|
647
|
+
| `key` | `Key \| null` | No | `-` | - |
|
|
648
|
+
| `keyboardAppearance` | `light \| default \| dark` | No | `-` | Determines the color of the keyboard. |
|
|
649
|
+
| `keyboardType` | `default \| url \| number-pad \| decimal-pad \| numeric \| email-address \| phone-pad \| visible-password \| ascii-capable \| numbers-and-punctuation \| name-phone-pad \| twitter \| web-search` | No | `-` | enum(default, numeric, email-address, ascii-capable, numbers-and-punctuation, url, number-pad, phone-pad, name-phone-pad, decimal-pad, twitter, web-search, visible-password) Determines which keyboard to open, e.g.numeric. The following values work across platforms: - default - numeric - email-address - phone-pad The following values work on iOS: - ascii-capable - numbers-and-punctuation - url - number-pad - name-phone-pad - decimal-pad - twitter - web-search The following values work on Android: - visible-password |
|
|
650
|
+
| `label` | `string` | No | `-` | Short messageArea indicating purpose of input |
|
|
651
|
+
| `labelVariant` | `inside \| outside` | No | `'outside'` | The variant of the label. Only used when compact is not true. |
|
|
652
|
+
| `lineBreakStrategyIOS` | `none \| standard \| hangul-word \| push-out` | No | `-` | Set line break strategy on iOS. |
|
|
653
|
+
| `maxFontSizeMultiplier` | `number \| null` | No | `-` | Specifies largest possible scale a font can reach when allowFontScaling is enabled. Possible values: - null/undefined (default): inherit from the parent node or the global default (0) - 0: no max, ignore parent/global default - >= 1: sets the maxFontSizeMultiplier of this node to this value |
|
|
654
|
+
| `maxLength` | `number` | No | `-` | Limits the maximum number of characters that can be entered. Use this instead of implementing the logic in JS to avoid flicker. |
|
|
655
|
+
| `minHeight` | `string \| number` | No | `auto` | minimum height of input |
|
|
656
|
+
| `multiline` | `boolean` | No | `-` | If true, the text input can be multiple lines. The default value is false. |
|
|
657
|
+
| `numberOfLines` | `number` | No | `-` | Sets the number of lines for a TextInput. Use it with multiline set to true to be able to fill the lines. |
|
|
658
|
+
| `onBlur` | `((e: NativeSyntheticEvent<TextInputFocusEventData>) => void)` | No | `-` | Callback that is called when the text input is blurred |
|
|
659
|
+
| `onChange` | `((e: NativeSyntheticEvent<TextInputChangeEventData>) => void)` | No | `-` | - |
|
|
660
|
+
| `onChangeText` | `((text: string) => void)` | No | `-` | - |
|
|
661
|
+
| `onContentSizeChange` | `((e: NativeSyntheticEvent<TextInputContentSizeChangeEventData>) => void)` | No | `-` | Callback that is called when the text inputs content size changes. This will be called with { nativeEvent: { contentSize: { width, height } } }. Only called for multiline text inputs. |
|
|
662
|
+
| `onEndEditing` | `((e: NativeSyntheticEvent<TextInputEndEditingEventData>) => void)` | No | `-` | Callback that is called when text input ends. |
|
|
663
|
+
| `onFocus` | `((e: NativeSyntheticEvent<TextInputFocusEventData>) => void)` | No | `-` | Callback that is called when the text input is focused |
|
|
664
|
+
| `onKeyPress` | `((e: NativeSyntheticEvent<TextInputKeyPressEventData>) => void)` | No | `-` | Callback that is called when a key is pressed. This will be called with { nativeEvent: { key: keyValue } } where keyValue is Enter or Backspace for respective keys and the typed-in character otherwise including for space. Fires before onChange callbacks. Note: on Android only the inputs from soft keyboard are handled, not the hardware keyboard inputs. |
|
|
665
|
+
| `onPointerCancel` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
666
|
+
| `onPointerCancelCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
667
|
+
| `onPointerDown` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
668
|
+
| `onPointerDownCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
669
|
+
| `onPointerEnter` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
670
|
+
| `onPointerEnterCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
671
|
+
| `onPointerLeave` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
672
|
+
| `onPointerLeaveCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
673
|
+
| `onPointerMove` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
674
|
+
| `onPointerMoveCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
675
|
+
| `onPointerUp` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
676
|
+
| `onPointerUpCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
677
|
+
| `onPress` | `((e: NativeSyntheticEvent<NativeTouchEvent>) => void)` | No | `-` | Called when a single tap gesture is detected. |
|
|
678
|
+
| `onPressIn` | `((e: NativeSyntheticEvent<NativeTouchEvent>) => void)` | No | `-` | Callback that is called when a touch is engaged. |
|
|
679
|
+
| `onPressOut` | `((e: NativeSyntheticEvent<NativeTouchEvent>) => void)` | No | `-` | Callback that is called when a touch is released. |
|
|
680
|
+
| `onScroll` | `((e: NativeSyntheticEvent<TextInputScrollEventData>) => void)` | No | `-` | Invoked on content scroll with { nativeEvent: { contentOffset: { x, y } } }. May also contain other properties from ScrollEvent but on Android contentSize is not provided for performance reasons. |
|
|
681
|
+
| `onSelectionChange` | `((e: NativeSyntheticEvent<TextInputSelectionChangeEventData>) => void)` | No | `-` | Callback that is called when the text input selection is changed. |
|
|
682
|
+
| `onSubmitEditing` | `((e: NativeSyntheticEvent<TextInputSubmitEditingEventData>) => void)` | No | `-` | Callback that is called when the text inputs submit button is pressed. |
|
|
683
|
+
| `onTextInput` | `((e: NativeSyntheticEvent<TextInputTextInputEventData>) => void)` | No | `-` | Callback that is called on new text input with the argument { nativeEvent: { text, previousText, range: { start, end } } }. This prop requires multiline={true} to be set. |
|
|
684
|
+
| `passwordRules` | `string \| null` | No | `-` | Provide rules for your password. For example, say you want to require a password with at least eight characters consisting of a mix of uppercase and lowercase letters, at least one number, and at most two consecutive characters. required: upper; required: lower; required: digit; max-consecutive: 2; minlength: 8; |
|
|
685
|
+
| `placeholder` | `string` | No | `-` | Placeholder text displayed inside of the input. Will be replaced if there is a value. The string that will be rendered before text input has been entered |
|
|
686
|
+
| `placeholderTextColor` | `string \| OpaqueColorValue` | No | `-` | The text color of the placeholder string |
|
|
687
|
+
| `readOnly` | `boolean` | No | `-` | If true, text is not editable. The default value is false. |
|
|
688
|
+
| `ref` | `((instance: TextInput \| null) => void) \| RefObject<TextInput> \| null` | No | `-` | - |
|
|
689
|
+
| `rejectResponderTermination` | `boolean \| null` | No | `-` | If true, allows TextInput to pass touch events to the parent component. This allows components to be swipeable from the TextInput on iOS, as is the case on Android by default. If false, TextInput always asks to handle the input (except when disabled). |
|
|
690
|
+
| `returnKeyLabel` | `string` | No | `-` | Sets the return key to the label. Use it instead of returnKeyType. |
|
|
691
|
+
| `returnKeyType` | `search \| join \| done \| none \| default \| go \| next \| send \| previous \| google \| route \| yahoo \| emergency-call` | No | `-` | enum(default, go, google, join, next, route, search, send, yahoo, done, emergency-call) Determines how the return key should look. |
|
|
692
|
+
| `scrollEnabled` | `boolean` | No | `-` | If false, scrolling of the text view will be disabled. The default value is true. Only works with multiline={true} |
|
|
693
|
+
| `secureTextEntry` | `boolean` | No | `-` | If true, the text input obscures the text entered so that sensitive text like passwords stay secure. The default value is false. |
|
|
694
|
+
| `selectTextOnFocus` | `boolean` | No | `-` | If true, all text will automatically be selected on focus |
|
|
695
|
+
| `selection` | `{ start: number; end?: number; } \| undefined` | No | `-` | The start and end of the text inputs selection. Set start and end to the same value to position the cursor. |
|
|
696
|
+
| `selectionColor` | `string \| OpaqueColorValue` | No | `-` | The highlight (and cursor on ios) color of the text input |
|
|
697
|
+
| `selectionHandleColor` | `ColorValue \| null` | No | `-` | When provided it will set the color of the selection handles when highlighting text. Unlike the behavior of selectionColor the handle color will be set independently from the color of the text selection box. |
|
|
698
|
+
| `selectionState` | `DocumentSelectionState` | No | `-` | See DocumentSelectionState.js, some state that is responsible for maintaining selection information for a document |
|
|
699
|
+
| `showSoftInputOnFocus` | `boolean` | No | `-` | When false, it will prevent the soft keyboard from showing when the field is focused. The default value is true |
|
|
700
|
+
| `smartInsertDelete` | `boolean` | No | `-` | If false, the iOS system will not insert an extra space after a paste operation neither delete one or two spaces after a cut or delete operation. The default value is true. |
|
|
701
|
+
| `spellCheck` | `boolean` | No | `-` | If false, disables spell-check style (i.e. red underlines). The default value is inherited from autoCorrect |
|
|
702
|
+
| `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 |
|
|
703
|
+
| `style` | `null \| false \| TextStyle \| RegisteredStyle<TextStyle> \| RecursiveArray<Falsy \| TextStyle \| RegisteredStyle<TextStyle>>` | No | `-` | Styles |
|
|
704
|
+
| `suffix` | `string` | No | `-` | Adds suffix text to the end of input |
|
|
705
|
+
| `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 Used to locate this view in end-to-end tests |
|
|
706
|
+
| `testIDMap` | `{ start?: string; end?: string \| undefined; label?: string \| undefined; helperText?: string \| undefined; } \| undefined` | No | `-` | Add ability to test individual parts of the input |
|
|
707
|
+
| `textAlign` | `left \| right \| center \| unset` | No | `-` | Native TextInput textAlign with the extra unset option to remove the textAlign style. Use this to workaround the issue where long text does not ellipsis in TextInput |
|
|
708
|
+
| `textAlignVertical` | `top \| bottom \| auto \| center` | No | `-` | Vertically align text when multiline is set to true |
|
|
709
|
+
| `textBreakStrategy` | `simple \| highQuality \| balanced` | No | `-` | Set text break strategy on Android API Level 23+, possible values are simple, highQuality, balanced The default value is simple. |
|
|
710
|
+
| `textContentType` | `none \| location \| name \| nickname \| password \| username \| URL \| addressCity \| addressCityAndState \| addressState \| countryName \| creditCardNumber \| creditCardExpiration \| creditCardExpirationMonth \| creditCardExpirationYear \| creditCardSecurityCode \| creditCardType \| creditCardName \| creditCardGivenName \| creditCardMiddleName \| creditCardFamilyName \| emailAddress \| familyName \| fullStreetAddress \| givenName \| jobTitle \| middleName \| namePrefix \| nameSuffix \| organizationName \| postalCode \| streetAddressLine1 \| streetAddressLine2 \| sublocality \| telephoneNumber \| newPassword \| oneTimeCode \| birthdate \| birthdateDay \| birthdateMonth \| birthdateYear` | No | `-` | Give the keyboard and the system information about the expected semantic meaning for the content that users enter. To disable autofill, set textContentType to none. Possible values for textContentType are: - none - URL - addressCity - addressCityAndState - addressState - countryName - creditCardNumber - creditCardExpiration (iOS 17+) - creditCardExpirationMonth (iOS 17+) - creditCardExpirationYear (iOS 17+) - creditCardSecurityCode (iOS 17+) - creditCardType (iOS 17+) - creditCardName (iOS 17+) - creditCardGivenName (iOS 17+) - creditCardMiddleName (iOS 17+) - creditCardFamilyName (iOS 17+) - emailAddress - familyName - fullStreetAddress - givenName - jobTitle - location - middleName - name - namePrefix - nameSuffix - nickname - organizationName - postalCode - streetAddressLine1 - streetAddressLine2 - sublocality - telephoneNumber - username - password - newPassword - oneTimeCode - birthdate (iOS 17+) - birthdateDay (iOS 17+) - birthdateMonth (iOS 17+) - birthdateYear (iOS 17+) |
|
|
711
|
+
| `underlineColorAndroid` | `string \| OpaqueColorValue` | No | `-` | The color of the textInput underline. |
|
|
712
|
+
| `value` | `string` | No | `-` | - |
|
|
713
|
+
| `variant` | `primary \| secondary \| positive \| negative \| foregroundMuted \| foreground` | No | `-` | 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 |
|
|
714
|
+
| `verticalAlign` | `top \| bottom \| auto \| middle` | No | `-` | Vertically align text when multiline is set to true |
|
|
715
|
+
| `width` | `string \| number` | No | `100%` | Width of input as a percentage string. |
|
|
716
|
+
|
|
717
|
+
|