@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,1021 @@
|
|
|
1
|
+
# RollingNumber
|
|
2
|
+
|
|
3
|
+
A numeric display that animates value changes with rolling digits.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { RollingNumber } from '@coinbase/cds-web/numbers/RollingNumber'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
|
|
13
|
+
### Basic Example
|
|
14
|
+
|
|
15
|
+
RollingNumber displays changing numeric values with a smooth per-digit roll animation and optional color pulse. It supports full `Intl.NumberFormat` options, custom typography, ReactNode prefixes/suffixes, and accessibility.
|
|
16
|
+
|
|
17
|
+
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.
|
|
18
|
+
|
|
19
|
+
```tsx live
|
|
20
|
+
function Example() {
|
|
21
|
+
const values = [12345.67, 123340.011, 1220340.0123];
|
|
22
|
+
const [valIdx, setValIdx] = useState(0);
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<VStack gap={3}>
|
|
26
|
+
<RollingNumber value={values[valIdx]} font="display3" />
|
|
27
|
+
<Button
|
|
28
|
+
onClick={() => {
|
|
29
|
+
setValIdx((prev) => (prev + 1) % values.length);
|
|
30
|
+
}}
|
|
31
|
+
alignSelf="flex-start"
|
|
32
|
+
>
|
|
33
|
+
Next
|
|
34
|
+
</Button>
|
|
35
|
+
</VStack>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Example Use Case
|
|
41
|
+
|
|
42
|
+
```tsx live
|
|
43
|
+
function Examples() {
|
|
44
|
+
const [price, setPrice] = useState<number>(12345.67);
|
|
45
|
+
const [difference, setDifference] = useState<number>(0);
|
|
46
|
+
const onNext = () =>
|
|
47
|
+
setPrice((p) => {
|
|
48
|
+
const delta = (Math.random() - 0.5) * 200; // +/- 100
|
|
49
|
+
const next = Math.max(0, p + delta);
|
|
50
|
+
const newPrice = Math.round(next * 100) / 100;
|
|
51
|
+
setDifference(newPrice - p);
|
|
52
|
+
return newPrice;
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const trendColor = difference >= 0 ? 'fgPositive' : 'fgNegative';
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<VStack gap={2}>
|
|
59
|
+
<Text font="label1">Portfolio Balance</Text>
|
|
60
|
+
<RollingNumber
|
|
61
|
+
colorPulseOnUpdate
|
|
62
|
+
font="display3"
|
|
63
|
+
format={{ style: 'currency', currency: 'USD' }}
|
|
64
|
+
value={price}
|
|
65
|
+
/>
|
|
66
|
+
<HStack alignItems="center">
|
|
67
|
+
<RollingNumber
|
|
68
|
+
accessibilityLabelPrefix={difference > 0 ? 'up ' : difference < 0 ? 'down ' : ''}
|
|
69
|
+
color={trendColor}
|
|
70
|
+
font="body"
|
|
71
|
+
format={{
|
|
72
|
+
style: 'currency',
|
|
73
|
+
currency: 'USD',
|
|
74
|
+
minimumFractionDigits: 2,
|
|
75
|
+
maximumFractionDigits: 2,
|
|
76
|
+
}}
|
|
77
|
+
prefix={
|
|
78
|
+
difference >= 0 ? (
|
|
79
|
+
<Icon color={trendColor} name="diagonalUpArrow" size="xs" />
|
|
80
|
+
) : (
|
|
81
|
+
<Icon color={trendColor} name="diagonalDownArrow" size="xs" />
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
styles={{
|
|
85
|
+
prefix: {
|
|
86
|
+
paddingRight: 'var(--space-1)',
|
|
87
|
+
},
|
|
88
|
+
}}
|
|
89
|
+
suffix={`(${((Math.abs(difference) / price) * 100).toFixed(2)}%)`}
|
|
90
|
+
value={Math.abs(difference)}
|
|
91
|
+
/>
|
|
92
|
+
</HStack>
|
|
93
|
+
<Text font="label1">BTC Conversion</Text>
|
|
94
|
+
<HStack alignItems="center" gap={1}>
|
|
95
|
+
<Icon color="fgPrimary" name="arrowsVertical" size="xs" testID="swap-icon" />
|
|
96
|
+
<RollingNumber
|
|
97
|
+
color="fgPrimary"
|
|
98
|
+
fontFamily="body"
|
|
99
|
+
fontSize="body"
|
|
100
|
+
fontWeight="body"
|
|
101
|
+
format={{ minimumFractionDigits: 8, maximumFractionDigits: 8 }}
|
|
102
|
+
value={price / 150_000}
|
|
103
|
+
/>
|
|
104
|
+
</HStack>
|
|
105
|
+
<Button alignSelf="flex-start" onClick={onNext}>
|
|
106
|
+
Next
|
|
107
|
+
</Button>
|
|
108
|
+
</VStack>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Formatting
|
|
114
|
+
|
|
115
|
+
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).
|
|
116
|
+
|
|
117
|
+
```tsx live
|
|
118
|
+
function Example() {
|
|
119
|
+
const [value, setValue] = React.useState(92345.67);
|
|
120
|
+
const onNext = () => setValue((v) => v * 13.5);
|
|
121
|
+
return (
|
|
122
|
+
<VStack gap={2}>
|
|
123
|
+
<Text as="p" display="block" font="label1">
|
|
124
|
+
Compact number with currency sign
|
|
125
|
+
</Text>
|
|
126
|
+
<h1>
|
|
127
|
+
<RollingNumber
|
|
128
|
+
font="display1"
|
|
129
|
+
format={{
|
|
130
|
+
style: 'currency',
|
|
131
|
+
currency: 'USD',
|
|
132
|
+
minimumFractionDigits: 2,
|
|
133
|
+
maximumFractionDigits: 2,
|
|
134
|
+
notation: 'compact',
|
|
135
|
+
}}
|
|
136
|
+
value={value}
|
|
137
|
+
/>
|
|
138
|
+
</h1>
|
|
139
|
+
<Button alignSelf="flex-start" onClick={onNext}>
|
|
140
|
+
Next
|
|
141
|
+
</Button>
|
|
142
|
+
<Text as="p" display="block" font="label1">
|
|
143
|
+
Number without grouping
|
|
144
|
+
</Text>
|
|
145
|
+
<RollingNumber
|
|
146
|
+
font="display1"
|
|
147
|
+
format={{
|
|
148
|
+
useGrouping: false,
|
|
149
|
+
}}
|
|
150
|
+
value={92345.67}
|
|
151
|
+
/>
|
|
152
|
+
</VStack>
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Typography
|
|
158
|
+
|
|
159
|
+
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.
|
|
160
|
+
|
|
161
|
+
```tsx live
|
|
162
|
+
function Example() {
|
|
163
|
+
const [price, setPrice] = React.useState(9876.54);
|
|
164
|
+
const onNext = () =>
|
|
165
|
+
setPrice((p) => Math.max(0, Math.round((p + (Math.random() - 0.5) * 100) * 100) / 100));
|
|
166
|
+
return (
|
|
167
|
+
<VStack gap={2}>
|
|
168
|
+
<Text as="p" display="block" font="label1">
|
|
169
|
+
Font sizes, weights, and line heights
|
|
170
|
+
</Text>
|
|
171
|
+
<RollingNumber
|
|
172
|
+
fontSize="display3"
|
|
173
|
+
fontWeight="title3"
|
|
174
|
+
value={price}
|
|
175
|
+
format={{ style: 'currency', currency: 'USD' }}
|
|
176
|
+
/>
|
|
177
|
+
<RollingNumber
|
|
178
|
+
fontSize="title3"
|
|
179
|
+
fontWeight="headline"
|
|
180
|
+
value={price}
|
|
181
|
+
format={{ style: 'currency', currency: 'USD' }}
|
|
182
|
+
/>
|
|
183
|
+
<RollingNumber
|
|
184
|
+
fontSize="body"
|
|
185
|
+
fontWeight="body"
|
|
186
|
+
lineHeight="display3"
|
|
187
|
+
value={price}
|
|
188
|
+
format={{ style: 'currency', currency: 'USD' }}
|
|
189
|
+
/>
|
|
190
|
+
<Text as="p" display="block" font="label1">
|
|
191
|
+
Responsive font (phone, tablet, desktop)
|
|
192
|
+
</Text>
|
|
193
|
+
<RollingNumber
|
|
194
|
+
font={{ phone: 'body', tablet: 'title3', desktop: 'display3' }}
|
|
195
|
+
format={{ style: 'currency', currency: 'USD' }}
|
|
196
|
+
value={price}
|
|
197
|
+
/>
|
|
198
|
+
<Text as="p" display="block" font="label1">
|
|
199
|
+
Tabular numbers vs non-tabular
|
|
200
|
+
</Text>
|
|
201
|
+
<RollingNumber
|
|
202
|
+
font="display3"
|
|
203
|
+
format={{ style: 'currency', currency: 'USD' }}
|
|
204
|
+
value={price}
|
|
205
|
+
/>
|
|
206
|
+
<RollingNumber
|
|
207
|
+
tabularNumbers={false}
|
|
208
|
+
font="display3"
|
|
209
|
+
format={{ style: 'currency', currency: 'USD' }}
|
|
210
|
+
value={price}
|
|
211
|
+
/>
|
|
212
|
+
<Button alignSelf="flex-start" onClick={onNext}>
|
|
213
|
+
Next
|
|
214
|
+
</Button>
|
|
215
|
+
</VStack>
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
::::tip Alignment
|
|
221
|
+
Keep `tabularNumbers` enabled (default) to avoid horizontal width shifting as digits change.
|
|
222
|
+
::::
|
|
223
|
+
|
|
224
|
+
### Color and Transition
|
|
225
|
+
|
|
226
|
+
Customize color and motion. Configure `y` to control the digit roll, and `color` for the pulse.
|
|
227
|
+
|
|
228
|
+
##### `transition` prop
|
|
229
|
+
|
|
230
|
+
- Type: `{ y?: Transition; color?: Transition }` (framer-motion `Transition`)
|
|
231
|
+
- Optional `type`: `'tween' | 'spring' | 'inertia'`; defaults to `'tween'` if not provided
|
|
232
|
+
- Default: `{ y: { duration: durations.moderate3 / 1000, ease: curves.global }, color: { duration: durations.slow4 / 1000, ease: curves.global } }`
|
|
233
|
+
|
|
234
|
+
```tsx live
|
|
235
|
+
function Example() {
|
|
236
|
+
const [price, setPrice] = React.useState(555.55);
|
|
237
|
+
const onNext = () =>
|
|
238
|
+
setPrice((p) => Math.max(0, Math.round((p + (Math.random() - 0.5) * 50) * 100) / 100));
|
|
239
|
+
|
|
240
|
+
return (
|
|
241
|
+
<VStack gap={2}>
|
|
242
|
+
<Text as="p" display="block" font="label1">
|
|
243
|
+
Color pulse and custom transition
|
|
244
|
+
</Text>
|
|
245
|
+
<RollingNumber
|
|
246
|
+
colorPulseOnUpdate
|
|
247
|
+
font="title1"
|
|
248
|
+
format={{ style: 'currency', currency: 'USD' }}
|
|
249
|
+
transition={{
|
|
250
|
+
color: { duration: 0.3, ease: 'easeInOut' },
|
|
251
|
+
y: { duration: 0.3, ease: 'easeIn' },
|
|
252
|
+
}}
|
|
253
|
+
value={price}
|
|
254
|
+
/>
|
|
255
|
+
|
|
256
|
+
<RollingNumber
|
|
257
|
+
colorPulseOnUpdate
|
|
258
|
+
color="accentBoldBlue"
|
|
259
|
+
font="title1"
|
|
260
|
+
format={{ style: 'currency', currency: 'USD' }}
|
|
261
|
+
transition={{
|
|
262
|
+
color: { duration: 1.2, ease: 'easeInOut' },
|
|
263
|
+
y: { duration: 1.2, ease: 'easeIn' },
|
|
264
|
+
}}
|
|
265
|
+
value={price}
|
|
266
|
+
/>
|
|
267
|
+
|
|
268
|
+
<Text as="p" display="block" font="label1">
|
|
269
|
+
Customize positive and negative change colors
|
|
270
|
+
</Text>
|
|
271
|
+
<RollingNumber
|
|
272
|
+
colorPulseOnUpdate
|
|
273
|
+
font="title1"
|
|
274
|
+
negativePulseColor="bgWarning"
|
|
275
|
+
positivePulseColor="fgPrimary"
|
|
276
|
+
value={price}
|
|
277
|
+
/>
|
|
278
|
+
|
|
279
|
+
<Text as="p" display="block" font="label1">
|
|
280
|
+
Fast digits, slow color
|
|
281
|
+
</Text>
|
|
282
|
+
<RollingNumber
|
|
283
|
+
colorPulseOnUpdate
|
|
284
|
+
font="title1"
|
|
285
|
+
format={{ style: 'currency', currency: 'USD' }}
|
|
286
|
+
transition={{
|
|
287
|
+
y: { duration: 0.1, ease: 'easeIn' },
|
|
288
|
+
color: { duration: 1.2, ease: 'easeInOut' },
|
|
289
|
+
}}
|
|
290
|
+
value={price}
|
|
291
|
+
/>
|
|
292
|
+
|
|
293
|
+
<Text as="p" display="block" font="label1">
|
|
294
|
+
Springy digits
|
|
295
|
+
</Text>
|
|
296
|
+
<RollingNumber
|
|
297
|
+
colorPulseOnUpdate
|
|
298
|
+
font="title1"
|
|
299
|
+
format={{ style: 'currency', currency: 'USD' }}
|
|
300
|
+
transition={{
|
|
301
|
+
y: {
|
|
302
|
+
type: 'spring',
|
|
303
|
+
stiffness: 1000,
|
|
304
|
+
damping: 24,
|
|
305
|
+
mass: 3,
|
|
306
|
+
},
|
|
307
|
+
}}
|
|
308
|
+
value={price}
|
|
309
|
+
/>
|
|
310
|
+
|
|
311
|
+
<Text as="p" display="block" font="label1">
|
|
312
|
+
Custom easings
|
|
313
|
+
</Text>
|
|
314
|
+
<RollingNumber
|
|
315
|
+
colorPulseOnUpdate
|
|
316
|
+
font="title1"
|
|
317
|
+
format={{ style: 'currency', currency: 'USD' }}
|
|
318
|
+
transition={{
|
|
319
|
+
y: { duration: 0.25, ease: 'easeOut' },
|
|
320
|
+
color: { duration: 0.5, ease: 'easeInOut' },
|
|
321
|
+
}}
|
|
322
|
+
value={price}
|
|
323
|
+
/>
|
|
324
|
+
<Button alignSelf="flex-start" onClick={onNext}>
|
|
325
|
+
Next
|
|
326
|
+
</Button>
|
|
327
|
+
</VStack>
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
### Prefix and Suffix
|
|
333
|
+
|
|
334
|
+
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.
|
|
335
|
+
|
|
336
|
+
```tsx live
|
|
337
|
+
function Example() {
|
|
338
|
+
const values = [98345.67, 91345.67, 123450.123, 1234512.88];
|
|
339
|
+
const textPrefixes = ['+', '-', ''];
|
|
340
|
+
const textSuffixes = [' BTC', ' ETH', ''];
|
|
341
|
+
const iconPrefixes = [
|
|
342
|
+
<Icon key="arrowUp" name="arrowUp" size="l" />,
|
|
343
|
+
<Icon key="arrowDown" name="arrowDown" size="l" />,
|
|
344
|
+
null,
|
|
345
|
+
];
|
|
346
|
+
const iconSuffixes = [
|
|
347
|
+
<Icon key="arrowDown" name="arrowDown" size="l" />,
|
|
348
|
+
<Icon key="arrowUp" name="arrowUp" size="l" />,
|
|
349
|
+
null,
|
|
350
|
+
];
|
|
351
|
+
const [idx, setIdx] = React.useState(0);
|
|
352
|
+
const onNext = () => setIdx((i) => (i + 1) % values.length);
|
|
353
|
+
const value = values[idx];
|
|
354
|
+
const format = {
|
|
355
|
+
style: 'currency' as const,
|
|
356
|
+
currency: 'USD',
|
|
357
|
+
minimumFractionDigits: 2,
|
|
358
|
+
maximumFractionDigits: 5,
|
|
359
|
+
};
|
|
360
|
+
return (
|
|
361
|
+
<VStack gap={2}>
|
|
362
|
+
<Text as="p" display="block" font="label1">
|
|
363
|
+
Simple text prefix and suffix
|
|
364
|
+
</Text>
|
|
365
|
+
<RollingNumber
|
|
366
|
+
colorPulseOnUpdate
|
|
367
|
+
font="display1"
|
|
368
|
+
format={format}
|
|
369
|
+
prefix={textPrefixes[idx]}
|
|
370
|
+
suffix={textSuffixes[idx]}
|
|
371
|
+
value={value}
|
|
372
|
+
/>
|
|
373
|
+
|
|
374
|
+
<Text as="p" display="block" font="label1">
|
|
375
|
+
ReactNode prefix and suffix
|
|
376
|
+
</Text>
|
|
377
|
+
<RollingNumber
|
|
378
|
+
colorPulseOnUpdate
|
|
379
|
+
font="display1"
|
|
380
|
+
format={format}
|
|
381
|
+
prefix={iconPrefixes[idx]}
|
|
382
|
+
suffix={iconSuffixes[idx]}
|
|
383
|
+
value={value}
|
|
384
|
+
/>
|
|
385
|
+
|
|
386
|
+
<Button alignSelf="flex-start" onClick={onNext}>
|
|
387
|
+
Next
|
|
388
|
+
</Button>
|
|
389
|
+
</VStack>
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
```tsx live
|
|
395
|
+
function SubscriptionPriceExample() {
|
|
396
|
+
const [yearly, setYearly] = React.useState(false);
|
|
397
|
+
const price = yearly ? 199 : 19;
|
|
398
|
+
const suffix = yearly ? '/yr' : '/mo';
|
|
399
|
+
return (
|
|
400
|
+
<VStack gap={1}>
|
|
401
|
+
<RollingNumber
|
|
402
|
+
colorPulseOnUpdate
|
|
403
|
+
accessibilityLabel={`$${price} ${suffix === '/yr' ? 'yearly' : 'monthly'}`}
|
|
404
|
+
font="display1"
|
|
405
|
+
format={{
|
|
406
|
+
style: 'currency',
|
|
407
|
+
currency: 'USD',
|
|
408
|
+
minimumFractionDigits: 0,
|
|
409
|
+
maximumFractionDigits: 0,
|
|
410
|
+
}}
|
|
411
|
+
styles={{
|
|
412
|
+
suffix: {
|
|
413
|
+
position: 'relative',
|
|
414
|
+
top: 'var(--space-1_5)',
|
|
415
|
+
color: 'var(--color-fgMuted)',
|
|
416
|
+
fontSize: 'var(--fontSize-title1)',
|
|
417
|
+
},
|
|
418
|
+
}}
|
|
419
|
+
suffix={suffix}
|
|
420
|
+
transition={{
|
|
421
|
+
y: { type: 'spring', stiffness: 80, damping: 24, mass: 3 },
|
|
422
|
+
}}
|
|
423
|
+
value={price}
|
|
424
|
+
/>
|
|
425
|
+
<Button alignSelf="flex-start" onClick={() => setYearly((v) => !v)}>
|
|
426
|
+
{yearly ? 'Switch to monthly' : 'Switch to yearly'}
|
|
427
|
+
</Button>
|
|
428
|
+
</VStack>
|
|
429
|
+
);
|
|
430
|
+
}
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
::::tip Accessibility
|
|
434
|
+
When using React nodes for `prefix`/`suffix`, provide an `accessibilityLabel` or use `accessibilityLabelPrefix`/`accessibilityLabelSuffix` so screen readers announce a descriptive string.
|
|
435
|
+
::::
|
|
436
|
+
|
|
437
|
+
### Style Overrides
|
|
438
|
+
|
|
439
|
+
Customize the look of each logical section (`i18nPrefix`, `integer`, `fraction`, `i18nSuffix`, `prefix`, `suffix`).
|
|
440
|
+
|
|
441
|
+
```tsx live
|
|
442
|
+
function Example() {
|
|
443
|
+
const [price, setPrice] = React.useState(12345.67);
|
|
444
|
+
const onNext = () => {
|
|
445
|
+
setPrice((p) => Math.max(0, Math.round((p + (Math.random() - 0.5) * 200) * 100) / 100));
|
|
446
|
+
};
|
|
447
|
+
return (
|
|
448
|
+
<VStack gap={2}>
|
|
449
|
+
<Text as="p" display="block" font="label1">
|
|
450
|
+
Customize per-section styles
|
|
451
|
+
</Text>
|
|
452
|
+
<RollingNumber
|
|
453
|
+
colorPulseOnUpdate
|
|
454
|
+
font="display1"
|
|
455
|
+
format={{
|
|
456
|
+
style: 'currency',
|
|
457
|
+
currency: 'USD',
|
|
458
|
+
minimumFractionDigits: 2,
|
|
459
|
+
notation: 'compact',
|
|
460
|
+
}}
|
|
461
|
+
prefix="-"
|
|
462
|
+
styles={{
|
|
463
|
+
root: {
|
|
464
|
+
border: '1px dashed var(--color-bgLine)',
|
|
465
|
+
padding: '4px 8px',
|
|
466
|
+
borderRadius: 8,
|
|
467
|
+
background: 'var(--color-bgSecondaryWash)',
|
|
468
|
+
},
|
|
469
|
+
i18nPrefix: { color: 'var(--color-accentBoldBlue)' },
|
|
470
|
+
prefix: { color: 'var(--color-accentBoldPurple)' },
|
|
471
|
+
integer: { letterSpacing: '-1px' },
|
|
472
|
+
fraction: { opacity: 0.2, letterSpacing: '10px' },
|
|
473
|
+
i18nSuffix: { color: 'var(--color-fgMuted)' },
|
|
474
|
+
suffix: { color: 'var(--color-accentBoldYellow)', marginLeft: 10 },
|
|
475
|
+
}}
|
|
476
|
+
suffix="BTC"
|
|
477
|
+
value={price}
|
|
478
|
+
/>
|
|
479
|
+
<Button alignSelf="flex-start" onClick={onNext}>
|
|
480
|
+
Next
|
|
481
|
+
</Button>
|
|
482
|
+
</VStack>
|
|
483
|
+
);
|
|
484
|
+
}
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
### Subscript Notation for Tiny Decimals
|
|
488
|
+
|
|
489
|
+
Enable `enableSubscriptNotation` to compactly represent leading zeros in the fractional part.
|
|
490
|
+
|
|
491
|
+
```tsx live
|
|
492
|
+
function Example() {
|
|
493
|
+
const values = [0.0000000001, 0.00009, 0.000012, 0.0000001, 0.000000000000000000000011];
|
|
494
|
+
const [idx, setIdx] = React.useState(0);
|
|
495
|
+
const value = values[idx];
|
|
496
|
+
const format = { minimumFractionDigits: 2, maximumFractionDigits: 25 };
|
|
497
|
+
return (
|
|
498
|
+
<VStack gap={1}>
|
|
499
|
+
<Text as="p" display="block" font="label1">
|
|
500
|
+
Subscript examples
|
|
501
|
+
</Text>
|
|
502
|
+
<Text as="span" display="block" font="label2">
|
|
503
|
+
Default:
|
|
504
|
+
</Text>
|
|
505
|
+
<RollingNumber font="display3" format={format} value={value} />
|
|
506
|
+
<Text as="span" display="block" font="label2">
|
|
507
|
+
With subscript:
|
|
508
|
+
</Text>
|
|
509
|
+
{(['display1', 'title3', 'body'] as const).map((fontKey) => (
|
|
510
|
+
<RollingNumber
|
|
511
|
+
key={fontKey}
|
|
512
|
+
enableSubscriptNotation
|
|
513
|
+
font={fontKey}
|
|
514
|
+
format={format}
|
|
515
|
+
value={value}
|
|
516
|
+
/>
|
|
517
|
+
))}
|
|
518
|
+
<Button alignSelf="flex-start" onClick={() => setIdx((i) => (i + 1) % values.length)}>
|
|
519
|
+
Next
|
|
520
|
+
</Button>
|
|
521
|
+
</VStack>
|
|
522
|
+
);
|
|
523
|
+
}
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
### User-Provided Formatted Value
|
|
527
|
+
|
|
528
|
+
You can also provide `formattedValue`, and the component will render `formattedValue` directly instead of using the internal formatter. The numeric `value` is still required to drive animations and color pulse.
|
|
529
|
+
|
|
530
|
+
```tsx live
|
|
531
|
+
function Example() {
|
|
532
|
+
const btcPrices = [
|
|
533
|
+
{ value: 98765.43, formattedValue: '¥98,765.43 BTC' },
|
|
534
|
+
{ value: 931.42, formattedValue: '$931.42 BTC' },
|
|
535
|
+
{ value: 100890.56, formattedValue: '¥100,890.56 BTC' },
|
|
536
|
+
{ value: 149432.12, formattedValue: '¥149,432.12 BTC' },
|
|
537
|
+
{ value: 150321.23, formattedValue: '¥150,321.23 BTC' },
|
|
538
|
+
];
|
|
539
|
+
const subscripts = [
|
|
540
|
+
{ value: 0.0000000001, formattedValue: '€0,0₉1', accessibilityLabel: '€0.0000000001' },
|
|
541
|
+
{ value: 0.00009, formattedValue: '€0,0₄9', accessibilityLabel: '€0.00009' },
|
|
542
|
+
{ value: 0.000012, formattedValue: '€0,0₄12', accessibilityLabel: '€0.000012' },
|
|
543
|
+
{ value: 0.0000001, formattedValue: '€0,0₆1', accessibilityLabel: '€0.0000001' },
|
|
544
|
+
{
|
|
545
|
+
value: 0.000000000000000000000011,
|
|
546
|
+
formattedValue: '€0,0₂₂11',
|
|
547
|
+
accessibilityLabel: '€0.000000000000000000000011',
|
|
548
|
+
},
|
|
549
|
+
];
|
|
550
|
+
const [idx, setIdx] = React.useState(0);
|
|
551
|
+
const onNext = () => setIdx((i) => (i + 1) % 5);
|
|
552
|
+
return (
|
|
553
|
+
<VStack gap={1}>
|
|
554
|
+
<Text as="p" display="block" font="label1">
|
|
555
|
+
User-provided formatted value
|
|
556
|
+
</Text>
|
|
557
|
+
<Text as="p" display="block" font="label2">
|
|
558
|
+
BTC prices
|
|
559
|
+
</Text>
|
|
560
|
+
<RollingNumber
|
|
561
|
+
colorPulseOnUpdate
|
|
562
|
+
font="display3"
|
|
563
|
+
formattedValue={btcPrices[idx].formattedValue}
|
|
564
|
+
prefix={<Icon name="crypto" size="l" />}
|
|
565
|
+
value={btcPrices[idx].value}
|
|
566
|
+
/>
|
|
567
|
+
<Text as="p" display="block" font="label2">
|
|
568
|
+
Subscripts with a comma as the decimal separator
|
|
569
|
+
</Text>
|
|
570
|
+
<RollingNumber
|
|
571
|
+
colorPulseOnUpdate
|
|
572
|
+
accessibilityLabel={subscripts[idx].accessibilityLabel}
|
|
573
|
+
font="display3"
|
|
574
|
+
formattedValue={subscripts[idx].formattedValue}
|
|
575
|
+
value={subscripts[idx].value}
|
|
576
|
+
/>
|
|
577
|
+
<Button alignSelf="flex-start" onClick={onNext}>
|
|
578
|
+
Next
|
|
579
|
+
</Button>
|
|
580
|
+
</VStack>
|
|
581
|
+
);
|
|
582
|
+
}
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
::::tip Accessibility and formattedValue
|
|
586
|
+
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.
|
|
587
|
+
::::
|
|
588
|
+
|
|
589
|
+
### Patterns & Recipes
|
|
590
|
+
|
|
591
|
+
Practical demos combining formatting, animation, and interactivity.
|
|
592
|
+
|
|
593
|
+
#### Counter
|
|
594
|
+
|
|
595
|
+
```tsx live
|
|
596
|
+
function CounterExample() {
|
|
597
|
+
const [count, setCount] = React.useState(0);
|
|
598
|
+
return (
|
|
599
|
+
<VStack gap={1}>
|
|
600
|
+
<HStack alignItems="center" gap={2}>
|
|
601
|
+
<IconButton name="minus" onClick={() => setCount((c) => Math.max(0, c - 1))} />
|
|
602
|
+
<RollingNumber
|
|
603
|
+
colorPulseOnUpdate
|
|
604
|
+
font="display1"
|
|
605
|
+
format={{ minimumFractionDigits: 0, maximumFractionDigits: 0 }}
|
|
606
|
+
value={count}
|
|
607
|
+
/>
|
|
608
|
+
<IconButton name="add" onClick={() => setCount((c) => c + 1)} />
|
|
609
|
+
</HStack>
|
|
610
|
+
</VStack>
|
|
611
|
+
);
|
|
612
|
+
}
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
#### Countdown
|
|
616
|
+
|
|
617
|
+
```tsx live
|
|
618
|
+
function CountDownExample() {
|
|
619
|
+
const pad = (n: number) => String(n).padStart(2, '0');
|
|
620
|
+
const totalSeconds = 5 * 60;
|
|
621
|
+
const [seconds, setSeconds] = React.useState(totalSeconds);
|
|
622
|
+
const [running, setRunning] = React.useState(false);
|
|
623
|
+
|
|
624
|
+
React.useEffect(() => {
|
|
625
|
+
if (!running) return;
|
|
626
|
+
const id = setInterval(() => {
|
|
627
|
+
setSeconds((prev) => {
|
|
628
|
+
if (prev <= 1) {
|
|
629
|
+
clearInterval(id);
|
|
630
|
+
return 0;
|
|
631
|
+
}
|
|
632
|
+
return prev - 1;
|
|
633
|
+
});
|
|
634
|
+
}, 1000);
|
|
635
|
+
return () => clearInterval(id);
|
|
636
|
+
}, [running]);
|
|
637
|
+
|
|
638
|
+
const minutes = Math.floor(seconds / 60);
|
|
639
|
+
const secs = seconds % 60;
|
|
640
|
+
const formatted = `${pad(minutes)}:${pad(secs)}`;
|
|
641
|
+
|
|
642
|
+
const onReset = () => setSeconds(totalSeconds);
|
|
643
|
+
const progress = Math.max(0, Math.min(1, (totalSeconds - seconds) / totalSeconds));
|
|
644
|
+
|
|
645
|
+
return (
|
|
646
|
+
<VStack gap={1}>
|
|
647
|
+
<RollingNumber font="display3" formattedValue={formatted} value={seconds} ariaLive="off" />
|
|
648
|
+
<HStack gap={2}>
|
|
649
|
+
<Button onClick={() => setRunning((r) => !r)}>{running ? 'Pause' : 'Start'}</Button>
|
|
650
|
+
<Button onClick={onReset}>Reset</Button>
|
|
651
|
+
</HStack>
|
|
652
|
+
|
|
653
|
+
<Text font="label1">Countdown with percent</Text>
|
|
654
|
+
<VStack gap={1}>
|
|
655
|
+
<ProgressBar progress={progress} />
|
|
656
|
+
<RollingNumber
|
|
657
|
+
font="body"
|
|
658
|
+
format={{ style: 'percent', maximumFractionDigits: 0 }}
|
|
659
|
+
prefix="Elapsed: "
|
|
660
|
+
value={progress}
|
|
661
|
+
ariaLive="off"
|
|
662
|
+
/>
|
|
663
|
+
</VStack>
|
|
664
|
+
</VStack>
|
|
665
|
+
);
|
|
666
|
+
}
|
|
667
|
+
```
|
|
668
|
+
|
|
669
|
+
#### Live Auction
|
|
670
|
+
|
|
671
|
+
```tsx live
|
|
672
|
+
function LiveBiddingExample() {
|
|
673
|
+
const [currentBid, setCurrentBid] = useState(45000);
|
|
674
|
+
const [bidCount, setBidCount] = useState(23);
|
|
675
|
+
const [timeLeft, setTimeLeft] = useState(180);
|
|
676
|
+
|
|
677
|
+
React.useEffect(() => {
|
|
678
|
+
const timer = setInterval(() => {
|
|
679
|
+
setTimeLeft((t) => Math.max(0, t - 1));
|
|
680
|
+
}, 1000);
|
|
681
|
+
return () => clearInterval(timer);
|
|
682
|
+
}, []);
|
|
683
|
+
|
|
684
|
+
const placeBid = (increment: number) => {
|
|
685
|
+
setCurrentBid((b) => b + increment);
|
|
686
|
+
setBidCount((c) => c + 1);
|
|
687
|
+
};
|
|
688
|
+
|
|
689
|
+
const minutes = Math.floor(timeLeft / 60);
|
|
690
|
+
const seconds = timeLeft % 60;
|
|
691
|
+
|
|
692
|
+
return (
|
|
693
|
+
<VStack gap={2}>
|
|
694
|
+
<VStack gap={1}>
|
|
695
|
+
<Text color="fgMuted" font="caption">
|
|
696
|
+
Current Bid
|
|
697
|
+
</Text>
|
|
698
|
+
<RollingNumber
|
|
699
|
+
colorPulseOnUpdate
|
|
700
|
+
font="display2"
|
|
701
|
+
format={{ style: 'currency', currency: 'USD', minimumFractionDigits: 0 }}
|
|
702
|
+
positivePulseColor="accentBoldRed"
|
|
703
|
+
transition={{
|
|
704
|
+
y: { type: 'spring', stiffness: 200, damping: 20 },
|
|
705
|
+
}}
|
|
706
|
+
value={currentBid}
|
|
707
|
+
/>
|
|
708
|
+
<HStack gap={1}>
|
|
709
|
+
<RollingNumber font="body" format={{ minimumFractionDigits: 0 }} value={bidCount} />
|
|
710
|
+
<Text font="body">bids placed</Text>
|
|
711
|
+
<Text color="fgMuted" font="body">
|
|
712
|
+
•
|
|
713
|
+
</Text>
|
|
714
|
+
<RollingNumber
|
|
715
|
+
color={timeLeft < 30 ? 'fgNegative' : 'fg'}
|
|
716
|
+
font="body"
|
|
717
|
+
formattedValue={`${minutes}:${String(seconds).padStart(2, '0')}`}
|
|
718
|
+
value={timeLeft}
|
|
719
|
+
ariaLive="off"
|
|
720
|
+
/>
|
|
721
|
+
<Text font="body">remaining</Text>
|
|
722
|
+
</HStack>
|
|
723
|
+
</VStack>
|
|
724
|
+
<HStack gap={1}>
|
|
725
|
+
<Button onClick={() => placeBid(100)}>+$100</Button>
|
|
726
|
+
<Button onClick={() => placeBid(500)}>+$500</Button>
|
|
727
|
+
<Button onClick={() => placeBid(1000)}>+$1000</Button>
|
|
728
|
+
</HStack>
|
|
729
|
+
</VStack>
|
|
730
|
+
);
|
|
731
|
+
}
|
|
732
|
+
```
|
|
733
|
+
|
|
734
|
+
#### Social Media Statistics
|
|
735
|
+
|
|
736
|
+
```tsx live
|
|
737
|
+
function StatisticsExample() {
|
|
738
|
+
const [views, setViews] = useState(1234567);
|
|
739
|
+
const [likes, setLikes] = useState(89432);
|
|
740
|
+
const [shares, setShares] = useState(12789);
|
|
741
|
+
const [downloads, setDownloads] = useState(567890);
|
|
742
|
+
|
|
743
|
+
const simulateActivity = () => {
|
|
744
|
+
setViews((v) => v + Math.floor(Math.random() * 1000));
|
|
745
|
+
setLikes((l) => l + Math.floor(Math.random() * 200));
|
|
746
|
+
setShares((s) => s + Math.floor(Math.random() * 100));
|
|
747
|
+
setDownloads((d) => d + Math.floor(Math.random() * 500));
|
|
748
|
+
};
|
|
749
|
+
|
|
750
|
+
return (
|
|
751
|
+
<VStack gap={2}>
|
|
752
|
+
<HStack gap={4}>
|
|
753
|
+
<VStack alignItems="center" gap={0.5}>
|
|
754
|
+
<RollingNumber
|
|
755
|
+
colorPulseOnUpdate
|
|
756
|
+
font="title1"
|
|
757
|
+
format={{ notation: 'compact', maximumFractionDigits: 1, minimumFractionDigits: 1 }}
|
|
758
|
+
positivePulseColor="accentBoldBlue"
|
|
759
|
+
value={views}
|
|
760
|
+
/>
|
|
761
|
+
<Text color="fgMuted" font="caption">
|
|
762
|
+
Views
|
|
763
|
+
</Text>
|
|
764
|
+
</VStack>
|
|
765
|
+
<VStack alignItems="center" gap={0.5}>
|
|
766
|
+
<RollingNumber
|
|
767
|
+
colorPulseOnUpdate
|
|
768
|
+
font="title1"
|
|
769
|
+
format={{ notation: 'compact', maximumFractionDigits: 1, minimumFractionDigits: 1 }}
|
|
770
|
+
positivePulseColor="accentBoldRed"
|
|
771
|
+
prefix={<Icon color="accentBoldRed" name="heart" />}
|
|
772
|
+
styles={{ prefix: { paddingRight: 'var(--space-0_5)' } }}
|
|
773
|
+
value={likes}
|
|
774
|
+
/>
|
|
775
|
+
<Text color="fgMuted" font="caption">
|
|
776
|
+
Likes
|
|
777
|
+
</Text>
|
|
778
|
+
</VStack>
|
|
779
|
+
<VStack alignItems="center" gap={0.5}>
|
|
780
|
+
<RollingNumber
|
|
781
|
+
colorPulseOnUpdate
|
|
782
|
+
font="title1"
|
|
783
|
+
format={{ notation: 'compact', maximumFractionDigits: 1, minimumFractionDigits: 1 }}
|
|
784
|
+
positivePulseColor="accentBoldGreen"
|
|
785
|
+
value={shares}
|
|
786
|
+
/>
|
|
787
|
+
<Text color="fgMuted" font="caption">
|
|
788
|
+
Shares
|
|
789
|
+
</Text>
|
|
790
|
+
</VStack>
|
|
791
|
+
<VStack alignItems="center" gap={0.5}>
|
|
792
|
+
<RollingNumber
|
|
793
|
+
colorPulseOnUpdate
|
|
794
|
+
font="title1"
|
|
795
|
+
format={{ notation: 'compact', maximumFractionDigits: 1, minimumFractionDigits: 1 }}
|
|
796
|
+
positivePulseColor="accentBoldPurple"
|
|
797
|
+
value={downloads}
|
|
798
|
+
/>
|
|
799
|
+
<Text color="fgMuted" font="caption">
|
|
800
|
+
Downloads
|
|
801
|
+
</Text>
|
|
802
|
+
</VStack>
|
|
803
|
+
</HStack>
|
|
804
|
+
<Button alignSelf="flex-start" onClick={simulateActivity}>
|
|
805
|
+
Simulate Activity
|
|
806
|
+
</Button>
|
|
807
|
+
</VStack>
|
|
808
|
+
);
|
|
809
|
+
}
|
|
810
|
+
```
|
|
811
|
+
|
|
812
|
+
### Anatomy & Customization
|
|
813
|
+
|
|
814
|
+
RollingNumber is composed of small, swappable subcomponents and exposes granular className/style hooks for each section of the number. Use these to customize structure and styling or to plug in your own components.
|
|
815
|
+
|
|
816
|
+
#### Subcomponents
|
|
817
|
+
|
|
818
|
+
- **RollingNumberMaskComponent**: Component used to mask the animated digit content.
|
|
819
|
+
- **RollingNumberAffixSectionComponent**: Component used to render ReactNode `prefix` / `suffix` props.
|
|
820
|
+
- **RollingNumberValueSectionComponent**: Component used to render the four `Intl.NumberFormat` sections (`i18nPrefix`, `integer`, `fraction`, `i18nSuffix`).
|
|
821
|
+
- **RollingNumberDigitComponent**: Component used to render the per-digit roll animation.
|
|
822
|
+
- **RollingNumberSymbolComponent**: Component used to render non-digit symbols (group separators, decimal, literals, etc.).
|
|
823
|
+
|
|
824
|
+
You can replace any of these with your own components via props:
|
|
825
|
+
|
|
826
|
+
```tsx
|
|
827
|
+
<RollingNumber
|
|
828
|
+
RollingNumberMaskComponent={MyMask}
|
|
829
|
+
RollingNumberAffixSectionComponent={MyAffixSection}
|
|
830
|
+
RollingNumberValueSectionComponent={MyValueSection}
|
|
831
|
+
RollingNumberDigitComponent={MyDigit}
|
|
832
|
+
RollingNumberSymbolComponent={MySymbol}
|
|
833
|
+
value={1234.56}
|
|
834
|
+
format={{ style: 'currency', currency: 'USD' }}
|
|
835
|
+
/>
|
|
836
|
+
```
|
|
837
|
+
|
|
838
|
+
#### Class name overrides
|
|
839
|
+
|
|
840
|
+
Use `classNames` to target specific parts for CSS styling (Linaria or your own classes):
|
|
841
|
+
|
|
842
|
+
- **root**: Outer container (`Text` root)
|
|
843
|
+
- **visibleContent**: Motion-wrapped span containing the visible number (color animation lives here)
|
|
844
|
+
- **formattedValueSection**: Container around the four i18n sections
|
|
845
|
+
- **i18nPrefix**: Section generated by `Intl.NumberFormat` before the number
|
|
846
|
+
- **integer**: Integer part of the number
|
|
847
|
+
- **fraction**: Fractional part of the number
|
|
848
|
+
- **i18nSuffix**: Section generated by `Intl.NumberFormat` after the number
|
|
849
|
+
- **prefix**: Wrapper around your `prefix` prop
|
|
850
|
+
- **suffix**: Wrapper around your `suffix` prop
|
|
851
|
+
- **text**: `Text` element used for digits, separators, prefix, and suffix
|
|
852
|
+
|
|
853
|
+
#### Style overrides
|
|
854
|
+
|
|
855
|
+
Use `styles` to inline style specific parts:
|
|
856
|
+
|
|
857
|
+
- **root**, **visibleContent**, **formattedValueSection**, **i18nPrefix**, **integer**, **fraction**, **i18nSuffix**, **prefix**, **suffix**, **text**
|
|
858
|
+
|
|
859
|
+
`styles.text` applies to the shared `Text` component that renders digits, symbols, prefix, and suffix.
|
|
860
|
+
|
|
861
|
+
#### Structure diagrams
|
|
862
|
+
|
|
863
|
+
High-level anatomy of RollingNumber and its sections:
|
|
864
|
+
|
|
865
|
+
```text
|
|
866
|
+
RollingNumber (root: Text)
|
|
867
|
+
├── screenReaderOnly <span aria-live> (hidden a11y text)
|
|
868
|
+
└── <m.span> (visibleContent)
|
|
869
|
+
├── AffixSection (prefix) ← your ReactNode prefix
|
|
870
|
+
├── HStack (formattedValueSection)
|
|
871
|
+
│ ├── ValueSection (i18nPrefix)
|
|
872
|
+
│ ├── ValueSection (integer)
|
|
873
|
+
│ ├── ValueSection (fraction)
|
|
874
|
+
│ └── ValueSection (i18nSuffix)
|
|
875
|
+
└── AffixSection (suffix) ← your ReactNode suffix
|
|
876
|
+
```
|
|
877
|
+
|
|
878
|
+
Per-digit rendering inside a ValueSection:
|
|
879
|
+
|
|
880
|
+
```text
|
|
881
|
+
ValueSection
|
|
882
|
+
├── Symbol(s) (e.g., currency, group, decimal)
|
|
883
|
+
└── Digit(s)
|
|
884
|
+
└── Mask
|
|
885
|
+
└── DigitContainer (animated)
|
|
886
|
+
├── non-active digits above (positioned)
|
|
887
|
+
├── active digit (centered)
|
|
888
|
+
└── non-active digits below (positioned)
|
|
889
|
+
```
|
|
890
|
+
|
|
891
|
+
## Props
|
|
892
|
+
|
|
893
|
+
| Prop | Type | Required | Default | Description |
|
|
894
|
+
| --- | --- | --- | --- | --- |
|
|
895
|
+
| `value` | `number` | Yes | `-` | Number to display. |
|
|
896
|
+
| `RollingNumberAffixSectionComponent` | `RollingNumberAffixSectionComponent` | No | `-` | Component used to render prefix and suffix sections. |
|
|
897
|
+
| `RollingNumberDigitComponent` | `RollingNumberDigitComponent` | No | `-` | Component used to render individual digits. |
|
|
898
|
+
| `RollingNumberMaskComponent` | `RollingNumberMaskComponent` | No | `-` | Component used to render the mask container. |
|
|
899
|
+
| `RollingNumberSymbolComponent` | `RollingNumberSymbolComponent` | No | `-` | Component used to render separators and other symbols. |
|
|
900
|
+
| `RollingNumberValueSectionComponent` | `RollingNumberValueSectionComponent` | No | `-` | Component used to render the numeric sections. |
|
|
901
|
+
| `accessibilityLabelPrefix` | `string` | No | `-` | Accessibility label prefix announced before the value. |
|
|
902
|
+
| `accessibilityLabelSuffix` | `string` | No | `-` | Accessibility label suffix announced after the value. |
|
|
903
|
+
| `alignContent` | `ResponsiveProp<center \| normal \| start \| end \| flex-start \| flex-end \| stretch \| baseline \| first baseline \| last baseline \| space-between \| space-around \| space-evenly>` | No | `-` | - |
|
|
904
|
+
| `alignItems` | `ResponsiveProp<center \| normal \| start \| end \| flex-start \| flex-end \| self-start \| self-end \| stretch \| baseline \| first baseline \| last baseline>` | No | `-` | - |
|
|
905
|
+
| `alignSelf` | `ResponsiveProp<center \| normal \| auto \| start \| end \| flex-start \| flex-end \| self-start \| self-end \| stretch \| baseline \| first baseline \| last baseline>` | No | `-` | - |
|
|
906
|
+
| `ariaLive` | `off \| assertive \| polite` | No | `-` | aria-live politeness level. Defaults to {@code polite}. |
|
|
907
|
+
| `as` | `symbol \| object \| style \| svg \| a \| abbr \| address \| area \| article \| aside \| audio \| b \| base \| bdi \| bdo \| big \| blockquote \| body \| br \| button \| canvas \| caption \| center \| cite \| code \| col \| colgroup \| data \| datalist \| dd \| del \| details \| dfn \| dialog \| div \| dl \| dt \| em \| embed \| fieldset \| figcaption \| figure \| footer \| form \| h1 \| h2 \| h3 \| h4 \| h5 \| h6 \| head \| header \| hgroup \| hr \| html \| i \| iframe \| img \| input \| ins \| kbd \| keygen \| label \| legend \| li \| link \| main \| map \| mark \| menu \| menuitem \| meta \| meter \| nav \| noindex \| noscript \| ol \| optgroup \| option \| output \| p \| param \| picture \| pre \| progress \| q \| rp \| rt \| ruby \| s \| samp \| search \| slot \| script \| section \| select \| small \| source \| span \| strong \| sub \| summary \| sup \| table \| template \| tbody \| td \| textarea \| tfoot \| th \| thead \| time \| title \| tr \| track \| u \| ul \| var \| video \| wbr \| webview \| animate \| animateMotion \| animateTransform \| circle \| clipPath \| defs \| desc \| ellipse \| feBlend \| feColorMatrix \| feComponentTransfer \| feComposite \| feConvolveMatrix \| feDiffuseLighting \| feDisplacementMap \| feDistantLight \| feDropShadow \| feFlood \| feFuncA \| feFuncB \| feFuncG \| feFuncR \| feGaussianBlur \| feImage \| feMerge \| feMergeNode \| feMorphology \| feOffset \| fePointLight \| feSpecularLighting \| feSpotLight \| feTile \| feTurbulence \| filter \| foreignObject \| g \| image \| line \| linearGradient \| marker \| mask \| metadata \| mpath \| path \| pattern \| polygon \| polyline \| radialGradient \| rect \| set \| stop \| switch \| text \| textPath \| tspan \| use \| view \| ComponentClass<any, any> \| FunctionComponent<any>` | No | `-` | - |
|
|
908
|
+
| `aspectRatio` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
909
|
+
| `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 | `-` | - |
|
|
910
|
+
| `borderBottomLeftRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
911
|
+
| `borderBottomRightRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
912
|
+
| `borderBottomWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
913
|
+
| `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 | `-` | - |
|
|
914
|
+
| `borderEndWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
915
|
+
| `borderRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
916
|
+
| `borderStartWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
917
|
+
| `borderTopLeftRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
918
|
+
| `borderTopRightRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
919
|
+
| `borderTopWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
920
|
+
| `borderWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
921
|
+
| `bordered` | `boolean` | No | `-` | Add a border around all sides of the box. |
|
|
922
|
+
| `borderedBottom` | `boolean` | No | `-` | Add a border to the bottom side of the box. |
|
|
923
|
+
| `borderedEnd` | `boolean` | No | `-` | Add a border to the trailing side of the box. |
|
|
924
|
+
| `borderedHorizontal` | `boolean` | No | `-` | Add a border to the leading and trailing sides of the box. |
|
|
925
|
+
| `borderedStart` | `boolean` | No | `-` | Add a border to the leading side of the box. |
|
|
926
|
+
| `borderedTop` | `boolean` | No | `-` | Add a border to the top side of the box. |
|
|
927
|
+
| `borderedVertical` | `boolean` | No | `-` | Add a border to the top and bottom sides of the box. |
|
|
928
|
+
| `bottom` | `ResponsiveProp<Bottom<string \| number>>` | No | `-` | - |
|
|
929
|
+
| `classNames` | `{ root?: string; visibleContent?: string \| undefined; formattedValueSection?: string \| undefined; prefix?: string \| undefined; suffix?: string \| undefined; i18nPrefix?: string \| undefined; i18nSuffix?: string \| undefined; integer?: string \| undefined; fraction?: string \| undefined; text?: string \| undefined; } \| undefined` | No | `-` | Class name overrides applied to RollingNumber slots. |
|
|
930
|
+
| `color` | `((Color \| { base?: Color; phone?: Color \| undefined; tablet?: Color \| undefined; desktop?: Color \| undefined; }) & Color) \| undefined` | 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}. |
|
|
931
|
+
| `colorPulseOnUpdate` | `boolean` | No | `-` | Enables color pulsing on positive or negative changes. Defaults to {@code false}. |
|
|
932
|
+
| `columnGap` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
933
|
+
| `dangerouslySetBackground` | `string` | No | `-` | - |
|
|
934
|
+
| `dangerouslySetColor` | `string` | No | `-` | - |
|
|
935
|
+
| `disabled` | `boolean` | No | `-` | - |
|
|
936
|
+
| `display` | `ResponsiveProp<grid \| revert \| none \| block \| inline \| inline-block \| flex \| inline-flex \| inline-grid \| contents \| flow-root \| list-item>` | No | `-` | - |
|
|
937
|
+
| `elevation` | `0 \| 1 \| 2` | No | `-` | - |
|
|
938
|
+
| `enableSubscriptNotation` | `boolean` | No | `-` | Enables subscript notation for leading zeros in the fractional part (for example, {@code 0.00009 => 0.0₄9}). |
|
|
939
|
+
| `flexBasis` | `ResponsiveProp<FlexBasis<string \| number>>` | No | `-` | - |
|
|
940
|
+
| `flexDirection` | `ResponsiveProp<column \| row \| row-reverse \| column-reverse>` | No | `-` | - |
|
|
941
|
+
| `flexGrow` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset` | No | `-` | - |
|
|
942
|
+
| `flexShrink` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset` | No | `-` | - |
|
|
943
|
+
| `flexWrap` | `ResponsiveProp<nowrap \| wrap \| wrap-reverse>` | No | `-` | - |
|
|
944
|
+
| `font` | `ResponsiveProp<FontFamily \| inherit>` | No | `-` | - |
|
|
945
|
+
| `fontFamily` | `ResponsiveProp<FontFamily \| inherit>` | No | `-` | - |
|
|
946
|
+
| `fontSize` | `ResponsiveProp<FontSize \| inherit>` | No | `-` | - |
|
|
947
|
+
| `fontWeight` | `ResponsiveProp<FontWeight \| inherit>` | No | `-` | - |
|
|
948
|
+
| `format` | `(Omit<NumberFormatOptions, notation> & { notation?: compact \| standard; }) \| undefined` | No | `-` | Intl.NumberFormat options applied when formatting the value. Scientific and engineering notation are not supported. |
|
|
949
|
+
| `formattedValue` | `string` | No | `-` | Preformatted value rendered instead of formatting {@link value }. {@link value } is still used to determine numeric deltas. |
|
|
950
|
+
| `gap` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
951
|
+
| `grid` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| none` | No | `-` | - |
|
|
952
|
+
| `gridArea` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
953
|
+
| `gridAutoColumns` | `ResponsiveProp<GridAutoColumns<string \| number>>` | No | `-` | - |
|
|
954
|
+
| `gridAutoFlow` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| row \| column \| dense` | No | `-` | - |
|
|
955
|
+
| `gridAutoRows` | `ResponsiveProp<GridAutoRows<string \| number>>` | No | `-` | - |
|
|
956
|
+
| `gridColumn` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
957
|
+
| `gridColumnEnd` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
958
|
+
| `gridColumnStart` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
959
|
+
| `gridRow` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
960
|
+
| `gridRowEnd` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
961
|
+
| `gridRowStart` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
962
|
+
| `gridTemplate` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| none` | No | `-` | - |
|
|
963
|
+
| `gridTemplateAreas` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| none` | No | `-` | - |
|
|
964
|
+
| `gridTemplateColumns` | `ResponsiveProp<GridTemplateColumns<string \| number>>` | No | `-` | - |
|
|
965
|
+
| `gridTemplateRows` | `ResponsiveProp<GridTemplateRows<string \| number>>` | No | `-` | - |
|
|
966
|
+
| `height` | `ResponsiveProp<Height<string \| number>>` | No | `-` | - |
|
|
967
|
+
| `justifyContent` | `ResponsiveProp<left \| right \| center \| normal \| start \| end \| flex-start \| flex-end \| stretch \| space-between \| space-around \| space-evenly>` | No | `-` | - |
|
|
968
|
+
| `left` | `ResponsiveProp<Left<string \| number>>` | No | `-` | - |
|
|
969
|
+
| `lineHeight` | `ResponsiveProp<LineHeight \| inherit>` | No | `-` | - |
|
|
970
|
+
| `locale` | `string \| Locale \| readonly (string \| Locale)[]` | No | `-` | Locale used for formatting. Defaults to the locale from {@link LocaleProvider }. |
|
|
971
|
+
| `margin` | `ResponsiveProp<0 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
|
|
972
|
+
| `marginBottom` | `ResponsiveProp<0 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
|
|
973
|
+
| `marginEnd` | `ResponsiveProp<0 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
|
|
974
|
+
| `marginStart` | `ResponsiveProp<0 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
|
|
975
|
+
| `marginTop` | `ResponsiveProp<0 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
|
|
976
|
+
| `marginX` | `ResponsiveProp<0 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
|
|
977
|
+
| `marginY` | `ResponsiveProp<0 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
|
|
978
|
+
| `maxHeight` | `ResponsiveProp<MaxHeight<string \| number>>` | No | `-` | - |
|
|
979
|
+
| `maxWidth` | `ResponsiveProp<MaxWidth<string \| number>>` | No | `-` | - |
|
|
980
|
+
| `minHeight` | `ResponsiveProp<MinHeight<string \| number>>` | No | `-` | - |
|
|
981
|
+
| `minWidth` | `ResponsiveProp<MinWidth<string \| number>>` | No | `-` | - |
|
|
982
|
+
| `mono` | `boolean` | No | `-` | Use monospace font family. |
|
|
983
|
+
| `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}. |
|
|
984
|
+
| `noWrap` | `boolean` | No | `false` | Set text to be in a single line. |
|
|
985
|
+
| `numberOfLines` | `number` | No | `-` | - |
|
|
986
|
+
| `opacity` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset` | No | `-` | - |
|
|
987
|
+
| `overflow` | `clip \| wrap \| truncate \| break` | No | `-` | Set overflow behavior. |
|
|
988
|
+
| `padding` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
989
|
+
| `paddingBottom` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
990
|
+
| `paddingEnd` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
991
|
+
| `paddingStart` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
992
|
+
| `paddingTop` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
993
|
+
| `paddingX` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
994
|
+
| `paddingY` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
995
|
+
| `pin` | `top \| bottom \| left \| right \| all` | No | `-` | Direction in which to absolutely pin the box. |
|
|
996
|
+
| `position` | `ResponsiveProp<fixed \| static \| relative \| absolute \| sticky>` | No | `-` | - |
|
|
997
|
+
| `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}. |
|
|
998
|
+
| `prefix` | `null \| string \| number \| false \| true \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal` | No | `-` | Content rendered before the formatted value. |
|
|
999
|
+
| `ref` | `any` | No | `-` | - |
|
|
1000
|
+
| `renderEmptyNode` | `boolean` | No | `-` | - |
|
|
1001
|
+
| `right` | `ResponsiveProp<Right<string \| number>>` | No | `-` | - |
|
|
1002
|
+
| `rowGap` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
1003
|
+
| `slashedZero` | `boolean` | No | `false` | Use character for number zero with a slash through it to differentiate it from the letter O. |
|
|
1004
|
+
| `style` | `CSSProperties` | No | `-` | - |
|
|
1005
|
+
| `styles` | `{ root?: CSSProperties; visibleContent?: CSSProperties \| undefined; formattedValueSection?: CSSProperties \| undefined; prefix?: CSSProperties \| undefined; suffix?: CSSProperties \| undefined; i18nPrefix?: CSSProperties \| undefined; i18nSuffix?: CSSProperties \| undefined; integer?: CSSProperties \| undefined; fraction?: CSSProperties \| undefined; text?: CSSProperties \| undefined; } \| undefined` | No | `-` | Inline style overrides applied to RollingNumber slots. |
|
|
1006
|
+
| `suffix` | `null \| string \| number \| false \| true \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal` | No | `-` | Content rendered after the formatted value. |
|
|
1007
|
+
| `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}. Defaults to {@code true}. |
|
|
1008
|
+
| `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 |
|
|
1009
|
+
| `textAlign` | `ResponsiveProp<center \| start \| end \| justify>` | No | `-` | - |
|
|
1010
|
+
| `textDecoration` | `ResponsiveProp<none \| underline \| overline \| line-through \| underline overline \| underline double>` | No | `-` | - |
|
|
1011
|
+
| `textTransform` | `ResponsiveProp<capitalize \| lowercase \| none \| uppercase>` | No | `-` | - |
|
|
1012
|
+
| `top` | `ResponsiveProp<Top<string \| number>>` | No | `-` | - |
|
|
1013
|
+
| `transform` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| none` | No | `-` | - |
|
|
1014
|
+
| `transition` | `RollingNumberTransitionConfig` | No | `-` | Framer Motion transition overrides. Supports per-property overrides for {@code y} and {@code color} only. |
|
|
1015
|
+
| `underline` | `boolean` | No | `false` | Set text decoration to underline. |
|
|
1016
|
+
| `userSelect` | `ResponsiveProp<text \| none \| auto \| all>` | No | `-` | - |
|
|
1017
|
+
| `visibility` | `ResponsiveProp<hidden \| visible>` | No | `-` | - |
|
|
1018
|
+
| `width` | `ResponsiveProp<Width<string \| number>>` | No | `-` | - |
|
|
1019
|
+
| `zIndex` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
1020
|
+
|
|
1021
|
+
|