@coinbase/cds-mcp-server 8.17.2 → 8.17.3
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 +4 -0
- package/mcp-docs/mobile/components/Accordion.txt +189 -0
- package/mcp-docs/mobile/components/AccordionItem.txt +30 -0
- package/mcp-docs/mobile/components/Alert.txt +156 -0
- package/mcp-docs/mobile/components/AreaChart.txt +266 -0
- package/mcp-docs/mobile/components/Avatar.txt +196 -0
- package/mcp-docs/mobile/components/AvatarButton.txt +226 -0
- package/mcp-docs/mobile/components/Banner.txt +222 -0
- package/mcp-docs/mobile/components/BarChart.txt +816 -0
- package/mcp-docs/mobile/components/Box.txt +174 -0
- package/mcp-docs/mobile/components/BrowserBar.txt +147 -0
- package/mcp-docs/mobile/components/Button.txt +199 -0
- package/mcp-docs/mobile/components/ButtonGroup.txt +80 -0
- package/mcp-docs/mobile/components/Carousel.txt +1084 -0
- package/mcp-docs/mobile/components/CartesianChart.txt +826 -0
- package/mcp-docs/mobile/components/CellMedia.txt +71 -0
- package/mcp-docs/mobile/components/Checkbox.txt +246 -0
- package/mcp-docs/mobile/components/CheckboxCell.txt +202 -0
- package/mcp-docs/mobile/components/CheckboxGroup.txt +285 -0
- package/mcp-docs/mobile/components/Chip.txt +195 -0
- package/mcp-docs/mobile/components/Coachmark.txt +158 -0
- package/mcp-docs/mobile/components/Collapsible.txt +105 -0
- package/mcp-docs/mobile/components/ContainedAssetCard.txt +135 -0
- package/mcp-docs/mobile/components/ContentCard.txt +366 -0
- package/mcp-docs/mobile/components/ContentCardBody.txt +136 -0
- package/mcp-docs/mobile/components/ContentCardFooter.txt +128 -0
- package/mcp-docs/mobile/components/ContentCardHeader.txt +146 -0
- package/mcp-docs/mobile/components/ContentCell.txt +227 -0
- package/mcp-docs/mobile/components/ControlGroup.txt +444 -0
- package/mcp-docs/mobile/components/DatePicker.txt +497 -0
- package/mcp-docs/mobile/components/Divider.txt +139 -0
- package/mcp-docs/mobile/components/DotCount.txt +146 -0
- package/mcp-docs/mobile/components/DotStatusColor.txt +59 -0
- package/mcp-docs/mobile/components/DotSymbol.txt +135 -0
- package/mcp-docs/mobile/components/Fallback.txt +158 -0
- package/mcp-docs/mobile/components/FloatingAssetCard.txt +156 -0
- package/mcp-docs/mobile/components/HStack.txt +235 -0
- package/mcp-docs/mobile/components/HeroSquare.txt +48 -0
- package/mcp-docs/mobile/components/Icon.txt +52 -0
- package/mcp-docs/mobile/components/IconButton.txt +269 -0
- package/mcp-docs/mobile/components/InputChip.txt +188 -0
- package/mcp-docs/mobile/components/Interactable.txt +187 -0
- package/mcp-docs/mobile/components/LineChart.txt +1325 -0
- package/mcp-docs/mobile/components/Link.txt +292 -0
- package/mcp-docs/mobile/components/ListCell.txt +391 -0
- package/mcp-docs/mobile/components/LogoMark.txt +85 -0
- package/mcp-docs/mobile/components/LogoWordMark.txt +94 -0
- package/mcp-docs/mobile/components/Lottie.txt +139 -0
- package/mcp-docs/mobile/components/LottieStatusAnimation.txt +47 -0
- package/mcp-docs/mobile/components/Modal.txt +84 -0
- package/mcp-docs/mobile/components/ModalBody.txt +34 -0
- package/mcp-docs/mobile/components/ModalFooter.txt +25 -0
- package/mcp-docs/mobile/components/ModalHeader.txt +28 -0
- package/mcp-docs/mobile/components/MultiContentModule.txt +380 -0
- package/mcp-docs/mobile/components/NavigationTitle.txt +132 -0
- package/mcp-docs/mobile/components/NavigationTitleSelect.txt +142 -0
- package/mcp-docs/mobile/components/NudgeCard.txt +90 -0
- package/mcp-docs/mobile/components/Numpad.txt +341 -0
- package/mcp-docs/mobile/components/Overlay.txt +152 -0
- package/mcp-docs/mobile/components/PageFooter.txt +161 -0
- package/mcp-docs/mobile/components/PageHeader.txt +186 -0
- package/mcp-docs/mobile/components/PeriodSelector.txt +408 -0
- package/mcp-docs/mobile/components/Pictogram.txt +48 -0
- package/mcp-docs/mobile/components/Point.txt +205 -0
- package/mcp-docs/mobile/components/PortalProvider.txt +79 -0
- package/mcp-docs/mobile/components/Pressable.txt +211 -0
- package/mcp-docs/mobile/components/ProgressBar.txt +130 -0
- package/mcp-docs/mobile/components/ProgressBarWithFixedLabels.txt +161 -0
- package/mcp-docs/mobile/components/ProgressBarWithFloatLabel.txt +138 -0
- package/mcp-docs/mobile/components/ProgressCircle.txt +237 -0
- package/mcp-docs/mobile/components/Radio.txt +242 -0
- package/mcp-docs/mobile/components/RadioCell.txt +202 -0
- package/mcp-docs/mobile/components/RadioGroup.txt +282 -0
- package/mcp-docs/mobile/components/ReferenceLine.txt +153 -0
- package/mcp-docs/mobile/components/RemoteImage.txt +106 -0
- package/mcp-docs/mobile/components/RemoteImageGroup.txt +61 -0
- package/mcp-docs/mobile/components/RollingNumber.txt +789 -0
- package/mcp-docs/mobile/components/Scrubber.txt +204 -0
- package/mcp-docs/mobile/components/SearchInput.txt +192 -0
- package/mcp-docs/mobile/components/SectionHeader.txt +205 -0
- package/mcp-docs/mobile/components/SegmentedTabs.txt +316 -0
- package/mcp-docs/mobile/components/Select.txt +212 -0
- package/mcp-docs/mobile/components/SelectChip.txt +324 -0
- package/mcp-docs/mobile/components/SelectOption.txt +85 -0
- package/mcp-docs/mobile/components/SlideButton.txt +331 -0
- package/mcp-docs/mobile/components/Spacer.txt +84 -0
- package/mcp-docs/mobile/components/Sparkline.txt +123 -0
- package/mcp-docs/mobile/components/SparklineGradient.txt +107 -0
- package/mcp-docs/mobile/components/SparklineInteractive.txt +157 -0
- package/mcp-docs/mobile/components/SparklineInteractiveHeader.txt +73 -0
- package/mcp-docs/mobile/components/Spinner.txt +49 -0
- package/mcp-docs/mobile/components/SpotIcon.txt +48 -0
- package/mcp-docs/mobile/components/SpotRectangle.txt +48 -0
- package/mcp-docs/mobile/components/SpotSquare.txt +48 -0
- package/mcp-docs/mobile/components/Stepper.txt +528 -0
- package/mcp-docs/mobile/components/SubBrandLogoMark.txt +126 -0
- package/mcp-docs/mobile/components/SubBrandLogoWordMark.txt +126 -0
- package/mcp-docs/mobile/components/Switch.txt +98 -0
- package/mcp-docs/mobile/components/TabIndicator.txt +49 -0
- package/mcp-docs/mobile/components/TabLabel.txt +154 -0
- package/mcp-docs/mobile/components/TabNavigation.txt +147 -0
- package/mcp-docs/mobile/components/TabbedChips.txt +143 -0
- package/mcp-docs/mobile/components/Tabs.txt +191 -0
- package/mcp-docs/mobile/components/Tag.txt +301 -0
- package/mcp-docs/mobile/components/Text.txt +212 -0
- package/mcp-docs/mobile/components/TextInput.txt +718 -0
- package/mcp-docs/mobile/components/ThemeProvider.txt +133 -0
- package/mcp-docs/mobile/components/Toast.txt +197 -0
- package/mcp-docs/mobile/components/Tooltip.txt +60 -0
- package/mcp-docs/mobile/components/TopNavBar.txt +162 -0
- package/mcp-docs/mobile/components/Tour.txt +159 -0
- package/mcp-docs/mobile/components/Tray.txt +253 -0
- package/mcp-docs/mobile/components/UpsellCard.txt +322 -0
- package/mcp-docs/mobile/components/VStack.txt +223 -0
- package/mcp-docs/mobile/components/XAxis.txt +622 -0
- package/mcp-docs/mobile/components/YAxis.txt +568 -0
- package/mcp-docs/mobile/getting-started/introduction.txt +99 -0
- package/mcp-docs/mobile/getting-started/mcp-server.txt +94 -0
- package/mcp-docs/mobile/getting-started/playground.txt +25 -0
- package/mcp-docs/mobile/hooks/useDimensions.txt +47 -0
- package/mcp-docs/mobile/hooks/useOverlayContentContext.txt +215 -0
- package/mcp-docs/mobile/hooks/useTheme.txt +110 -0
- package/mcp-docs/mobile/routes.txt +132 -0
- package/mcp-docs/web/components/Accordion.txt +190 -0
- package/mcp-docs/web/components/AccordionItem.txt +32 -0
- package/mcp-docs/web/components/Alert.txt +165 -0
- package/mcp-docs/web/components/AreaChart.txt +511 -0
- package/mcp-docs/web/components/Avatar.txt +212 -0
- package/mcp-docs/web/components/AvatarButton.txt +241 -0
- package/mcp-docs/web/components/Banner.txt +227 -0
- package/mcp-docs/web/components/BarChart.txt +1268 -0
- package/mcp-docs/web/components/Box.txt +176 -0
- package/mcp-docs/web/components/Button.txt +213 -0
- package/mcp-docs/web/components/ButtonGroup.txt +80 -0
- package/mcp-docs/web/components/Calendar.txt +182 -0
- package/mcp-docs/web/components/Carousel.txt +1576 -0
- package/mcp-docs/web/components/CartesianChart.txt +1045 -0
- package/mcp-docs/web/components/CellMedia.txt +57 -0
- package/mcp-docs/web/components/Checkbox.txt +189 -0
- package/mcp-docs/web/components/CheckboxCell.txt +203 -0
- package/mcp-docs/web/components/CheckboxGroup.txt +220 -0
- package/mcp-docs/web/components/Chip.txt +197 -0
- package/mcp-docs/web/components/Coachmark.txt +189 -0
- package/mcp-docs/web/components/Collapsible.txt +120 -0
- package/mcp-docs/web/components/ContainedAssetCard.txt +233 -0
- package/mcp-docs/web/components/ContentCard.txt +368 -0
- package/mcp-docs/web/components/ContentCardBody.txt +138 -0
- package/mcp-docs/web/components/ContentCardFooter.txt +130 -0
- package/mcp-docs/web/components/ContentCardHeader.txt +148 -0
- package/mcp-docs/web/components/ContentCell.txt +220 -0
- package/mcp-docs/web/components/ControlGroup.txt +437 -0
- package/mcp-docs/web/components/DatePicker.txt +506 -0
- package/mcp-docs/web/components/Divider.txt +144 -0
- package/mcp-docs/web/components/DotCount.txt +150 -0
- package/mcp-docs/web/components/DotStatusColor.txt +59 -0
- package/mcp-docs/web/components/DotSymbol.txt +138 -0
- package/mcp-docs/web/components/Dropdown.txt +120 -0
- package/mcp-docs/web/components/Fallback.txt +164 -0
- package/mcp-docs/web/components/FloatingAssetCard.txt +251 -0
- package/mcp-docs/web/components/FullscreenAlert.txt +70 -0
- package/mcp-docs/web/components/FullscreenModal.txt +146 -0
- package/mcp-docs/web/components/FullscreenModalLayout.txt +188 -0
- package/mcp-docs/web/components/Grid.txt +237 -0
- package/mcp-docs/web/components/GridColumn.txt +210 -0
- package/mcp-docs/web/components/HStack.txt +237 -0
- package/mcp-docs/web/components/HeroSquare.txt +49 -0
- package/mcp-docs/web/components/Icon.txt +146 -0
- package/mcp-docs/web/components/IconButton.txt +391 -0
- package/mcp-docs/web/components/InputChip.txt +188 -0
- package/mcp-docs/web/components/Interactable.txt +194 -0
- package/mcp-docs/web/components/LineChart.txt +1577 -0
- package/mcp-docs/web/components/Link.txt +244 -0
- package/mcp-docs/web/components/ListCell.txt +397 -0
- package/mcp-docs/web/components/LogoMark.txt +85 -0
- package/mcp-docs/web/components/LogoWordMark.txt +94 -0
- package/mcp-docs/web/components/Lottie.txt +158 -0
- package/mcp-docs/web/components/LottieStatusAnimation.txt +58 -0
- package/mcp-docs/web/components/MediaQueryProvider.txt +109 -0
- package/mcp-docs/web/components/Modal.txt +193 -0
- package/mcp-docs/web/components/ModalBody.txt +118 -0
- package/mcp-docs/web/components/ModalFooter.txt +120 -0
- package/mcp-docs/web/components/ModalHeader.txt +124 -0
- package/mcp-docs/web/components/MultiContentModule.txt +382 -0
- package/mcp-docs/web/components/NavigationBar.txt +103 -0
- package/mcp-docs/web/components/NavigationTitle.txt +26 -0
- package/mcp-docs/web/components/NavigationTitleSelect.txt +46 -0
- package/mcp-docs/web/components/NudgeCard.txt +182 -0
- package/mcp-docs/web/components/Overlay.txt +172 -0
- package/mcp-docs/web/components/PageFooter.txt +185 -0
- package/mcp-docs/web/components/PageHeader.txt +244 -0
- package/mcp-docs/web/components/Pagination.txt +500 -0
- package/mcp-docs/web/components/PeriodSelector.txt +704 -0
- package/mcp-docs/web/components/Pictogram.txt +49 -0
- package/mcp-docs/web/components/Point.txt +461 -0
- package/mcp-docs/web/components/PortalProvider.txt +77 -0
- package/mcp-docs/web/components/Pressable.txt +194 -0
- package/mcp-docs/web/components/ProgressBar.txt +164 -0
- package/mcp-docs/web/components/ProgressBarWithFixedLabels.txt +213 -0
- package/mcp-docs/web/components/ProgressBarWithFloatLabel.txt +182 -0
- package/mcp-docs/web/components/ProgressCircle.txt +444 -0
- package/mcp-docs/web/components/Radio.txt +220 -0
- package/mcp-docs/web/components/RadioCell.txt +216 -0
- package/mcp-docs/web/components/RadioGroup.txt +289 -0
- package/mcp-docs/web/components/ReferenceLine.txt +452 -0
- package/mcp-docs/web/components/RemoteImage.txt +166 -0
- package/mcp-docs/web/components/RemoteImageGroup.txt +87 -0
- package/mcp-docs/web/components/RollingNumber.txt +1022 -0
- package/mcp-docs/web/components/Scrubber.txt +232 -0
- package/mcp-docs/web/components/SearchInput.txt +118 -0
- package/mcp-docs/web/components/SectionHeader.txt +218 -0
- package/mcp-docs/web/components/SegmentedTabs.txt +325 -0
- package/mcp-docs/web/components/Select.txt +225 -0
- package/mcp-docs/web/components/SelectChip.txt +315 -0
- package/mcp-docs/web/components/SelectOption.txt +166 -0
- package/mcp-docs/web/components/Sidebar.txt +350 -0
- package/mcp-docs/web/components/SidebarItem.txt +132 -0
- package/mcp-docs/web/components/SidebarMoreMenu.txt +31 -0
- package/mcp-docs/web/components/Spacer.txt +174 -0
- package/mcp-docs/web/components/Sparkline.txt +123 -0
- package/mcp-docs/web/components/SparklineGradient.txt +107 -0
- package/mcp-docs/web/components/SparklineInteractive.txt +154 -0
- package/mcp-docs/web/components/SparklineInteractiveHeader.txt +77 -0
- package/mcp-docs/web/components/Spinner.txt +129 -0
- package/mcp-docs/web/components/SpotIcon.txt +49 -0
- package/mcp-docs/web/components/SpotRectangle.txt +49 -0
- package/mcp-docs/web/components/SpotSquare.txt +49 -0
- package/mcp-docs/web/components/Stepper.txt +683 -0
- package/mcp-docs/web/components/SubBrandLogoMark.txt +126 -0
- package/mcp-docs/web/components/SubBrandLogoWordMark.txt +126 -0
- package/mcp-docs/web/components/Switch.txt +86 -0
- package/mcp-docs/web/components/TabIndicator.txt +49 -0
- package/mcp-docs/web/components/TabLabel.txt +159 -0
- package/mcp-docs/web/components/TabNavigation.txt +160 -0
- package/mcp-docs/web/components/TabbedChips.txt +156 -0
- package/mcp-docs/web/components/Table.txt +368 -0
- package/mcp-docs/web/components/TableBody.txt +84 -0
- package/mcp-docs/web/components/TableCaption.txt +103 -0
- package/mcp-docs/web/components/TableCell.txt +166 -0
- package/mcp-docs/web/components/TableCellFallback.txt +98 -0
- package/mcp-docs/web/components/TableFooter.txt +84 -0
- package/mcp-docs/web/components/TableHeader.txt +101 -0
- package/mcp-docs/web/components/TableRow.txt +141 -0
- package/mcp-docs/web/components/Tabs.txt +213 -0
- package/mcp-docs/web/components/Tag.txt +305 -0
- package/mcp-docs/web/components/Text.txt +233 -0
- package/mcp-docs/web/components/TextInput.txt +653 -0
- package/mcp-docs/web/components/ThemeProvider.txt +200 -0
- package/mcp-docs/web/components/TileButton.txt +159 -0
- package/mcp-docs/web/components/Toast.txt +204 -0
- package/mcp-docs/web/components/Tooltip.txt +90 -0
- package/mcp-docs/web/components/Tour.txt +180 -0
- package/mcp-docs/web/components/Tray.txt +289 -0
- package/mcp-docs/web/components/UpsellCard.txt +320 -0
- package/mcp-docs/web/components/VStack.txt +225 -0
- package/mcp-docs/web/components/XAxis.txt +620 -0
- package/mcp-docs/web/components/YAxis.txt +549 -0
- package/mcp-docs/web/getting-started/introduction.txt +99 -0
- package/mcp-docs/web/getting-started/mcp-server.txt +94 -0
- package/mcp-docs/web/getting-started/playground.txt +25 -0
- package/mcp-docs/web/hooks/useBreakpoints.txt +33 -0
- package/mcp-docs/web/hooks/useDimensions.txt +55 -0
- package/mcp-docs/web/hooks/useHasMounted.txt +55 -0
- package/mcp-docs/web/hooks/useIsoEffect.txt +42 -0
- package/mcp-docs/web/hooks/useMediaQuery.txt +94 -0
- package/mcp-docs/web/hooks/useOverlayContentContext.txt +217 -0
- package/mcp-docs/web/hooks/useScrollBlocker.txt +63 -0
- package/mcp-docs/web/hooks/useTheme.txt +105 -0
- package/mcp-docs/web/routes.txt +155 -0
- package/package.json +1 -1
|
@@ -0,0 +1,789 @@
|
|
|
1
|
+
# RollingNumber
|
|
2
|
+
|
|
3
|
+
A numeric display that animates value changes with rolling digits.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```jsx
|
|
8
|
+
import { RollingNumber } from '@coinbase/cds-mobile/numbers/RollingNumber'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Required | Default | Description |
|
|
14
|
+
| --- | --- | --- | --- | --- |
|
|
15
|
+
| `value` | `number` | Yes | `-` | Number to display. |
|
|
16
|
+
| `RollingNumberAffixSectionComponent` | `RollingNumberAffixSectionComponent` | No | `-` | Component used to render prefix and suffix sections. |
|
|
17
|
+
| `RollingNumberDigitComponent` | `RollingNumberDigitComponent` | No | `-` | Component used to render individual digits. |
|
|
18
|
+
| `RollingNumberMaskComponent` | `RollingNumberMaskComponent` | No | `-` | Component used to render the mask container. |
|
|
19
|
+
| `RollingNumberSymbolComponent` | `RollingNumberSymbolComponent` | No | `-` | Component used to render separators and other symbols. |
|
|
20
|
+
| `RollingNumberValueSectionComponent` | `RollingNumberValueSectionComponent` | No | `-` | Component used to render the numeric sections. |
|
|
21
|
+
| `accessibilityLabelPrefix` | `string` | No | `-` | Accessibility label prefix announced before the value. |
|
|
22
|
+
| `accessibilityLabelSuffix` | `string` | No | `-` | Accessibility label suffix announced after the value. |
|
|
23
|
+
| `adjustsFontSizeToFit` | `boolean` | No | `-` | Specifies whether font should be scaled down automatically to fit given style constraints. |
|
|
24
|
+
| `align` | `end \| start \| center \| justify` | No | `start` | Specifies text alignment. On mobile, the value justify is only supported on iOS and fallbacks to start on Android. |
|
|
25
|
+
| `alignContent` | `flex-start \| flex-end \| center \| stretch \| space-between \| space-around \| space-evenly` | No | `-` | - |
|
|
26
|
+
| `alignItems` | `flex-start \| flex-end \| center \| stretch \| baseline` | No | `-` | - |
|
|
27
|
+
| `alignSelf` | `auto \| FlexAlignType` | No | `-` | - |
|
|
28
|
+
| `allowFontScaling` | `boolean` | No | `-` | Specifies whether fonts should scale to respect Text Size accessibility settings. The default is true. |
|
|
29
|
+
| `android_hyphenationFrequency` | `none \| normal \| full` | No | `-` | Hyphenation strategy |
|
|
30
|
+
| `animated` | `boolean` | No | `-` | - |
|
|
31
|
+
| `aspectRatio` | `string \| number` | No | `-` | - |
|
|
32
|
+
| `background` | `currentColor \| fg \| fgMuted \| fgInverse \| fgPrimary \| fgWarning \| fgPositive \| fgNegative \| bg \| bgAlternate \| bgInverse \| bgOverlay \| bgElevation1 \| bgElevation2 \| bgPrimary \| bgPrimaryWash \| bgSecondary \| bgTertiary \| bgSecondaryWash \| bgNegative \| bgNegativeWash \| bgPositive \| bgPositiveWash \| bgWarning \| bgWarningWash \| bgLine \| bgLineHeavy \| bgLineInverse \| bgLinePrimary \| bgLinePrimarySubtle \| accentSubtleRed \| accentBoldRed \| accentSubtleGreen \| accentBoldGreen \| accentSubtleBlue \| accentBoldBlue \| accentSubtlePurple \| accentBoldPurple \| accentSubtleYellow \| accentBoldYellow \| accentSubtleGray \| accentBoldGray \| transparent` | No | `-` | - |
|
|
33
|
+
| `borderBottomLeftRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
34
|
+
| `borderBottomRightRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
35
|
+
| `borderBottomWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
36
|
+
| `borderColor` | `currentColor \| fg \| fgMuted \| fgInverse \| fgPrimary \| fgWarning \| fgPositive \| fgNegative \| bg \| bgAlternate \| bgInverse \| bgOverlay \| bgElevation1 \| bgElevation2 \| bgPrimary \| bgPrimaryWash \| bgSecondary \| bgTertiary \| bgSecondaryWash \| bgNegative \| bgNegativeWash \| bgPositive \| bgPositiveWash \| bgWarning \| bgWarningWash \| bgLine \| bgLineHeavy \| bgLineInverse \| bgLinePrimary \| bgLinePrimarySubtle \| accentSubtleRed \| accentBoldRed \| accentSubtleGreen \| accentBoldGreen \| accentSubtleBlue \| accentBoldBlue \| accentSubtlePurple \| accentBoldPurple \| accentSubtleYellow \| accentBoldYellow \| accentSubtleGray \| accentBoldGray \| transparent` | No | `-` | - |
|
|
37
|
+
| `borderEndWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
38
|
+
| `borderRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
39
|
+
| `borderStartWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
40
|
+
| `borderTopLeftRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
41
|
+
| `borderTopRightRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
42
|
+
| `borderTopWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
43
|
+
| `borderWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
44
|
+
| `bottom` | `string \| number` | No | `-` | - |
|
|
45
|
+
| `color` | `currentColor \| fg \| fgMuted \| fgInverse \| fgPrimary \| fgWarning \| fgPositive \| fgNegative \| bg \| bgAlternate \| bgInverse \| bgOverlay \| bgElevation1 \| bgElevation2 \| bgPrimary \| bgPrimaryWash \| bgSecondary \| bgTertiary \| bgSecondaryWash \| bgNegative \| bgNegativeWash \| bgPositive \| bgPositiveWash \| bgWarning \| bgWarningWash \| bgLine \| bgLineHeavy \| bgLineInverse \| bgLinePrimary \| bgLinePrimarySubtle \| accentSubtleRed \| accentBoldRed \| accentSubtleGreen \| accentBoldGreen \| accentSubtleBlue \| accentBoldBlue \| accentSubtlePurple \| accentBoldPurple \| accentSubtleYellow \| accentBoldYellow \| accentSubtleGray \| accentBoldGray \| transparent` | No | `-` | Base text color token. When {@link colorPulseOnUpdate } is true, the color briefly pulses to a positive or negative mid color before returning to this base color. Defaults to {@code fg}. |
|
|
46
|
+
| `colorPulseOnUpdate` | `boolean` | No | `-` | Enables color pulsing on positive or negative changes. |
|
|
47
|
+
| `columnGap` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
48
|
+
| `dangerouslySetBackground` | `string \| OpaqueColorValue` | No | `-` | - |
|
|
49
|
+
| `dangerouslySetColor` | `string \| OpaqueColorValue` | No | `-` | - |
|
|
50
|
+
| `dataDetectorType` | `link \| none \| all \| email \| phoneNumber \| null` | No | `-` | Determines the types of data converted to clickable URLs in the text element. By default no data types are detected. |
|
|
51
|
+
| `disabled` | `boolean` | No | `-` | Add disabled opacity style to text Specifies the disabled state of the text view for testing purposes. |
|
|
52
|
+
| `display` | `flex \| none` | No | `-` | - |
|
|
53
|
+
| `dynamicTypeRamp` | `title1 \| title2 \| title3 \| headline \| body \| caption2 \| caption1 \| footnote \| subheadline \| callout \| largeTitle` | No | `-` | The Dynamic Type scale ramp to apply to this element on iOS. |
|
|
54
|
+
| `elevation` | `0 \| 1 \| 2` | No | `-` | - |
|
|
55
|
+
| `ellipsize` | `middle \| head \| tail \| clip` | No | `-` | Choose ellipsize mode. |
|
|
56
|
+
| `ellipsizeMode` | `middle \| head \| tail \| clip` | No | `-` | This can be one of the following values: - head - The line is displayed so that the end fits in the container and the missing text at the beginning of the line is indicated by an ellipsis glyph. e.g., ...wxyz - middle - The line is displayed so that the beginning and end fit in the container and the missing text in the middle is indicated by an ellipsis glyph. ab...yz - tail - The line is displayed so that the beginning fits in the container and the missing text at the end of the line is indicated by an ellipsis glyph. e.g., abcd... - clip - Lines are not drawn past the edge of the text container. The default is tail. numberOfLines must be set in conjunction with this prop. > clip is working only for iOS |
|
|
57
|
+
| `enableSubscriptNotation` | `boolean` | No | `-` | Enables subscript notation for leading zeros in the fractional part (for example, {@code 0.00009 => 0.0₄9}). |
|
|
58
|
+
| `flexBasis` | `string \| number` | No | `-` | - |
|
|
59
|
+
| `flexDirection` | `row \| column \| row-reverse \| column-reverse` | No | `-` | - |
|
|
60
|
+
| `flexGrow` | `number` | No | `-` | - |
|
|
61
|
+
| `flexShrink` | `number` | No | `-` | - |
|
|
62
|
+
| `flexWrap` | `wrap \| nowrap \| wrap-reverse` | No | `-` | - |
|
|
63
|
+
| `font` | `inherit \| FontFamily` | No | `body` | Set text font family. |
|
|
64
|
+
| `fontFamily` | `inherit \| FontFamily` | No | `-` | - |
|
|
65
|
+
| `fontSize` | `inherit \| FontSize` | No | `-` | - |
|
|
66
|
+
| `fontWeight` | `inherit \| FontWeight` | No | `-` | - |
|
|
67
|
+
| `format` | `(Omit<NumberFormatOptions, notation> & { notation?: compact \| standard; }) \| undefined` | No | `-` | Intl.NumberFormat options applied when formatting the value. Scientific and engineering notation are not supported. |
|
|
68
|
+
| `formattedValue` | `string` | No | `-` | Preformatted value rendered instead of formatting {@link value }. {@link value } is still used to determine numeric deltas. |
|
|
69
|
+
| `gap` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
70
|
+
| `height` | `string \| number` | No | `-` | - |
|
|
71
|
+
| `id` | `string` | No | `-` | Used to reference react managed views from native code. |
|
|
72
|
+
| `justifyContent` | `flex-start \| flex-end \| center \| space-between \| space-around \| space-evenly` | No | `-` | - |
|
|
73
|
+
| `key` | `Key \| null` | No | `-` | - |
|
|
74
|
+
| `left` | `string \| number` | No | `-` | - |
|
|
75
|
+
| `lineBreakMode` | `middle \| head \| tail \| clip` | No | `-` | Line Break mode. Works only with numberOfLines. clip is working only for iOS |
|
|
76
|
+
| `lineBreakStrategyIOS` | `none \| standard \| hangul-word \| push-out` | No | `-` | Set line break strategy on iOS. |
|
|
77
|
+
| `lineHeight` | `inherit \| LineHeight` | No | `-` | - |
|
|
78
|
+
| `locale` | `string \| Locale \| readonly (string \| Locale)[]` | No | `-` | Locale used for formatting. Defaults to the locale from {@link LocaleProvider }. |
|
|
79
|
+
| `margin` | `0 \| -1 \| -2 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5` | No | `-` | - |
|
|
80
|
+
| `marginBottom` | `0 \| -1 \| -2 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5` | No | `-` | - |
|
|
81
|
+
| `marginEnd` | `0 \| -1 \| -2 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5` | No | `-` | - |
|
|
82
|
+
| `marginStart` | `0 \| -1 \| -2 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5` | No | `-` | - |
|
|
83
|
+
| `marginTop` | `0 \| -1 \| -2 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5` | No | `-` | - |
|
|
84
|
+
| `marginX` | `0 \| -1 \| -2 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5` | No | `-` | - |
|
|
85
|
+
| `marginY` | `0 \| -1 \| -2 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5` | No | `-` | - |
|
|
86
|
+
| `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 |
|
|
87
|
+
| `maxHeight` | `string \| number` | No | `-` | - |
|
|
88
|
+
| `maxWidth` | `string \| number` | No | `-` | - |
|
|
89
|
+
| `minHeight` | `string \| number` | No | `-` | - |
|
|
90
|
+
| `minWidth` | `string \| number` | No | `-` | - |
|
|
91
|
+
| `minimumFontScale` | `number` | No | `-` | Specifies smallest possible scale a font can reach when adjustsFontSizeToFit is enabled. (values 0.01-1.0). |
|
|
92
|
+
| `mono` | `boolean` | No | `-` | Use monospace font family. |
|
|
93
|
+
| `nativeID` | `string` | No | `-` | Used to reference react managed views from native code. |
|
|
94
|
+
| `negativePulseColor` | `currentColor \| fg \| fgMuted \| fgInverse \| fgPrimary \| fgWarning \| fgPositive \| fgNegative \| bg \| bgAlternate \| bgInverse \| bgOverlay \| bgElevation1 \| bgElevation2 \| bgPrimary \| bgPrimaryWash \| bgSecondary \| bgTertiary \| bgSecondaryWash \| bgNegative \| bgNegativeWash \| bgPositive \| bgPositiveWash \| bgWarning \| bgWarningWash \| bgLine \| bgLineHeavy \| bgLineInverse \| bgLinePrimary \| bgLinePrimarySubtle \| accentSubtleRed \| accentBoldRed \| accentSubtleGreen \| accentBoldGreen \| accentSubtleBlue \| accentBoldBlue \| accentSubtlePurple \| accentBoldPurple \| accentSubtleYellow \| accentBoldYellow \| accentSubtleGray \| accentBoldGray \| transparent` | No | `-` | Color token used for negative numeric changes. Defaults to {@code fgNegative}. |
|
|
95
|
+
| `noWrap` | `boolean` | No | `false` | Set text to be in a single line. |
|
|
96
|
+
| `numberOfLines` | `number` | No | `-` | Truncates text after wrapping to a defined number of lines. Used to truncate the text with an ellipsis after computing the text layout, including line wrapping, such that the total number of lines does not exceed this number. This prop is commonly used with ellipsizeMode. |
|
|
97
|
+
| `onLayout` | `((event: LayoutChangeEvent) => void)` | No | `-` | Invoked on mount and layout changes with {nativeEvent: { layout: {x, y, width, height}}}. |
|
|
98
|
+
| `onLongPress` | `((event: GestureResponderEvent) => void)` | No | `-` | This function is called on long press. e.g., onLongPress={this.increaseSize}> |
|
|
99
|
+
| `onPress` | `((event: GestureResponderEvent) => void)` | No | `-` | This function is called on press. Text intrinsically supports press handling with a default highlight state (which can be disabled with suppressHighlighting). |
|
|
100
|
+
| `onPressIn` | `((event: GestureResponderEvent) => void)` | No | `-` | - |
|
|
101
|
+
| `onPressOut` | `((event: GestureResponderEvent) => void)` | No | `-` | - |
|
|
102
|
+
| `onTextLayout` | `((event: NativeSyntheticEvent<TextLayoutEventData>) => void)` | No | `-` | Invoked on Text layout |
|
|
103
|
+
| `opacity` | `number \| AnimatedNode` | No | `-` | - |
|
|
104
|
+
| `overflow` | `visible \| hidden \| scroll` | No | `-` | - |
|
|
105
|
+
| `padding` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
106
|
+
| `paddingBottom` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
107
|
+
| `paddingEnd` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
108
|
+
| `paddingStart` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
109
|
+
| `paddingTop` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
110
|
+
| `paddingX` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
111
|
+
| `paddingY` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
112
|
+
| `position` | `absolute \| relative \| static \| fixed \| sticky` | No | `-` | - |
|
|
113
|
+
| `positivePulseColor` | `currentColor \| fg \| fgMuted \| fgInverse \| fgPrimary \| fgWarning \| fgPositive \| fgNegative \| bg \| bgAlternate \| bgInverse \| bgOverlay \| bgElevation1 \| bgElevation2 \| bgPrimary \| bgPrimaryWash \| bgSecondary \| bgTertiary \| bgSecondaryWash \| bgNegative \| bgNegativeWash \| bgPositive \| bgPositiveWash \| bgWarning \| bgWarningWash \| bgLine \| bgLineHeavy \| bgLineInverse \| bgLinePrimary \| bgLinePrimarySubtle \| accentSubtleRed \| accentBoldRed \| accentSubtleGreen \| accentBoldGreen \| accentSubtleBlue \| accentBoldBlue \| accentSubtlePurple \| accentBoldPurple \| accentSubtleYellow \| accentBoldYellow \| accentSubtleGray \| accentBoldGray \| transparent` | No | `-` | Color token used for positive numeric changes. Defaults to {@code fgPositive}. |
|
|
114
|
+
| `prefix` | `null \| string \| number \| false \| true \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal` | No | `-` | Content rendered before the formatted value. |
|
|
115
|
+
| `ref` | `((instance: View \| null) => void) \| RefObject<View> \| null` | No | `-` | - |
|
|
116
|
+
| `renderEmptyNode` | `boolean` | No | `-` | - |
|
|
117
|
+
| `right` | `string \| number` | No | `-` | - |
|
|
118
|
+
| `rowGap` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
119
|
+
| `selectable` | `boolean` | No | `-` | Lets the user select text, to use the native copy and paste functionality. |
|
|
120
|
+
| `selectionColor` | `string \| OpaqueColorValue` | No | `-` | The highlight color of the text. |
|
|
121
|
+
| `style` | `false \| Value \| AnimatedInterpolation<string \| number> \| RegisteredStyle<TextStyle> \| WithAnimatedObject<TextStyle> \| WithAnimatedArray<Falsy \| TextStyle \| RegisteredStyle<TextStyle> \| RecursiveArray<Falsy \| TextStyle \| RegisteredStyle<TextStyle>> \| readonly (Falsy \| TextStyle \| RegisteredStyle<TextStyle>)[]> \| null` | No | `-` | - |
|
|
122
|
+
| `styles` | `{ root?: StyleProp<ViewStyle>; visibleContent?: StyleProp<ViewStyle>; formattedValueSection?: StyleProp<ViewStyle>; prefix?: StyleProp<ViewStyle>; suffix?: StyleProp<ViewStyle>; i18nPrefix?: StyleProp<ViewStyle>; i18nSuffix?: StyleProp<ViewStyle>; integer?: StyleProp<ViewStyle>; fraction?: StyleProp<ViewStyle>; text?: StyleProp<TextStyle>; }` | No | `-` | Style overrides applied to RollingNumber slots. |
|
|
123
|
+
| `suffix` | `null \| string \| number \| false \| true \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal` | No | `-` | Content rendered after the formatted value. |
|
|
124
|
+
| `suppressHighlighting` | `boolean` | No | `-` | When true, no visual change is made when text is pressed down. By default, a gray oval highlights the text on press down. |
|
|
125
|
+
| `tabularNumbers` | `boolean` | No | `false` | Activates the set of figures where numbers are all of the same size, allowing them to be easily aligned. Enables tabular figures on the underlying {@link Text}. All digits render with equal width. Defaults to {@code true}. |
|
|
126
|
+
| `testID` | `string` | No | `-` | Used to locate this element in unit and end-to-end tests. Used to locate this view in end-to-end tests. 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 |
|
|
127
|
+
| `textAlign` | `left \| right \| auto \| center \| justify` | No | `-` | - |
|
|
128
|
+
| `textBreakStrategy` | `simple \| highQuality \| balanced` | No | `-` | Set text break strategy on Android API Level 23+ default is highQuality. |
|
|
129
|
+
| `textDecorationLine` | `none \| underline \| line-through \| underline line-through` | No | `-` | - |
|
|
130
|
+
| `textDecorationStyle` | `solid \| dotted \| dashed \| double` | No | `-` | - |
|
|
131
|
+
| `textTransform` | `none \| capitalize \| uppercase \| lowercase` | No | `-` | - |
|
|
132
|
+
| `top` | `string \| number` | No | `-` | - |
|
|
133
|
+
| `transform` | `string \| (({ scaleX: AnimatableNumericValue; } & { scaleY?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ scaleY: AnimatableNumericValue; } & { scaleX?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ translateX: AnimatableNumericValue \| ${number}%; } & { scaleX?: undefined; scaleY?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ translateY: AnimatableNumericValue \| ${number}%; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ perspective: AnimatableNumericValue; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ rotate: AnimatableStringValue; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ rotateX: AnimatableStringValue; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ rotateY: AnimatableStringValue; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ rotateZ: AnimatableStringValue; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ scale: AnimatableNumericValue; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ skewX: AnimatableStringValue; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ skewY: AnimatableStringValue; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; matrix?: undefined; }) \| ({ matrix: AnimatableNumericValue[]; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; }))[]` | No | `-` | - |
|
|
134
|
+
| `transition` | `RollingNumberTransitionConfig` | No | `-` | Reanimated transition overrides. Supports per-property overrides for {@code y} and {@code color} only. |
|
|
135
|
+
| `underline` | `boolean` | No | `false` | Set text decoration to underline. |
|
|
136
|
+
| `userSelect` | `none \| auto \| contain \| text \| all` | No | `-` | - |
|
|
137
|
+
| `width` | `string \| number` | No | `-` | - |
|
|
138
|
+
| `zIndex` | `number` | No | `-` | - |
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
## Examples
|
|
142
|
+
|
|
143
|
+
### Basic Example
|
|
144
|
+
|
|
145
|
+
RollingNumber displays changing numeric values with a smooth per-digit roll animation and optional color pulse. It supports `Intl.NumberFormat` options, custom typography, ReactNode prefixes/suffixes, and accessibility.
|
|
146
|
+
|
|
147
|
+
Pass a number in the `value` prop. Use the `format` prop for Intl formatting (currency, percent, grouping, compact) instead of pre-formatting the string yourself.
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
<RollingNumber value={12345.67} />
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Example Use Case
|
|
154
|
+
|
|
155
|
+
```tsx
|
|
156
|
+
function ExampleUseCase() {
|
|
157
|
+
const price = 12345.67;
|
|
158
|
+
const difference = 79.65;
|
|
159
|
+
const trendColor = difference >= 0 ? 'fgPositive' : 'fgNegative';
|
|
160
|
+
|
|
161
|
+
return (
|
|
162
|
+
<VStack gap={2}>
|
|
163
|
+
<Text font="label1">Portfolio Balance</Text>
|
|
164
|
+
<RollingNumber
|
|
165
|
+
colorPulseOnUpdate
|
|
166
|
+
font="display3"
|
|
167
|
+
format={{ style: 'currency', currency: 'USD' }}
|
|
168
|
+
value={price}
|
|
169
|
+
/>
|
|
170
|
+
|
|
171
|
+
<HStack alignItems="center">
|
|
172
|
+
<RollingNumber
|
|
173
|
+
accessibilityLabelPrefix={difference > 0 ? 'up ' : difference < 0 ? 'down ' : ''}
|
|
174
|
+
color={trendColor}
|
|
175
|
+
font="body"
|
|
176
|
+
format={{
|
|
177
|
+
style: 'currency',
|
|
178
|
+
currency: 'USD',
|
|
179
|
+
minimumFractionDigits: 2,
|
|
180
|
+
maximumFractionDigits: 2,
|
|
181
|
+
}}
|
|
182
|
+
prefix={
|
|
183
|
+
difference >= 0 ? (
|
|
184
|
+
<Icon color={trendColor} name="diagonalUpArrow" size="xs" />
|
|
185
|
+
) : (
|
|
186
|
+
<Icon color={trendColor} name="diagonalDownArrow" size="xs" />
|
|
187
|
+
)
|
|
188
|
+
}
|
|
189
|
+
suffix={`(${((Math.abs(difference) / price) * 100).toFixed(2)}%)`}
|
|
190
|
+
value={Math.abs(difference)}
|
|
191
|
+
/>
|
|
192
|
+
</HStack>
|
|
193
|
+
|
|
194
|
+
<Text font="label1">BTC Conversion</Text>
|
|
195
|
+
<HStack alignItems="center" gap={1}>
|
|
196
|
+
<Icon color="fgPrimary" name="arrowsVertical" size="xs" />
|
|
197
|
+
<RollingNumber
|
|
198
|
+
color="fgPrimary"
|
|
199
|
+
fontFamily="body"
|
|
200
|
+
fontSize="body"
|
|
201
|
+
fontWeight="body"
|
|
202
|
+
format={{ minimumFractionDigits: 8, maximumFractionDigits: 8 }}
|
|
203
|
+
value={price / 150_000}
|
|
204
|
+
/>
|
|
205
|
+
</HStack>
|
|
206
|
+
</VStack>
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Formatting
|
|
212
|
+
|
|
213
|
+
Use `format` prop for currency, percent, grouping, and compact notation formatting. The `format` prop takes in `Intl.NumberFormat` [options](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options).
|
|
214
|
+
|
|
215
|
+
```tsx
|
|
216
|
+
function Format() {
|
|
217
|
+
const value = 98345.67;
|
|
218
|
+
return (
|
|
219
|
+
<VStack gap={2}>
|
|
220
|
+
<Text font="label1">Compact number with currency sign</Text>
|
|
221
|
+
<RollingNumber
|
|
222
|
+
font="display3"
|
|
223
|
+
format={{
|
|
224
|
+
style: 'currency',
|
|
225
|
+
currency: 'USD',
|
|
226
|
+
minimumFractionDigits: 2,
|
|
227
|
+
maximumFractionDigits: 5,
|
|
228
|
+
notation: 'compact',
|
|
229
|
+
}}
|
|
230
|
+
value={value}
|
|
231
|
+
/>
|
|
232
|
+
<Text font="label1">Number without grouping</Text>
|
|
233
|
+
<RollingNumber font="display3" format={{ useGrouping: false }} value={value} />
|
|
234
|
+
</VStack>
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Typography
|
|
240
|
+
|
|
241
|
+
RollingNumber forwards all Text props, but only character-level typographic props (e.g., `font`, `fontFamily`, `fontSize`, `fontWeight`, `lineHeight`, `tabularNumbers`, `color`) are meaningful for its per-digit rendering. Layout/container props may have no effect—use them judiciously.
|
|
242
|
+
|
|
243
|
+
::::tip Mobile limitation
|
|
244
|
+
Non-tabular numbers are currently not supported on mobile. The `tabularNumbers` setting should not be disabled.
|
|
245
|
+
::::
|
|
246
|
+
|
|
247
|
+
```tsx
|
|
248
|
+
function TypographyExamples() {
|
|
249
|
+
const price = 9876.54;
|
|
250
|
+
return (
|
|
251
|
+
<VStack gap={2}>
|
|
252
|
+
<Text font="label1">Font sizes, weights, and line heights</Text>
|
|
253
|
+
<RollingNumber
|
|
254
|
+
fontSize="display3"
|
|
255
|
+
fontWeight="title3"
|
|
256
|
+
format={{ style: 'currency', currency: 'USD' }}
|
|
257
|
+
value={price}
|
|
258
|
+
/>
|
|
259
|
+
<RollingNumber
|
|
260
|
+
fontSize="title3"
|
|
261
|
+
fontWeight="headline"
|
|
262
|
+
format={{ style: 'currency', currency: 'USD' }}
|
|
263
|
+
value={price}
|
|
264
|
+
/>
|
|
265
|
+
<RollingNumber
|
|
266
|
+
fontSize="body"
|
|
267
|
+
fontWeight="body"
|
|
268
|
+
format={{ style: 'currency', currency: 'USD' }}
|
|
269
|
+
lineHeight="display3"
|
|
270
|
+
value={price}
|
|
271
|
+
/>
|
|
272
|
+
<Text font="label1">Monospaced figures</Text>
|
|
273
|
+
<RollingNumber
|
|
274
|
+
mono
|
|
275
|
+
font="title1"
|
|
276
|
+
format={{ style: 'currency', currency: 'USD' }}
|
|
277
|
+
value={price}
|
|
278
|
+
/>
|
|
279
|
+
</VStack>
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### Color and Transition
|
|
285
|
+
|
|
286
|
+
You can customize the number color and its animation transitions. Configure `y` to control the digit roll, and `color` to control the pulse.
|
|
287
|
+
|
|
288
|
+
##### `transition` prop:
|
|
289
|
+
|
|
290
|
+
- Type: `y?: ({ type: 'timing' } & WithTimingConfig) | ({ type: 'spring' } & WithSpringConfig);
|
|
291
|
+
color?: ({ type: 'timing' } & WithTimingConfig) | ({ type: 'spring' } & WithSpringConfig);`
|
|
292
|
+
- Default: `{
|
|
293
|
+
y: {
|
|
294
|
+
type: 'timing',
|
|
295
|
+
duration: durations.moderate3,
|
|
296
|
+
easing: Easing.bezier(...curves.global),
|
|
297
|
+
},
|
|
298
|
+
color: {
|
|
299
|
+
type: 'timing',
|
|
300
|
+
duration: durations.slow4,
|
|
301
|
+
easing: Easing.bezier(...curves.global),
|
|
302
|
+
},
|
|
303
|
+
}`
|
|
304
|
+
|
|
305
|
+
```tsx
|
|
306
|
+
function ColorAndTransition() {
|
|
307
|
+
const price = 555.55;
|
|
308
|
+
return (
|
|
309
|
+
<VStack gap={2}>
|
|
310
|
+
<Text font="label1">Color pulse and custom transition</Text>
|
|
311
|
+
<RollingNumber
|
|
312
|
+
colorPulseOnUpdate
|
|
313
|
+
font="title1"
|
|
314
|
+
format={{ style: 'currency', currency: 'USD' }}
|
|
315
|
+
transition={{
|
|
316
|
+
color: {
|
|
317
|
+
duration: durations.moderate3,
|
|
318
|
+
easing: Easing.inOut(Easing.quad),
|
|
319
|
+
},
|
|
320
|
+
y: {
|
|
321
|
+
duration: durations.moderate3,
|
|
322
|
+
easing: Easing.in(Easing.quad),
|
|
323
|
+
},
|
|
324
|
+
}}
|
|
325
|
+
value={price}
|
|
326
|
+
/>
|
|
327
|
+
|
|
328
|
+
<RollingNumber
|
|
329
|
+
colorPulseOnUpdate
|
|
330
|
+
color="accentBoldBlue"
|
|
331
|
+
font="title1"
|
|
332
|
+
format={{ style: 'currency', currency: 'USD' }}
|
|
333
|
+
transition={{
|
|
334
|
+
color: {
|
|
335
|
+
duration: durations.slow4,
|
|
336
|
+
easing: Easing.inOut(Easing.quad),
|
|
337
|
+
},
|
|
338
|
+
y: {
|
|
339
|
+
duration: durations.slow4,
|
|
340
|
+
easing: Easing.in(Easing.quad),
|
|
341
|
+
},
|
|
342
|
+
}}
|
|
343
|
+
value={price}
|
|
344
|
+
/>
|
|
345
|
+
|
|
346
|
+
<Text font="label1">Customize positive and negative change colors</Text>
|
|
347
|
+
<RollingNumber
|
|
348
|
+
colorPulseOnUpdate
|
|
349
|
+
font="title1"
|
|
350
|
+
format={{ style: 'currency', currency: 'USD' }}
|
|
351
|
+
negativePulseColor="bgWarning"
|
|
352
|
+
positivePulseColor="fgPrimary"
|
|
353
|
+
value={price}
|
|
354
|
+
/>
|
|
355
|
+
|
|
356
|
+
<Text font="label1">Fast digits, slow color</Text>
|
|
357
|
+
<RollingNumber
|
|
358
|
+
colorPulseOnUpdate
|
|
359
|
+
font="title1"
|
|
360
|
+
format={{ style: 'currency', currency: 'EUR' }}
|
|
361
|
+
transition={{
|
|
362
|
+
y: {
|
|
363
|
+
duration: durations.fast1,
|
|
364
|
+
easing: Easing.bezier(...curves.enterFunctional),
|
|
365
|
+
},
|
|
366
|
+
color: {
|
|
367
|
+
duration: 5000,
|
|
368
|
+
easing: Easing.bezier(...curves.global),
|
|
369
|
+
},
|
|
370
|
+
}}
|
|
371
|
+
value={price}
|
|
372
|
+
/>
|
|
373
|
+
|
|
374
|
+
<Text font="label1">Springy digits</Text>
|
|
375
|
+
<RollingNumber
|
|
376
|
+
colorPulseOnUpdate
|
|
377
|
+
font="title1"
|
|
378
|
+
format={{ style: 'currency', currency: 'USD' }}
|
|
379
|
+
transition={{
|
|
380
|
+
y: { type: 'spring', stiffness: 1000, damping: 24, mass: 3, overshootClamping: false },
|
|
381
|
+
}}
|
|
382
|
+
value={price}
|
|
383
|
+
/>
|
|
384
|
+
|
|
385
|
+
<Text font="label1">Custom easings</Text>
|
|
386
|
+
<RollingNumber
|
|
387
|
+
colorPulseOnUpdate
|
|
388
|
+
font="title1"
|
|
389
|
+
format={{ style: 'currency', currency: 'USD' }}
|
|
390
|
+
transition={{
|
|
391
|
+
y: {
|
|
392
|
+
duration: durations.moderate2,
|
|
393
|
+
easing: Easing.bezier(...curves.enterExpressive),
|
|
394
|
+
},
|
|
395
|
+
color: {
|
|
396
|
+
duration: durations.slow1,
|
|
397
|
+
easing: Easing.bezier(...curves.exitFunctional),
|
|
398
|
+
},
|
|
399
|
+
}}
|
|
400
|
+
value={price}
|
|
401
|
+
/>
|
|
402
|
+
</VStack>
|
|
403
|
+
);
|
|
404
|
+
}
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
### Prefix and Suffix
|
|
408
|
+
|
|
409
|
+
Attach text or React nodes before/after the number to create rich compositions. If the prefix/suffix is a string, it will pulse color together with the main number.
|
|
410
|
+
|
|
411
|
+
```tsx
|
|
412
|
+
function PrefixAndSuffix() {
|
|
413
|
+
const value = 98345.67;
|
|
414
|
+
const format = {
|
|
415
|
+
style: 'currency' as const,
|
|
416
|
+
currency: 'USD',
|
|
417
|
+
minimumFractionDigits: 2,
|
|
418
|
+
maximumFractionDigits: 5,
|
|
419
|
+
};
|
|
420
|
+
return (
|
|
421
|
+
<VStack gap={2}>
|
|
422
|
+
<Text font="label1">Simple text prefix and suffix</Text>
|
|
423
|
+
<RollingNumber
|
|
424
|
+
colorPulseOnUpdate
|
|
425
|
+
font="display3"
|
|
426
|
+
format={format}
|
|
427
|
+
prefix="+"
|
|
428
|
+
suffix=" BTC"
|
|
429
|
+
value={value}
|
|
430
|
+
/>
|
|
431
|
+
<Text font="label1">Dynamic prefix and suffix</Text>
|
|
432
|
+
<RollingNumber
|
|
433
|
+
colorPulseOnUpdate
|
|
434
|
+
font="display3"
|
|
435
|
+
format={format}
|
|
436
|
+
prefix="-"
|
|
437
|
+
suffix=" ETH"
|
|
438
|
+
value={value}
|
|
439
|
+
/>
|
|
440
|
+
<Text font="label1">ReactNode prefix and suffix</Text>
|
|
441
|
+
<RollingNumber
|
|
442
|
+
colorPulseOnUpdate
|
|
443
|
+
font="display3"
|
|
444
|
+
format={format}
|
|
445
|
+
prefix={<Icon name="arrowUp" size="l" />}
|
|
446
|
+
suffix={<Icon name="arrowDown" size="l" />}
|
|
447
|
+
value={value}
|
|
448
|
+
/>
|
|
449
|
+
<Text font="label1">Suffix wraps to second line</Text>
|
|
450
|
+
<RollingNumber
|
|
451
|
+
colorPulseOnUpdate
|
|
452
|
+
font="display1"
|
|
453
|
+
format={format}
|
|
454
|
+
styles={{ fraction: { paddingRight: 8 } }}
|
|
455
|
+
suffix="BTC"
|
|
456
|
+
value={value}
|
|
457
|
+
/>
|
|
458
|
+
<Text font="label1">Suffix no wrapping</Text>
|
|
459
|
+
<RollingNumber
|
|
460
|
+
colorPulseOnUpdate
|
|
461
|
+
font="display1"
|
|
462
|
+
format={format}
|
|
463
|
+
styles={{ visibleContent: { flexWrap: 'nowrap' }, fraction: { paddingRight: 8 } }}
|
|
464
|
+
suffix="BTC"
|
|
465
|
+
value={value}
|
|
466
|
+
/>
|
|
467
|
+
</VStack>
|
|
468
|
+
);
|
|
469
|
+
}
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
### Style Overrides
|
|
473
|
+
|
|
474
|
+
Customize the look of each logical section (`i18nPrefix`, `integer`, `fraction`, `i18nSuffix`, `prefix`, `suffix`).
|
|
475
|
+
|
|
476
|
+
:::tip Mobile limitation
|
|
477
|
+
Per-section text styling (color, font, etc.) is not supported on mobile; text styles are applied globally within `RollingNumber`.
|
|
478
|
+
:::
|
|
479
|
+
|
|
480
|
+
```tsx
|
|
481
|
+
function StyleOverrides() {
|
|
482
|
+
const price = 12345.67;
|
|
483
|
+
return (
|
|
484
|
+
<VStack gap={2}>
|
|
485
|
+
<Text font="label1">Style overrides per section</Text>
|
|
486
|
+
<RollingNumber
|
|
487
|
+
colorPulseOnUpdate
|
|
488
|
+
font="display3"
|
|
489
|
+
format={{
|
|
490
|
+
style: 'currency',
|
|
491
|
+
currency: 'USD',
|
|
492
|
+
minimumFractionDigits: 2,
|
|
493
|
+
notation: 'compact',
|
|
494
|
+
}}
|
|
495
|
+
prefix="-"
|
|
496
|
+
styles={{
|
|
497
|
+
root: {
|
|
498
|
+
borderStyle: 'dashed',
|
|
499
|
+
borderColor: 'rgba(0,0,0,0.1)',
|
|
500
|
+
borderWidth: 1,
|
|
501
|
+
paddingVertical: 4,
|
|
502
|
+
paddingHorizontal: 8,
|
|
503
|
+
borderRadius: 8,
|
|
504
|
+
backgroundColor: 'rgba(0,0,0,0.03)',
|
|
505
|
+
},
|
|
506
|
+
fraction: { opacity: 0.2, gap: 10 },
|
|
507
|
+
suffix: { marginLeft: 10 },
|
|
508
|
+
}}
|
|
509
|
+
suffix="BTC"
|
|
510
|
+
value={price}
|
|
511
|
+
/>
|
|
512
|
+
</VStack>
|
|
513
|
+
);
|
|
514
|
+
}
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
### Subscript Notation for Tiny Decimals
|
|
518
|
+
|
|
519
|
+
Enable `enableSubscriptNotation` to compactly represent leading zeros in the fractional part.
|
|
520
|
+
|
|
521
|
+
```tsx
|
|
522
|
+
function Subscript() {
|
|
523
|
+
const value = 0.0000000001;
|
|
524
|
+
const format = { minimumFractionDigits: 2, maximumFractionDigits: 25 } as const;
|
|
525
|
+
return (
|
|
526
|
+
<VStack gap={1}>
|
|
527
|
+
<Text font="label1">Subscript for small decimals</Text>
|
|
528
|
+
<Text font="label2">Default:</Text>
|
|
529
|
+
<RollingNumber font="display3" format={format} value={value} />
|
|
530
|
+
<Text font="label2">With subscript:</Text>
|
|
531
|
+
<RollingNumber enableSubscriptNotation font="display3" format={format} value={value} />
|
|
532
|
+
</VStack>
|
|
533
|
+
);
|
|
534
|
+
}
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
### User-Provided Formatted Value
|
|
538
|
+
|
|
539
|
+
You can also provide `formattedValue`; the component will render it directly instead of using the internal formatter. The numeric `value` is still required to drive animations and the color pulse.
|
|
540
|
+
|
|
541
|
+
```tsx
|
|
542
|
+
function UserProvidedFormattedValue() {
|
|
543
|
+
const btc = { value: 98_765.43, formattedValue: '¥98,765.43 BTC' } as const;
|
|
544
|
+
const tiny = {
|
|
545
|
+
value: 0.00009,
|
|
546
|
+
formattedValue: '€0,0₄9',
|
|
547
|
+
accessibilityLabel: '€0.00009',
|
|
548
|
+
} as const;
|
|
549
|
+
return (
|
|
550
|
+
<VStack gap={1}>
|
|
551
|
+
<Text font="label1">User provided formatted value</Text>
|
|
552
|
+
<Text font="label2">BTC prices</Text>
|
|
553
|
+
<RollingNumber
|
|
554
|
+
colorPulseOnUpdate
|
|
555
|
+
font="display3"
|
|
556
|
+
formattedValue={btc.formattedValue}
|
|
557
|
+
prefix={<Icon name="crypto" size="l" />}
|
|
558
|
+
value={btc.value}
|
|
559
|
+
/>
|
|
560
|
+
<Text font="label2">Subscripts with comma as decimal separator</Text>
|
|
561
|
+
<RollingNumber
|
|
562
|
+
colorPulseOnUpdate
|
|
563
|
+
accessibilityLabel={tiny.accessibilityLabel}
|
|
564
|
+
font="display3"
|
|
565
|
+
formattedValue={tiny.formattedValue}
|
|
566
|
+
value={tiny.value}
|
|
567
|
+
/>
|
|
568
|
+
</VStack>
|
|
569
|
+
);
|
|
570
|
+
}
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
::::tip Accessibility and formattedValue
|
|
574
|
+
When you provide `formattedValue`, the `accessibilityLabel` will default to your `formattedValue`. However, what’s rendered on screen is not always ideal for accessibility. For example, the subscript notation '0₉' may be announced as '09'. Provide your own `accessibilityLabel` as needed.
|
|
575
|
+
::::
|
|
576
|
+
|
|
577
|
+
### Patterns & Recipes
|
|
578
|
+
|
|
579
|
+
Practical demos combining formatting, animation, and interactivity.
|
|
580
|
+
|
|
581
|
+
#### Counter
|
|
582
|
+
|
|
583
|
+
```tsx
|
|
584
|
+
function CounterExample() {
|
|
585
|
+
const [count, setCount] = React.useState(0);
|
|
586
|
+
const onInc = () => setCount((c) => c + 1);
|
|
587
|
+
const onDec = () => setCount((c) => Math.max(0, c - 1));
|
|
588
|
+
return (
|
|
589
|
+
<VStack gap={1}>
|
|
590
|
+
<HStack alignItems="center" gap={2}>
|
|
591
|
+
<IconButton accessibilityLabel="decrement" name="minus" onPress={onDec} />
|
|
592
|
+
<RollingNumber
|
|
593
|
+
colorPulseOnUpdate
|
|
594
|
+
font="display1"
|
|
595
|
+
format={{ minimumFractionDigits: 0, maximumFractionDigits: 0 }}
|
|
596
|
+
value={count}
|
|
597
|
+
/>
|
|
598
|
+
<IconButton accessibilityLabel="increment" name="add" onPress={onInc} />
|
|
599
|
+
</HStack>
|
|
600
|
+
</VStack>
|
|
601
|
+
);
|
|
602
|
+
}
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
#### Countdown
|
|
606
|
+
|
|
607
|
+
```tsx
|
|
608
|
+
function CountDownExample() {
|
|
609
|
+
const pad = (n: number) => String(n).padStart(2, '0');
|
|
610
|
+
const totalSeconds = 5 * 60;
|
|
611
|
+
const [seconds, setSeconds] = React.useState(totalSeconds);
|
|
612
|
+
const [running, setRunning] = React.useState(false);
|
|
613
|
+
React.useEffect(() => {
|
|
614
|
+
if (!running) return;
|
|
615
|
+
const id = setInterval(() => {
|
|
616
|
+
setSeconds((prev) => {
|
|
617
|
+
if (prev <= 1) {
|
|
618
|
+
clearInterval(id);
|
|
619
|
+
return 0;
|
|
620
|
+
}
|
|
621
|
+
return prev - 1;
|
|
622
|
+
});
|
|
623
|
+
}, 1000);
|
|
624
|
+
return () => clearInterval(id);
|
|
625
|
+
}, [running]);
|
|
626
|
+
const minutes = Math.floor(seconds / 60);
|
|
627
|
+
const secs = seconds % 60;
|
|
628
|
+
const formatted = `${pad(minutes)}:${pad(secs)}`;
|
|
629
|
+
const onReset = () => setSeconds(totalSeconds);
|
|
630
|
+
const progress = Math.max(0, Math.min(1, (totalSeconds - seconds) / totalSeconds));
|
|
631
|
+
return (
|
|
632
|
+
<VStack gap={1}>
|
|
633
|
+
<RollingNumber
|
|
634
|
+
font="display3"
|
|
635
|
+
formattedValue={formatted}
|
|
636
|
+
value={seconds}
|
|
637
|
+
accessibilityLiveRegion="none"
|
|
638
|
+
/>
|
|
639
|
+
<HStack gap={2}>
|
|
640
|
+
<Button onPress={() => setRunning((r) => !r)}>{running ? 'Pause' : 'Start'}</Button>
|
|
641
|
+
<Button onPress={onReset}>Reset</Button>
|
|
642
|
+
</HStack>
|
|
643
|
+
<Text font="label1">Countdown with progress</Text>
|
|
644
|
+
<VStack gap={1}>
|
|
645
|
+
<ProgressBar progress={progress} />
|
|
646
|
+
<RollingNumber
|
|
647
|
+
font="body"
|
|
648
|
+
format={{ style: 'percent', maximumFractionDigits: 0 }}
|
|
649
|
+
prefix="Elapsed: "
|
|
650
|
+
value={progress}
|
|
651
|
+
accessibilityLiveRegion="none"
|
|
652
|
+
/>
|
|
653
|
+
</VStack>
|
|
654
|
+
</VStack>
|
|
655
|
+
);
|
|
656
|
+
}
|
|
657
|
+
```
|
|
658
|
+
|
|
659
|
+
#### Live Auction
|
|
660
|
+
|
|
661
|
+
```tsx
|
|
662
|
+
function LiveBiddingExample() {
|
|
663
|
+
const [currentBid, setCurrentBid] = React.useState(45000);
|
|
664
|
+
const [bidCount, setBidCount] = React.useState(23);
|
|
665
|
+
const [timeLeft, setTimeLeft] = React.useState(180);
|
|
666
|
+
React.useEffect(() => {
|
|
667
|
+
const timer = setInterval(() => {
|
|
668
|
+
setTimeLeft((t) => Math.max(0, t - 1));
|
|
669
|
+
}, 1000);
|
|
670
|
+
return () => clearInterval(timer);
|
|
671
|
+
}, []);
|
|
672
|
+
const placeBid = (increment: number) => {
|
|
673
|
+
setCurrentBid((b) => b + increment);
|
|
674
|
+
setBidCount((c) => c + 1);
|
|
675
|
+
};
|
|
676
|
+
const minutes = Math.floor(timeLeft / 60);
|
|
677
|
+
const seconds = timeLeft % 60;
|
|
678
|
+
return (
|
|
679
|
+
<VStack gap={2}>
|
|
680
|
+
<VStack gap={1}>
|
|
681
|
+
<Text color="fgMuted" font="caption">
|
|
682
|
+
Current Bid
|
|
683
|
+
</Text>
|
|
684
|
+
<RollingNumber
|
|
685
|
+
colorPulseOnUpdate
|
|
686
|
+
font="display2"
|
|
687
|
+
format={{ style: 'currency', currency: 'USD', minimumFractionDigits: 0 }}
|
|
688
|
+
positivePulseColor="accentBoldRed"
|
|
689
|
+
transition={{ y: { type: 'spring', stiffness: 200, damping: 20 } }}
|
|
690
|
+
value={currentBid}
|
|
691
|
+
/>
|
|
692
|
+
<HStack gap={1}>
|
|
693
|
+
<RollingNumber font="body" format={{ minimumFractionDigits: 0 }} value={bidCount} />
|
|
694
|
+
<Text font="body">bids placed</Text>
|
|
695
|
+
<Text color="fgMuted" font="body">
|
|
696
|
+
•
|
|
697
|
+
</Text>
|
|
698
|
+
<RollingNumber
|
|
699
|
+
color={timeLeft < 30 ? 'fgNegative' : 'fg'}
|
|
700
|
+
font="body"
|
|
701
|
+
formattedValue={`${minutes}:${String(seconds).padStart(2, '0')}`}
|
|
702
|
+
value={timeLeft}
|
|
703
|
+
accessibilityLiveRegion="none"
|
|
704
|
+
/>
|
|
705
|
+
<Text font="body">remaining</Text>
|
|
706
|
+
</HStack>
|
|
707
|
+
</VStack>
|
|
708
|
+
<HStack gap={1}>
|
|
709
|
+
<Button onPress={() => placeBid(100)}>+$100</Button>
|
|
710
|
+
<Button onPress={() => placeBid(500)}>+$500</Button>
|
|
711
|
+
<Button onPress={() => placeBid(1000)}>+$1000</Button>
|
|
712
|
+
</HStack>
|
|
713
|
+
</VStack>
|
|
714
|
+
);
|
|
715
|
+
}
|
|
716
|
+
```
|
|
717
|
+
|
|
718
|
+
### Anatomy & Customization
|
|
719
|
+
|
|
720
|
+
RollingNumber (mobile) is composed of swappable subcomponents and exposes style hooks for each section of the number. Use these to customize structure and styling or to plug in your own components.
|
|
721
|
+
|
|
722
|
+
#### Subcomponents
|
|
723
|
+
|
|
724
|
+
- **RollingNumberMaskComponent**: Component responsible for masking the animated digit content.
|
|
725
|
+
- **RollingNumberAffixSectionComponent**: Component responsible for rendering ReactNode `prefix` / `suffix` props.
|
|
726
|
+
- **RollingNumberValueSectionComponent**: Component responsible for rendering the four `Intl.NumberFormat` sections (`i18nPrefix`, `integer`, `fraction`, `i18nSuffix`).
|
|
727
|
+
- **RollingNumberDigitComponent**: Component responsible for the per-digit roll animation (Reanimated-driven).
|
|
728
|
+
- **RollingNumberSymbolComponent**: Component responsible for rendering non-digit symbols (group separators, decimal, literals, etc.).
|
|
729
|
+
|
|
730
|
+
You can replace any of these with your own components via props:
|
|
731
|
+
|
|
732
|
+
```tsx
|
|
733
|
+
<RollingNumber
|
|
734
|
+
RollingNumberMaskComponent={MyMask}
|
|
735
|
+
RollingNumberAffixSectionComponent={MyAffixSection}
|
|
736
|
+
RollingNumberValueSectionComponent={MyValueSection}
|
|
737
|
+
RollingNumberDigitComponent={MyDigit}
|
|
738
|
+
RollingNumberSymbolComponent={MySymbol}
|
|
739
|
+
value={1234.56}
|
|
740
|
+
format={{ style: 'currency', currency: 'USD' }}
|
|
741
|
+
/>
|
|
742
|
+
```
|
|
743
|
+
|
|
744
|
+
#### Style overrides
|
|
745
|
+
|
|
746
|
+
Use the `styles` prop to inline style specific parts:
|
|
747
|
+
|
|
748
|
+
- **root**: Outer container (`HStack` root)
|
|
749
|
+
- **visibleContent**: Container around the visible number and prefix/suffix
|
|
750
|
+
- **formattedValueSection**: Container around the four i18n sections
|
|
751
|
+
- **i18nPrefix**: Section generated by `Intl.NumberFormat` before the number
|
|
752
|
+
- **integer**: Integer part of the number
|
|
753
|
+
- **fraction**: Fractional part of the number
|
|
754
|
+
- **i18nSuffix**: Section generated by `Intl.NumberFormat` after the number
|
|
755
|
+
- **prefix**: Wrapper around your `prefix` prop
|
|
756
|
+
- **suffix**: Wrapper around your `suffix` prop
|
|
757
|
+
- **text**: Shared text style applied to digits, symbols, prefix, and suffix (mobile only)
|
|
758
|
+
|
|
759
|
+
#### Structure diagrams
|
|
760
|
+
|
|
761
|
+
High-level anatomy of RollingNumber (mobile) and its sections:
|
|
762
|
+
|
|
763
|
+
```text
|
|
764
|
+
RollingNumber (root: HStack)
|
|
765
|
+
├── invisibleMeasuredDigits <Text>0</Text> (offscreen, used for measuring digit height)
|
|
766
|
+
├── screenReaderOnly <Text accessibilityLiveRegion> (hidden a11y text)
|
|
767
|
+
└── HStack (visibleContent)
|
|
768
|
+
├── AffixSection (prefix) ← your ReactNode prefix
|
|
769
|
+
├── HStack (formattedValueSection)
|
|
770
|
+
│ ├── ValueSection (i18nPrefix)
|
|
771
|
+
│ ├── ValueSection (integer)
|
|
772
|
+
│ ├── ValueSection (fraction)
|
|
773
|
+
│ └── ValueSection (i18nSuffix)
|
|
774
|
+
└── AffixSection (suffix) ← your ReactNode suffix
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
Per-digit rendering inside a ValueSection:
|
|
778
|
+
|
|
779
|
+
```text
|
|
780
|
+
ValueSection
|
|
781
|
+
├── Symbol(s) (e.g., currency, group, decimal)
|
|
782
|
+
└── Digit(s)
|
|
783
|
+
├── Fallback <Text> (rendered until digitHeight is measured)
|
|
784
|
+
└── Measured
|
|
785
|
+
└── Mask (RollingNumberMaskComponent)
|
|
786
|
+
└── Animated.View (digit container): vertical stack of digits 0-9 (use translateY to position the current digit)
|
|
787
|
+
```
|
|
788
|
+
|
|
789
|
+
|