@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,1083 @@
|
|
|
1
|
+
# Carousel
|
|
2
|
+
|
|
3
|
+
A flexible carousel component for displaying sequences of content with navigation and pagination options.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Carousel } from '@coinbase/cds-mobile/carousel/Carousel'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
|
|
13
|
+
### Basic Example
|
|
14
|
+
|
|
15
|
+
Carousels are a great way to showcase a list of items in a compact and engaging way.
|
|
16
|
+
By default, Carousels have navigation and pagination enabled.
|
|
17
|
+
You can also add a title to the Carousel by setting `title` prop.
|
|
18
|
+
|
|
19
|
+
You simply wrap each child in a `CarouselItem` component, and can optionally set the `width` prop to control the width of the item.
|
|
20
|
+
|
|
21
|
+
You can also set the `styles` prop to control the styles of the carousel, such as the gap between items.
|
|
22
|
+
|
|
23
|
+
```jsx
|
|
24
|
+
function MyCarousel() {
|
|
25
|
+
const theme = useTheme();
|
|
26
|
+
return (
|
|
27
|
+
<Carousel
|
|
28
|
+
hidePagination
|
|
29
|
+
title="Explore Assets"
|
|
30
|
+
styles={{
|
|
31
|
+
root: { paddingInline: theme.space[2] },
|
|
32
|
+
carousel: { gap: theme.space[1] },
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
{Object.values(assets).map((asset, index) => (
|
|
36
|
+
<CarouselItem key={asset.symbol} id={asset.symbol}>
|
|
37
|
+
<SquareAssetCard imageUrl={asset.imageUrl} name={asset.symbol} />
|
|
38
|
+
</CarouselItem>
|
|
39
|
+
))}
|
|
40
|
+
</Carousel>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Item Sizing
|
|
46
|
+
|
|
47
|
+
Items by default take their natural width while in the carousel, such as from our example above.
|
|
48
|
+
However, you can set the `width` prop of `CarouselItem` to control the width of the item.
|
|
49
|
+
|
|
50
|
+
#### Dynamic Sizing
|
|
51
|
+
|
|
52
|
+
Items can be given a width proportional to the carousel width.
|
|
53
|
+
|
|
54
|
+
:::tip Tip
|
|
55
|
+
|
|
56
|
+
If you have a gap between items or padding between the carousel and the edge of the screen,
|
|
57
|
+
you should account for that in the width. For example, if you have a gap of 8px,
|
|
58
|
+
and want to offset 16px from edge of screen, you could do
|
|
59
|
+
|
|
60
|
+
`<CarouselItem width={((screenWidth - (16 * 2)) - 8) / 2} ... />`
|
|
61
|
+
|
|
62
|
+
:::
|
|
63
|
+
|
|
64
|
+
```jsx
|
|
65
|
+
function DynamicSizingCarousel() {
|
|
66
|
+
const theme = useTheme();
|
|
67
|
+
const windowWidth = Dimensions.get('window').width;
|
|
68
|
+
|
|
69
|
+
const horizontalPadding = theme.space[2];
|
|
70
|
+
|
|
71
|
+
const carouselWidth = windowWidth - horizontalPadding * 2;
|
|
72
|
+
const horizontalGap = theme.space[1];
|
|
73
|
+
|
|
74
|
+
// 1 item per page - will rely on Carousel container's width
|
|
75
|
+
const oneItemWidth = '100%'; // Could alternatively use carouselWidth
|
|
76
|
+
// 2 items per page - will be calculated based on screen width
|
|
77
|
+
const twoItemsWidth = (carouselWidth - horizontalGap) / 2;
|
|
78
|
+
// 3 items per page - will be calculated based on screen width
|
|
79
|
+
const threeItemsWidth = (carouselWidth - horizontalGap * 2) / 3;
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<Carousel
|
|
83
|
+
hidePagination
|
|
84
|
+
title="Learn more"
|
|
85
|
+
styles={{
|
|
86
|
+
root: { paddingInline: horizontalPadding },
|
|
87
|
+
carousel: { gap: horizontalGap },
|
|
88
|
+
}}
|
|
89
|
+
>
|
|
90
|
+
<CarouselItem id="recurring-buy" width={twoItemsWidth}>
|
|
91
|
+
<UpsellCard
|
|
92
|
+
action="Get started"
|
|
93
|
+
description="Want to add funds to your card every week or month?"
|
|
94
|
+
media={
|
|
95
|
+
<Box bottom={6} position="relative" right={24}>
|
|
96
|
+
<Pictogram dimension="64x64" name="recurringPurchases" />
|
|
97
|
+
</Box>
|
|
98
|
+
}
|
|
99
|
+
minWidth="0"
|
|
100
|
+
onActionPress={NoopFn}
|
|
101
|
+
title="Recurring Buy"
|
|
102
|
+
width="100%"
|
|
103
|
+
/>
|
|
104
|
+
</CarouselItem>
|
|
105
|
+
<CarouselItem id="eths-apr" width={twoItemsWidth}>
|
|
106
|
+
<UpsellCard
|
|
107
|
+
action="Start earning"
|
|
108
|
+
dangerouslySetBackground="rgb(var(--purple70))"
|
|
109
|
+
description={
|
|
110
|
+
<TextLabel2 as="p" numberOfLines={3} color="fgInverse">
|
|
111
|
+
Earn staking rewards on ETH by holding it on Coinbase
|
|
112
|
+
</TextLabel2>
|
|
113
|
+
}
|
|
114
|
+
media={
|
|
115
|
+
<Box left={16} position="relative" top={12}>
|
|
116
|
+
<RemoteImage height={174} source="/img/feature.png" />
|
|
117
|
+
</Box>
|
|
118
|
+
}
|
|
119
|
+
minWidth="0"
|
|
120
|
+
onActionPress={NoopFn}
|
|
121
|
+
title={
|
|
122
|
+
<TextHeadline color="fgInverse" as="h3">
|
|
123
|
+
Up to 3.29% APR on ETHs
|
|
124
|
+
</TextHeadline>
|
|
125
|
+
}
|
|
126
|
+
width="100%"
|
|
127
|
+
/>
|
|
128
|
+
</CarouselItem>
|
|
129
|
+
</Carousel>
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
#### Responsive Sizing
|
|
135
|
+
|
|
136
|
+
You can also use responsive props to change the number of items visible based on the carousel width.
|
|
137
|
+
The carousel below will show per page 1 item on mobile, 2 items on tablet, and 3 items on desktop (based on screen width).
|
|
138
|
+
|
|
139
|
+
```jsx
|
|
140
|
+
function ResponsiveSizingCarousel() {
|
|
141
|
+
const theme = useTheme();
|
|
142
|
+
const windowWidth = Dimensions.get('window').width;
|
|
143
|
+
|
|
144
|
+
const horizontalPadding = theme.space[2];
|
|
145
|
+
|
|
146
|
+
const carouselWidth = windowWidth - horizontalPadding * 2;
|
|
147
|
+
const horizontalGap = theme.space[1];
|
|
148
|
+
|
|
149
|
+
// 1 item per page - will rely on Carousel container's width
|
|
150
|
+
const oneItemWidth = '100%'; // Could alternatively use carouselWidth
|
|
151
|
+
// 2 items per page - will be calculated based on screen width
|
|
152
|
+
const twoItemsWidth = (carouselWidth - horizontalGap) / 2;
|
|
153
|
+
// 3 items per page - will be calculated based on screen width
|
|
154
|
+
const threeItemsWidth = (carouselWidth - horizontalGap * 2) / 3;
|
|
155
|
+
|
|
156
|
+
const itemWidth = {
|
|
157
|
+
phone: oneItemWidth,
|
|
158
|
+
tablet: twoItemsWidth,
|
|
159
|
+
desktop: threeItemsWidth,
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
return (
|
|
163
|
+
<Carousel
|
|
164
|
+
hidePagination
|
|
165
|
+
title="Learn more"
|
|
166
|
+
styles={{
|
|
167
|
+
root: { paddingInline: horizontalPadding },
|
|
168
|
+
carousel: { gap: horizontalGap },
|
|
169
|
+
}}
|
|
170
|
+
drag="free"
|
|
171
|
+
>
|
|
172
|
+
<CarouselItem id="earn-more-crypto" width={itemWidth}>
|
|
173
|
+
<NudgeCard
|
|
174
|
+
title="Earn more crypto"
|
|
175
|
+
description="You've got unstaked crypto."
|
|
176
|
+
pictogram="key"
|
|
177
|
+
action="Start earning"
|
|
178
|
+
onActionPress={() => console.log('Action pressed')}
|
|
179
|
+
width="100%"
|
|
180
|
+
minWidth={0}
|
|
181
|
+
/>
|
|
182
|
+
</CarouselItem>
|
|
183
|
+
<CarouselItem id="secure-your-account" width={itemWidth}>
|
|
184
|
+
<NudgeCard
|
|
185
|
+
title="Secure your account"
|
|
186
|
+
description="Add two-factor authentication."
|
|
187
|
+
pictogram="shield"
|
|
188
|
+
action="Enable 2FA"
|
|
189
|
+
onActionPress={() => console.log('Enable 2FA pressed')}
|
|
190
|
+
width="100%"
|
|
191
|
+
minWidth={0}
|
|
192
|
+
/>
|
|
193
|
+
</CarouselItem>
|
|
194
|
+
<CarouselItem id="complete-your-profile" width={itemWidth}>
|
|
195
|
+
<NudgeCard
|
|
196
|
+
title="Complete your profile"
|
|
197
|
+
description="Add more details."
|
|
198
|
+
pictogram="accountsNavigation"
|
|
199
|
+
action="Update"
|
|
200
|
+
onActionPress={() => console.log('Update profile pressed')}
|
|
201
|
+
width="100%"
|
|
202
|
+
minWidth={0}
|
|
203
|
+
/>
|
|
204
|
+
</CarouselItem>
|
|
205
|
+
</Carousel>
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
#### Varied Sizing
|
|
211
|
+
|
|
212
|
+
Not all carousel items need to be the same size. You can provide CarouselItems of varying widths as well.
|
|
213
|
+
|
|
214
|
+
```jsx
|
|
215
|
+
function VariedSizingCarousel() {
|
|
216
|
+
const theme = useTheme();
|
|
217
|
+
const windowWidth = Dimensions.get('window').width;
|
|
218
|
+
|
|
219
|
+
const horizontalPadding = theme.space[2];
|
|
220
|
+
|
|
221
|
+
const carouselWidth = windowWidth - horizontalPadding * 2;
|
|
222
|
+
const horizontalGap = theme.space[1];
|
|
223
|
+
|
|
224
|
+
// 1 item per page - will rely on Carousel container's width
|
|
225
|
+
const oneItemWidth = '100%'; // Could alternatively use carouselWidth
|
|
226
|
+
// 2 items per page - will be calculated based on screen width
|
|
227
|
+
const twoItemsWidth = (carouselWidth - horizontalGap) / 2;
|
|
228
|
+
// 3 items per page - will be calculated based on screen width
|
|
229
|
+
const threeItemsWidth = (carouselWidth - horizontalGap * 2) / 3;
|
|
230
|
+
|
|
231
|
+
const itemWidth = {
|
|
232
|
+
phone: oneItemWidth,
|
|
233
|
+
tablet: twoItemsWidth,
|
|
234
|
+
desktop: threeItemsWidth,
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
return (
|
|
238
|
+
<Carousel
|
|
239
|
+
hidePagination
|
|
240
|
+
title="Varied Sizing"
|
|
241
|
+
styles={{
|
|
242
|
+
root: { paddingInline: horizontalPadding },
|
|
243
|
+
carousel: { gap: horizontalGap },
|
|
244
|
+
}}
|
|
245
|
+
>
|
|
246
|
+
<CarouselItem id="earn-more-crypto" width={itemWidth}>
|
|
247
|
+
<NudgeCard
|
|
248
|
+
title="Earn more crypto"
|
|
249
|
+
description="You've got unstaked crypto. Stake it now to earn more."
|
|
250
|
+
pictogram="key"
|
|
251
|
+
action="Start earning"
|
|
252
|
+
onActionPress={() => console.log('Action pressed')}
|
|
253
|
+
width="100%"
|
|
254
|
+
minWidth={0}
|
|
255
|
+
/>
|
|
256
|
+
</CarouselItem>
|
|
257
|
+
<CarouselItem id="btc">
|
|
258
|
+
<SquareAssetCard imageUrl={assets.btc.imageUrl} name="BTC" />
|
|
259
|
+
</CarouselItem>
|
|
260
|
+
<CarouselItem id="secure-your-account" width={itemWidth}>
|
|
261
|
+
<NudgeCard
|
|
262
|
+
title="Secure your account"
|
|
263
|
+
description="Add two-factor authentication for enhanced security."
|
|
264
|
+
pictogram="shield"
|
|
265
|
+
action="Enable 2FA"
|
|
266
|
+
onActionPress={() => console.log('Enable 2FA pressed')}
|
|
267
|
+
width="100%"
|
|
268
|
+
minWidth={0}
|
|
269
|
+
/>
|
|
270
|
+
</CarouselItem>
|
|
271
|
+
<CarouselItem id="eth">
|
|
272
|
+
<SquareAssetCard imageUrl={assets.eth.imageUrl} name="ETH" />
|
|
273
|
+
</CarouselItem>
|
|
274
|
+
<CarouselItem id="complete-your-profile" width={itemWidth}>
|
|
275
|
+
<NudgeCard
|
|
276
|
+
title="Complete your profile"
|
|
277
|
+
description="Add more details to personalize your experience."
|
|
278
|
+
pictogram="accountsNavigation"
|
|
279
|
+
action="Update profile"
|
|
280
|
+
onActionPress={() => console.log('Update profile pressed')}
|
|
281
|
+
width="100%"
|
|
282
|
+
minWidth={0}
|
|
283
|
+
/>
|
|
284
|
+
</CarouselItem>
|
|
285
|
+
<CarouselItem id="ltc">
|
|
286
|
+
<SquareAssetCard imageUrl={assets.ltc.imageUrl} name="LTC" />
|
|
287
|
+
</CarouselItem>
|
|
288
|
+
</Carousel>
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### Drag
|
|
294
|
+
|
|
295
|
+
You can set the `drag` prop to `snap` (default), `free`, or `none`.
|
|
296
|
+
When set to `snap`, upon release the carousel will snap to either the nearest item or page (depending on `snapMode`).
|
|
297
|
+
|
|
298
|
+
```jsx
|
|
299
|
+
function DragCarousel() {
|
|
300
|
+
return (
|
|
301
|
+
<Carousel
|
|
302
|
+
title="Explore Assets"
|
|
303
|
+
hidePagination
|
|
304
|
+
drag="free"
|
|
305
|
+
styles={{
|
|
306
|
+
root: { paddingInline: horizontalPadding },
|
|
307
|
+
carousel: { gap: horizontalGap },
|
|
308
|
+
}}
|
|
309
|
+
snapMode="item"
|
|
310
|
+
>
|
|
311
|
+
{Object.values(assets).map((asset, index) => (
|
|
312
|
+
<CarouselItem key={asset.symbol} id={asset.symbol}>
|
|
313
|
+
<SquareAssetCard imageUrl={asset.imageUrl} name={asset.symbol} />
|
|
314
|
+
</CarouselItem>
|
|
315
|
+
))}
|
|
316
|
+
</Carousel>
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### Snap Mode
|
|
322
|
+
|
|
323
|
+
You can set the `snapMode` to `page` (default) or `item`.
|
|
324
|
+
When set to `page`, the carousel will automatically group items into pages.
|
|
325
|
+
When set to `item`, the carousel will snap to the nearest item.
|
|
326
|
+
|
|
327
|
+
```jsx
|
|
328
|
+
function SquareItemsCarousel() {
|
|
329
|
+
return (
|
|
330
|
+
<Carousel
|
|
331
|
+
title="Explore Assets"
|
|
332
|
+
styles={{
|
|
333
|
+
root: { paddingInline: horizontalPadding },
|
|
334
|
+
carousel: { gap: horizontalGap },
|
|
335
|
+
}}
|
|
336
|
+
snapMode="item"
|
|
337
|
+
>
|
|
338
|
+
{Object.values(assets).map((asset, index) => (
|
|
339
|
+
<CarouselItem key={asset.symbol} id={asset.symbol}>
|
|
340
|
+
<SquareAssetCard imageUrl={asset.imageUrl} name={asset.symbol} />
|
|
341
|
+
</CarouselItem>
|
|
342
|
+
))}
|
|
343
|
+
</Carousel>
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
### Overflow
|
|
349
|
+
|
|
350
|
+
By default, the carousel's inner overflow is visible.
|
|
351
|
+
This means that you can apply padding to the inner carousel element
|
|
352
|
+
(such as `styles={{ carousel: { paddingInline: theme.space[2] } }}`) and it will not be clipped.
|
|
353
|
+
You can pair this with modifying the spacing of the inner carousel to match
|
|
354
|
+
the padding of your page (along with a wrapping div to negate any default spacing).
|
|
355
|
+
This creates a seamless experience.
|
|
356
|
+
|
|
357
|
+
:::tip Tip
|
|
358
|
+
|
|
359
|
+
If you want to have the next item be shown at the edge of the screen, make sure your carousel padding is larger than your gap.
|
|
360
|
+
|
|
361
|
+
:::
|
|
362
|
+
|
|
363
|
+
```jsx
|
|
364
|
+
function OverflowCarousel() {
|
|
365
|
+
return (
|
|
366
|
+
<Carousel
|
|
367
|
+
title="Explore Assets"
|
|
368
|
+
snapMode="item"
|
|
369
|
+
styles={{
|
|
370
|
+
root: { paddingInline: horizontalPadding },
|
|
371
|
+
carousel: { gap: horizontalGap },
|
|
372
|
+
}}
|
|
373
|
+
>
|
|
374
|
+
{Object.values(assets).map((asset, index) => (
|
|
375
|
+
<CarouselItem key={asset.symbol} id={asset.symbol}>
|
|
376
|
+
<SquareAssetCard imageUrl={asset.imageUrl} name={asset.symbol} />
|
|
377
|
+
</CarouselItem>
|
|
378
|
+
))}
|
|
379
|
+
</Carousel>
|
|
380
|
+
);
|
|
381
|
+
}
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### Accessibility
|
|
385
|
+
|
|
386
|
+
The carousel is accessible by default.
|
|
387
|
+
|
|
388
|
+
You need to use `accessibilityLabel` or `accessibilityLabelledBy` props to provide a label for the carousel items.
|
|
389
|
+
|
|
390
|
+
Similar to web, you are provided the `isVisible` render prop, however it is not necessary to use since mobile users do not have a keyboard.
|
|
391
|
+
|
|
392
|
+
```jsx
|
|
393
|
+
<Carousel>
|
|
394
|
+
<CarouselItem id="btc" accessibilityLabel="Bitcoin">
|
|
395
|
+
<SquareAssetCard imageUrl={assets.btc.imageUrl} name={assets.btc.symbol} />
|
|
396
|
+
</CarouselItem>
|
|
397
|
+
<CarouselItem id="recurring-buy" width="100%" accessibilityLabelledBy="recurring-buy-label">
|
|
398
|
+
{({ isVisible }) => (
|
|
399
|
+
<UpsellCard
|
|
400
|
+
action={
|
|
401
|
+
<Button
|
|
402
|
+
compact
|
|
403
|
+
flush="start"
|
|
404
|
+
numberOfLines={1}
|
|
405
|
+
onPress={NoopFn}
|
|
406
|
+
tabIndex={isVisible ? undefined : -1}
|
|
407
|
+
variant="secondary"
|
|
408
|
+
>
|
|
409
|
+
Get started
|
|
410
|
+
</Button>
|
|
411
|
+
}
|
|
412
|
+
description="Want to add funds to your card every week or month?"
|
|
413
|
+
media={
|
|
414
|
+
<Box bottom={6} position="relative" right={24}>
|
|
415
|
+
<Pictogram dimension="64x64" name="recurringPurchases" />
|
|
416
|
+
</Box>
|
|
417
|
+
}
|
|
418
|
+
minWidth="0"
|
|
419
|
+
title={
|
|
420
|
+
<TextHeadline as="h3" id="recurring-buy-label">
|
|
421
|
+
Recurring Buy
|
|
422
|
+
</TextHeadline>
|
|
423
|
+
}
|
|
424
|
+
width="100%"
|
|
425
|
+
/>
|
|
426
|
+
)}
|
|
427
|
+
</CarouselItem>
|
|
428
|
+
</Carousel>
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
### Customization
|
|
432
|
+
|
|
433
|
+
#### Custom Components
|
|
434
|
+
|
|
435
|
+
You can customize the navigation and pagination components of the carousel using the `NavigationComponent` and `PaginationComponent` props. You can also modify the title by providing a ReactNode for the `title` prop.
|
|
436
|
+
|
|
437
|
+
```jsx
|
|
438
|
+
function CustomComponentsCarousel() {
|
|
439
|
+
function PaginationComponent({ totalPages, activePageIndex, onClickPage, style }) {
|
|
440
|
+
const canGoPrevious = activePageIndex > 0;
|
|
441
|
+
const canGoNext = activePageIndex < totalPages - 1;
|
|
442
|
+
const dotStyles = {
|
|
443
|
+
width: theme.space[2],
|
|
444
|
+
height: theme.space[2],
|
|
445
|
+
borderRadius: theme.borderRadius[1000],
|
|
446
|
+
} as const;
|
|
447
|
+
function onPrevious() {
|
|
448
|
+
onClickPage(activePageIndex - 1);
|
|
449
|
+
}
|
|
450
|
+
function onNext() {
|
|
451
|
+
onClickPage(activePageIndex + 1);
|
|
452
|
+
}
|
|
453
|
+
return (
|
|
454
|
+
<HStack justifyContent="space-between" style={style}>
|
|
455
|
+
<HStack gap={1}>
|
|
456
|
+
<IconButton
|
|
457
|
+
accessibilityLabel="Previous"
|
|
458
|
+
disabled={!canGoPrevious}
|
|
459
|
+
name="caretLeft"
|
|
460
|
+
onPress={onPrevious}
|
|
461
|
+
variant="foregroundMuted"
|
|
462
|
+
/>
|
|
463
|
+
<IconButton
|
|
464
|
+
accessibilityLabel="Next"
|
|
465
|
+
disabled={!canGoNext}
|
|
466
|
+
name="caretRight"
|
|
467
|
+
onPress={onNext}
|
|
468
|
+
variant="foregroundMuted"
|
|
469
|
+
/>
|
|
470
|
+
</HStack>
|
|
471
|
+
<HStack alignItems="center" gap={1}>
|
|
472
|
+
{Array.from({ length: totalPages }, (_, index) => (
|
|
473
|
+
<Pressable
|
|
474
|
+
key={index}
|
|
475
|
+
accessibilityLabel={`Go to page ${index + 1}`}
|
|
476
|
+
background={index === activePageIndex ? 'bgPrimary' : 'bgSecondary'}
|
|
477
|
+
borderColor={index === activePageIndex ? 'fgPrimary' : 'bgLine'}
|
|
478
|
+
data-testid={`carousel-page-${index}`}
|
|
479
|
+
onPress={() => onClickPage(index)}
|
|
480
|
+
style={dotStyles}
|
|
481
|
+
/>
|
|
482
|
+
))}
|
|
483
|
+
</HStack>
|
|
484
|
+
</HStack>
|
|
485
|
+
);
|
|
486
|
+
}
|
|
487
|
+
function NoopFn() {
|
|
488
|
+
console.log('pressed');
|
|
489
|
+
}
|
|
490
|
+
// ...itemWidth as shown in other examples
|
|
491
|
+
return (
|
|
492
|
+
<Carousel
|
|
493
|
+
NavigationComponent={SeeAllComponent}
|
|
494
|
+
PaginationComponent={PaginationComponent}
|
|
495
|
+
styles={{
|
|
496
|
+
root: { paddingInline: horizontalPadding },
|
|
497
|
+
carousel: { gap: horizontalGap },
|
|
498
|
+
}}
|
|
499
|
+
title={
|
|
500
|
+
<TextHeadline as="h3">
|
|
501
|
+
Learn more
|
|
502
|
+
</TextHeadline>
|
|
503
|
+
}
|
|
504
|
+
>
|
|
505
|
+
<CarouselItem id="recurring-buy" width={itemWidth}>
|
|
506
|
+
<UpsellCard
|
|
507
|
+
action="Get started"
|
|
508
|
+
description="Want to add funds to your card every week or month?"
|
|
509
|
+
media={
|
|
510
|
+
<Box bottom={6} position="relative" right={24}>
|
|
511
|
+
<Pictogram dimension="64x64" name="recurringPurchases" />
|
|
512
|
+
</Box>
|
|
513
|
+
}
|
|
514
|
+
minWidth={0}
|
|
515
|
+
onActionPress={NoopFn}
|
|
516
|
+
title="Recurring Buy"
|
|
517
|
+
width="100%"
|
|
518
|
+
/>
|
|
519
|
+
</CarouselItem>
|
|
520
|
+
<CarouselItem id="eths-apr" width={itemWidth}>
|
|
521
|
+
<UpsellCard
|
|
522
|
+
action="Start earning"
|
|
523
|
+
dangerouslySetBackground="rgb(var(--purple70))"
|
|
524
|
+
description={
|
|
525
|
+
<TextLabel2 as="p" numberOfLines={3} color="fgInverse">
|
|
526
|
+
Earn staking rewards on ETH by holding it on Coinbase
|
|
527
|
+
</TextLabel2>
|
|
528
|
+
}
|
|
529
|
+
media={
|
|
530
|
+
<Box left={16} position="relative" top={12}>
|
|
531
|
+
<RemoteImage height={174} source="/img/feature.png" />
|
|
532
|
+
</Box>
|
|
533
|
+
}
|
|
534
|
+
minWidth={0}
|
|
535
|
+
onActionPress={NoopFn}
|
|
536
|
+
title={
|
|
537
|
+
<TextHeadline color="fgInverse" as="h3">
|
|
538
|
+
Up to 3.29% APR on ETHs
|
|
539
|
+
</TextHeadline>
|
|
540
|
+
}
|
|
541
|
+
width="100%"
|
|
542
|
+
/>
|
|
543
|
+
</CarouselItem>
|
|
544
|
+
<CarouselItem id="join-the-community" width={itemWidth}>
|
|
545
|
+
<UpsellCard
|
|
546
|
+
action="Start chatting"
|
|
547
|
+
dangerouslySetBackground="rgb(var(--teal70))"
|
|
548
|
+
description={
|
|
549
|
+
<TextLabel2 as="p" numberOfLines={3} color="fgInverse">
|
|
550
|
+
Chat with other devs in our Discord community
|
|
551
|
+
</TextLabel2>
|
|
552
|
+
}
|
|
553
|
+
media={
|
|
554
|
+
<Box left={16} position="relative" top={4}>
|
|
555
|
+
<RemoteImage height={174} source="/img/community.png" />
|
|
556
|
+
</Box>
|
|
557
|
+
}
|
|
558
|
+
minWidth={0}
|
|
559
|
+
onActionPress={NoopFn}
|
|
560
|
+
title={
|
|
561
|
+
<TextHeadline color="fgInverse" as="h3">
|
|
562
|
+
Join the community
|
|
563
|
+
</TextHeadline>
|
|
564
|
+
}
|
|
565
|
+
width="100%"
|
|
566
|
+
/>
|
|
567
|
+
</CarouselItem>
|
|
568
|
+
<CarouselItem id="coinbase-one-offer" width={itemWidth}>
|
|
569
|
+
<UpsellCard
|
|
570
|
+
action="Get 60 days free"
|
|
571
|
+
dangerouslySetBackground="rgb(var(--blue80))"
|
|
572
|
+
description={
|
|
573
|
+
<TextLabel2 as="p" numberOfLines={3} color="fgInverse">
|
|
574
|
+
Use code NOV60 when you sign up for Coinbase One
|
|
575
|
+
</TextLabel2>
|
|
576
|
+
}
|
|
577
|
+
media={
|
|
578
|
+
<Box left={16} position="relative" top={0}>
|
|
579
|
+
<RemoteImage height={174} source="/img/marketing.png" />
|
|
580
|
+
</Box>
|
|
581
|
+
}
|
|
582
|
+
minWidth={0}
|
|
583
|
+
onActionPress={NoopFn}
|
|
584
|
+
title={
|
|
585
|
+
<TextHeadline color="fgInverse" as="h3">
|
|
586
|
+
Coinbase One offer
|
|
587
|
+
</TextHeadline>
|
|
588
|
+
}
|
|
589
|
+
width="100%"
|
|
590
|
+
/>
|
|
591
|
+
</CarouselItem>
|
|
592
|
+
<CarouselItem id="coinbase-card" width={itemWidth}>
|
|
593
|
+
<UpsellCard
|
|
594
|
+
action="Get started"
|
|
595
|
+
dangerouslySetBackground="rgb(var(--gray100))"
|
|
596
|
+
description={
|
|
597
|
+
<TextLabel2 as="p" numberOfLines={3} color="fgInverse">
|
|
598
|
+
Spend USDC to get rewards with our Visa® debit card
|
|
599
|
+
</TextLabel2>
|
|
600
|
+
}
|
|
601
|
+
media={
|
|
602
|
+
<Box left={16} position="relative" top={0}>
|
|
603
|
+
<RemoteImage height={174} source="/img/object.png" />
|
|
604
|
+
</Box>
|
|
605
|
+
}
|
|
606
|
+
minWidth={0}
|
|
607
|
+
onActionPress={NoopFn}
|
|
608
|
+
title={
|
|
609
|
+
<TextHeadline color="fgInverse" as="h3">
|
|
610
|
+
Coinbase Card
|
|
611
|
+
</TextHeadline>
|
|
612
|
+
}
|
|
613
|
+
width="100%"
|
|
614
|
+
/>
|
|
615
|
+
</CarouselItem>
|
|
616
|
+
</Carousel>
|
|
617
|
+
);
|
|
618
|
+
}
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
#### Custom Styles
|
|
622
|
+
|
|
623
|
+
You can use the `styles` props to customize different parts of the carousel.
|
|
624
|
+
|
|
625
|
+
```jsx
|
|
626
|
+
function CustomStylesCarousel() {
|
|
627
|
+
return (
|
|
628
|
+
<Carousel
|
|
629
|
+
styles={{
|
|
630
|
+
root: { paddingInline: horizontalPadding },
|
|
631
|
+
carousel: { gap: horizontalGap },
|
|
632
|
+
}}
|
|
633
|
+
NavigationComponent={({
|
|
634
|
+
className,
|
|
635
|
+
style,
|
|
636
|
+
disableGoNext,
|
|
637
|
+
disableGoPrevious,
|
|
638
|
+
nextPageAccessibilityLabel,
|
|
639
|
+
onGoNext,
|
|
640
|
+
onGoPrevious,
|
|
641
|
+
previousPageAccessibilityLabel,
|
|
642
|
+
}) => {
|
|
643
|
+
return (
|
|
644
|
+
<DefaultCarouselNavigation
|
|
645
|
+
className={className}
|
|
646
|
+
disableGoNext={disableGoNext}
|
|
647
|
+
disableGoPrevious={disableGoPrevious}
|
|
648
|
+
nextPageAccessibilityLabel={nextPageAccessibilityLabel}
|
|
649
|
+
onGoNext={onGoNext}
|
|
650
|
+
onGoPrevious={onGoPrevious}
|
|
651
|
+
previousPageAccessibilityLabel={previousPageAccessibilityLabel}
|
|
652
|
+
style={style}
|
|
653
|
+
styles={{
|
|
654
|
+
previousButton: {
|
|
655
|
+
position: 'absolute',
|
|
656
|
+
top: theme.space[8],
|
|
657
|
+
zIndex: 1,
|
|
658
|
+
left: theme.space[0_5],
|
|
659
|
+
},
|
|
660
|
+
nextButton: {
|
|
661
|
+
position: 'absolute',
|
|
662
|
+
top: theme.space[8],
|
|
663
|
+
zIndex: 1,
|
|
664
|
+
right: theme.space[0_5],
|
|
665
|
+
},
|
|
666
|
+
}}
|
|
667
|
+
/>
|
|
668
|
+
);
|
|
669
|
+
}}
|
|
670
|
+
>
|
|
671
|
+
<CarouselItem id="earn-more-crypto" width="100%">
|
|
672
|
+
<NudgeCard
|
|
673
|
+
title="Earn more crypto"
|
|
674
|
+
description="You've got unstaked crypto. Stake it now to earn more."
|
|
675
|
+
pictogram="key"
|
|
676
|
+
action="Start earning"
|
|
677
|
+
onActionPress={() => console.log('Action pressed')}
|
|
678
|
+
width="100%"
|
|
679
|
+
minWidth={0}
|
|
680
|
+
/>
|
|
681
|
+
</CarouselItem>
|
|
682
|
+
<CarouselItem id="secure-your-account" width="100%">
|
|
683
|
+
<NudgeCard
|
|
684
|
+
title="Secure your account"
|
|
685
|
+
description="Add two-factor authentication for enhanced security."
|
|
686
|
+
pictogram="shield"
|
|
687
|
+
action="Enable 2FA"
|
|
688
|
+
onActionPress={() => console.log('Enable 2FA pressed')}
|
|
689
|
+
width="100%"
|
|
690
|
+
minWidth={0}
|
|
691
|
+
/>
|
|
692
|
+
</CarouselItem>
|
|
693
|
+
<CarouselItem id="complete-your-profile" width="100%">
|
|
694
|
+
<NudgeCard
|
|
695
|
+
title="Complete your profile"
|
|
696
|
+
description="Add more details to personalize your experience."
|
|
697
|
+
pictogram="accountsNavigation"
|
|
698
|
+
action="Update profile"
|
|
699
|
+
onActionPress={() => console.log('Update profile pressed')}
|
|
700
|
+
width="100%"
|
|
701
|
+
minWidth={0}
|
|
702
|
+
/>
|
|
703
|
+
</CarouselItem>
|
|
704
|
+
</Carousel>
|
|
705
|
+
);
|
|
706
|
+
}
|
|
707
|
+
```
|
|
708
|
+
|
|
709
|
+
#### Dynamic Content
|
|
710
|
+
|
|
711
|
+
You can dynamically add and remove items from the carousel.
|
|
712
|
+
|
|
713
|
+
```jsx
|
|
714
|
+
function DynamicContentCarousel() {
|
|
715
|
+
const [items, setItems] = useState(Object.values(assets).slice(0, 3));
|
|
716
|
+
|
|
717
|
+
function addAsset() {
|
|
718
|
+
const randomAsset =
|
|
719
|
+
Object.values(assets)[Math.floor(Math.random() * Object.values(assets).length)];
|
|
720
|
+
setItems([...items, { ...randomAsset, symbol: `${randomAsset.symbol}-${items.length}` }]);
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
return (
|
|
724
|
+
<VStack gap={2}>
|
|
725
|
+
<HStack justifyContent="flex-end" gap={2} alignItems="center">
|
|
726
|
+
<Button compact onPress={addAsset}>
|
|
727
|
+
Add Asset
|
|
728
|
+
</Button>
|
|
729
|
+
<Button compact onPress={() => setItems(items.slice(0, -1))} disabled={items.length === 0}>
|
|
730
|
+
Remove Last
|
|
731
|
+
</Button>
|
|
732
|
+
</HStack>
|
|
733
|
+
<Carousel
|
|
734
|
+
title="Explore Assets"
|
|
735
|
+
styles={{
|
|
736
|
+
root: { paddingInline: horizontalPadding },
|
|
737
|
+
carousel: { gap: horizontalGap, height: 156 },
|
|
738
|
+
}}
|
|
739
|
+
>
|
|
740
|
+
{items.map((asset, index) => (
|
|
741
|
+
<CarouselItem key={asset.symbol} id={asset.symbol}>
|
|
742
|
+
<SquareAssetCard imageUrl={asset.imageUrl} name={asset.symbol} />
|
|
743
|
+
</CarouselItem>
|
|
744
|
+
))}
|
|
745
|
+
</Carousel>
|
|
746
|
+
</VStack>
|
|
747
|
+
);
|
|
748
|
+
}
|
|
749
|
+
```
|
|
750
|
+
|
|
751
|
+
#### Hide Navigation and Pagination
|
|
752
|
+
|
|
753
|
+
You can hide the navigation and pagination components of the carousel if desired.
|
|
754
|
+
|
|
755
|
+
```jsx
|
|
756
|
+
function HideNavigationAndPaginationCarousel() {
|
|
757
|
+
return (
|
|
758
|
+
<Carousel
|
|
759
|
+
title="Explore Assets"
|
|
760
|
+
hidePagination
|
|
761
|
+
hideNavigation
|
|
762
|
+
drag="free"
|
|
763
|
+
snapMode="item"
|
|
764
|
+
styles={{
|
|
765
|
+
root: { paddingInline: horizontalPadding },
|
|
766
|
+
carousel: { gap: horizontalGap },
|
|
767
|
+
}}
|
|
768
|
+
>
|
|
769
|
+
{Object.values(assets).map((asset, index) => (
|
|
770
|
+
<CarouselItem key={asset.symbol} id={asset.symbol}>
|
|
771
|
+
<SquareAssetCard imageUrl={asset.imageUrl} name={asset.symbol} />
|
|
772
|
+
</CarouselItem>
|
|
773
|
+
))}
|
|
774
|
+
</Carousel>
|
|
775
|
+
);
|
|
776
|
+
}
|
|
777
|
+
```
|
|
778
|
+
|
|
779
|
+
### Imperative API
|
|
780
|
+
|
|
781
|
+
You can control the carousel programmatically using a ref. The carousel exposes methods to navigate to specific pages and access the current page index.
|
|
782
|
+
|
|
783
|
+
```jsx
|
|
784
|
+
function ImperativeApiCarousel() {
|
|
785
|
+
const theme = useTheme();
|
|
786
|
+
const carouselRef = useRef(null);
|
|
787
|
+
const [currentPageInfo, setCurrentPageInfo] = useState('Page 1');
|
|
788
|
+
|
|
789
|
+
const handleGoToPage = (pageIndex) => {
|
|
790
|
+
if (carouselRef.current) {
|
|
791
|
+
const clampedPageIndex = Math.max(0, Math.min(carouselRef.current.totalPages - 1, pageIndex));
|
|
792
|
+
carouselRef.current.goToPage(clampedPageIndex);
|
|
793
|
+
setCurrentPageInfo(`Page ${clampedPageIndex + 1}`);
|
|
794
|
+
}
|
|
795
|
+
};
|
|
796
|
+
|
|
797
|
+
const handleGoToFirstPage = () => {
|
|
798
|
+
handleGoToPage(0);
|
|
799
|
+
};
|
|
800
|
+
|
|
801
|
+
const handleGoToLastPage = () => {
|
|
802
|
+
if (carouselRef.current) {
|
|
803
|
+
handleGoToPage(carouselRef.current.totalPages - 1);
|
|
804
|
+
}
|
|
805
|
+
};
|
|
806
|
+
|
|
807
|
+
const handleGoToPrevPage = () => {
|
|
808
|
+
if (carouselRef.current) {
|
|
809
|
+
handleGoToPage(carouselRef.current.activePageIndex - 1);
|
|
810
|
+
}
|
|
811
|
+
};
|
|
812
|
+
|
|
813
|
+
const handleGoToNextPage = () => {
|
|
814
|
+
if (carouselRef.current) {
|
|
815
|
+
handleGoToPage(carouselRef.current.activePageIndex + 1);
|
|
816
|
+
}
|
|
817
|
+
};
|
|
818
|
+
|
|
819
|
+
return (
|
|
820
|
+
<VStack gap={2}>
|
|
821
|
+
<HStack alignItems="center" gap={2} justifyContent="space-between" paddingX={3}>
|
|
822
|
+
<HStack gap={1}>
|
|
823
|
+
<IconButton
|
|
824
|
+
accessibilityLabel="Go to first page"
|
|
825
|
+
name="doubleChevronRight"
|
|
826
|
+
onPress={handleGoToFirstPage}
|
|
827
|
+
style={{ transform: [{ rotate: '180deg' }] }}
|
|
828
|
+
variant="secondary"
|
|
829
|
+
/>
|
|
830
|
+
<IconButton
|
|
831
|
+
active
|
|
832
|
+
accessibilityLabel="Go to previous page"
|
|
833
|
+
name="arrowLeft"
|
|
834
|
+
onPress={handleGoToPrevPage}
|
|
835
|
+
variant="secondary"
|
|
836
|
+
/>
|
|
837
|
+
</HStack>
|
|
838
|
+
<Box
|
|
839
|
+
alignItems="center"
|
|
840
|
+
background="bgSecondary"
|
|
841
|
+
borderRadius={500}
|
|
842
|
+
flexGrow={1}
|
|
843
|
+
justifyContent="center"
|
|
844
|
+
paddingX={2}
|
|
845
|
+
paddingY={1}
|
|
846
|
+
>
|
|
847
|
+
<Text color="fgMuted" font="label1">
|
|
848
|
+
{currentPageInfo}
|
|
849
|
+
</Text>
|
|
850
|
+
</Box>
|
|
851
|
+
<HStack gap={1}>
|
|
852
|
+
<IconButton
|
|
853
|
+
active
|
|
854
|
+
accessibilityLabel="Go to next page"
|
|
855
|
+
name="arrowRight"
|
|
856
|
+
onPress={handleGoToNextPage}
|
|
857
|
+
variant="secondary"
|
|
858
|
+
/>
|
|
859
|
+
<IconButton
|
|
860
|
+
accessibilityLabel="Go to last page"
|
|
861
|
+
name="doubleChevronRight"
|
|
862
|
+
onPress={handleGoToLastPage}
|
|
863
|
+
variant="secondary"
|
|
864
|
+
/>
|
|
865
|
+
</HStack>
|
|
866
|
+
</HStack>
|
|
867
|
+
<Carousel
|
|
868
|
+
ref={carouselRef}
|
|
869
|
+
hideNavigation
|
|
870
|
+
hidePagination
|
|
871
|
+
drag="none"
|
|
872
|
+
snapMode="item"
|
|
873
|
+
styles={{
|
|
874
|
+
root: { paddingHorizontal: theme.space[3] },
|
|
875
|
+
carousel: { gap: theme.space[1] },
|
|
876
|
+
}}
|
|
877
|
+
title="Explore Assets"
|
|
878
|
+
>
|
|
879
|
+
{Object.values(assets).map((asset) => (
|
|
880
|
+
<CarouselItem key={asset.symbol} accessibilityLabel={asset.name} id={asset.symbol}>
|
|
881
|
+
<SquareAssetCard imageUrl={asset.imageUrl} name={asset.symbol} />
|
|
882
|
+
</CarouselItem>
|
|
883
|
+
))}
|
|
884
|
+
</Carousel>
|
|
885
|
+
</VStack>
|
|
886
|
+
);
|
|
887
|
+
}
|
|
888
|
+
```
|
|
889
|
+
|
|
890
|
+
#### Animated Pagination
|
|
891
|
+
|
|
892
|
+
You can create smooth pagination animations by customizing the pagination dots. This example shows how to create expanding dots that smoothly transition between active and inactive states.
|
|
893
|
+
|
|
894
|
+
```jsx
|
|
895
|
+
function AnimatedPaginationCarousel() {
|
|
896
|
+
const theme = useTheme();
|
|
897
|
+
|
|
898
|
+
const AnimatedPagination = memo((props) => {
|
|
899
|
+
const { totalPages, activePageIndex, onClickPage, style } = props;
|
|
900
|
+
|
|
901
|
+
const AnimatedDot = memo(({ index, isActive, onPress }) => {
|
|
902
|
+
const dotSize = theme.space[1];
|
|
903
|
+
const activeDotWidth = theme.space[3];
|
|
904
|
+
|
|
905
|
+
const springProps = useSpring({
|
|
906
|
+
width: isActive ? activeDotWidth : dotSize,
|
|
907
|
+
backgroundColor: isActive ? theme.color.bgPrimary : theme.color.bgLine,
|
|
908
|
+
config: { tension: 300, friction: 25 },
|
|
909
|
+
});
|
|
910
|
+
|
|
911
|
+
return (
|
|
912
|
+
<Pressable
|
|
913
|
+
accessibilityLabel={`Go to page ${index + 1}`}
|
|
914
|
+
borderRadius={1000}
|
|
915
|
+
borderWidth={0}
|
|
916
|
+
height={dotSize}
|
|
917
|
+
onPress={onPress}
|
|
918
|
+
>
|
|
919
|
+
<animated.View
|
|
920
|
+
style={[
|
|
921
|
+
{
|
|
922
|
+
height: dotSize,
|
|
923
|
+
borderRadius: dotSize / 2,
|
|
924
|
+
},
|
|
925
|
+
springProps,
|
|
926
|
+
]}
|
|
927
|
+
/>
|
|
928
|
+
</Pressable>
|
|
929
|
+
);
|
|
930
|
+
});
|
|
931
|
+
|
|
932
|
+
return (
|
|
933
|
+
<HStack alignItems="center" gap={0.5} justifyContent="center" style={style}>
|
|
934
|
+
{Array.from({ length: totalPages }, (_, index) => (
|
|
935
|
+
<AnimatedDot
|
|
936
|
+
key={index}
|
|
937
|
+
index={index}
|
|
938
|
+
isActive={index === activePageIndex}
|
|
939
|
+
onPress={() => onClickPage?.(index)}
|
|
940
|
+
/>
|
|
941
|
+
))}
|
|
942
|
+
</HStack>
|
|
943
|
+
);
|
|
944
|
+
});
|
|
945
|
+
|
|
946
|
+
return (
|
|
947
|
+
<Carousel
|
|
948
|
+
PaginationComponent={AnimatedPagination}
|
|
949
|
+
drag="snap"
|
|
950
|
+
snapMode="page"
|
|
951
|
+
styles={{
|
|
952
|
+
root: { paddingInline: horizontalPadding },
|
|
953
|
+
carousel: { gap: horizontalGap },
|
|
954
|
+
}}
|
|
955
|
+
title="Explore Assets"
|
|
956
|
+
>
|
|
957
|
+
{Object.values(assets).map((asset, index) => (
|
|
958
|
+
<CarouselItem key={asset.symbol} id={asset.symbol} accessibilityLabel={asset.name}>
|
|
959
|
+
<SquareAssetCard imageUrl={asset.imageUrl} name={asset.symbol} />
|
|
960
|
+
</CarouselItem>
|
|
961
|
+
))}
|
|
962
|
+
</Carousel>
|
|
963
|
+
);
|
|
964
|
+
}
|
|
965
|
+
```
|
|
966
|
+
|
|
967
|
+
### Callbacks
|
|
968
|
+
|
|
969
|
+
You can use the `onChangePage`, `onDragStart`, and `onDragEnd` callbacks to listen for user interaction in the carousel.
|
|
970
|
+
|
|
971
|
+
```tsx
|
|
972
|
+
<Carousel
|
|
973
|
+
onChangePage={(pageIndex: number) => console.log('Page changed', pageIndex)}
|
|
974
|
+
onDragStart={() => console.log('Drag started')}
|
|
975
|
+
onDragEnd={() => console.log('Drag ended')}
|
|
976
|
+
>
|
|
977
|
+
...
|
|
978
|
+
</Carousel>
|
|
979
|
+
```
|
|
980
|
+
|
|
981
|
+
## Props
|
|
982
|
+
|
|
983
|
+
| Prop | Type | Required | Default | Description |
|
|
984
|
+
| --- | --- | --- | --- | --- |
|
|
985
|
+
| `NavigationComponent` | `CarouselNavigationComponent` | No | `DefaultCarouselNavigation` | Custom component to render navigation arrows. |
|
|
986
|
+
| `PaginationComponent` | `CarouselPaginationComponent` | No | `DefaultCarouselPagination` | Custom component to render pagination indicators. |
|
|
987
|
+
| `alignContent` | `flex-start \| flex-end \| center \| stretch \| space-between \| space-around \| space-evenly` | No | `-` | - |
|
|
988
|
+
| `alignItems` | `flex-start \| flex-end \| center \| stretch \| baseline` | No | `-` | - |
|
|
989
|
+
| `alignSelf` | `auto \| FlexAlignType` | No | `-` | - |
|
|
990
|
+
| `animated` | `boolean` | No | `-` | - |
|
|
991
|
+
| `aspectRatio` | `string \| number` | No | `-` | - |
|
|
992
|
+
| `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 | `-` | - |
|
|
993
|
+
| `borderBottomLeftRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
994
|
+
| `borderBottomRightRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
995
|
+
| `borderBottomWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
996
|
+
| `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 | `-` | - |
|
|
997
|
+
| `borderEndWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
998
|
+
| `borderRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
999
|
+
| `borderStartWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
1000
|
+
| `borderTopLeftRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
1001
|
+
| `borderTopRightRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
1002
|
+
| `borderTopWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
1003
|
+
| `borderWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
1004
|
+
| `bordered` | `boolean` | No | `-` | Add a border around all sides of the box. |
|
|
1005
|
+
| `borderedBottom` | `boolean` | No | `-` | Add a border to the bottom side of the box. |
|
|
1006
|
+
| `borderedEnd` | `boolean` | No | `-` | Add a border to the trailing side of the box. |
|
|
1007
|
+
| `borderedHorizontal` | `boolean` | No | `-` | Add a border to the leading and trailing sides of the box. |
|
|
1008
|
+
| `borderedStart` | `boolean` | No | `-` | Add a border to the leading side of the box. |
|
|
1009
|
+
| `borderedTop` | `boolean` | No | `-` | Add a border to the top side of the box. |
|
|
1010
|
+
| `borderedVertical` | `boolean` | No | `-` | Add a border to the top and bottom sides of the box. |
|
|
1011
|
+
| `bottom` | `string \| number` | No | `-` | - |
|
|
1012
|
+
| `children` | `((string \| number \| boolean \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal \| null) & (CarouselItemElement \| CarouselItemElement[]))` | No | `-` | Children are required to be CarouselItems because we calculate their offset relative to the parent container. |
|
|
1013
|
+
| `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 | `-` | - |
|
|
1014
|
+
| `columnGap` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
1015
|
+
| `dangerouslySetBackground` | `string` | No | `-` | - |
|
|
1016
|
+
| `display` | `flex \| none` | No | `-` | - |
|
|
1017
|
+
| `drag` | `none \| free \| snap` | No | `'snap'` | Defines the drag interaction behavior for the carousel. none disables dragging completely. free enables free-form dragging with natural deceleration when released. snap enables dragging with automatic snapping to targets when released, defined by snapMode. |
|
|
1018
|
+
| `elevation` | `0 \| 1 \| 2` | No | `-` | Determines box shadow styles. Parent should have overflow set to visible to ensure styles are not clipped. |
|
|
1019
|
+
| `flexBasis` | `string \| number` | No | `-` | - |
|
|
1020
|
+
| `flexDirection` | `row \| column \| row-reverse \| column-reverse` | No | `-` | - |
|
|
1021
|
+
| `flexGrow` | `number` | No | `-` | - |
|
|
1022
|
+
| `flexShrink` | `number` | No | `-` | - |
|
|
1023
|
+
| `flexWrap` | `wrap \| nowrap \| wrap-reverse` | No | `-` | - |
|
|
1024
|
+
| `font` | `inherit \| FontFamily` | No | `-` | - |
|
|
1025
|
+
| `fontFamily` | `inherit \| FontFamily` | No | `-` | - |
|
|
1026
|
+
| `fontSize` | `inherit \| FontSize` | No | `-` | - |
|
|
1027
|
+
| `fontWeight` | `inherit \| FontWeight` | No | `-` | - |
|
|
1028
|
+
| `gap` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
1029
|
+
| `goToPageAccessibilityLabel` | `string` | No | `-` | Accessibility label for the go to page button. |
|
|
1030
|
+
| `height` | `string \| number` | No | `-` | - |
|
|
1031
|
+
| `hideNavigation` | `boolean` | No | `-` | Hides the navigation arrows (previous/next buttons). |
|
|
1032
|
+
| `hidePagination` | `boolean` | No | `-` | Hides the pagination indicators (dots/bars showing current page). |
|
|
1033
|
+
| `justifyContent` | `flex-start \| flex-end \| center \| space-between \| space-around \| space-evenly` | No | `-` | - |
|
|
1034
|
+
| `key` | `Key \| null` | No | `-` | - |
|
|
1035
|
+
| `left` | `string \| number` | No | `-` | - |
|
|
1036
|
+
| `lineHeight` | `inherit \| LineHeight` | No | `-` | - |
|
|
1037
|
+
| `margin` | `0 \| -1 \| -2 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5` | No | `-` | - |
|
|
1038
|
+
| `marginBottom` | `0 \| -1 \| -2 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5` | No | `-` | - |
|
|
1039
|
+
| `marginEnd` | `0 \| -1 \| -2 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5` | No | `-` | - |
|
|
1040
|
+
| `marginStart` | `0 \| -1 \| -2 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5` | No | `-` | - |
|
|
1041
|
+
| `marginTop` | `0 \| -1 \| -2 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5` | No | `-` | - |
|
|
1042
|
+
| `marginX` | `0 \| -1 \| -2 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5` | No | `-` | - |
|
|
1043
|
+
| `marginY` | `0 \| -1 \| -2 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5` | No | `-` | - |
|
|
1044
|
+
| `maxHeight` | `string \| number` | No | `-` | - |
|
|
1045
|
+
| `maxWidth` | `string \| number` | No | `-` | - |
|
|
1046
|
+
| `minHeight` | `string \| number` | No | `-` | - |
|
|
1047
|
+
| `minWidth` | `string \| number` | No | `-` | - |
|
|
1048
|
+
| `nextPageAccessibilityLabel` | `string` | No | `-` | Accessibility label for the next page button. |
|
|
1049
|
+
| `onChangePage` | `((activePageIndex: number) => void)` | No | `-` | Callback fired when the page changes. |
|
|
1050
|
+
| `onDragEnd` | `(() => void)` | No | `-` | Callback fired when the user ends dragging the carousel. |
|
|
1051
|
+
| `onDragStart` | `(() => void)` | No | `-` | Callback fired when the user starts dragging the carousel. |
|
|
1052
|
+
| `opacity` | `number \| AnimatedNode` | No | `-` | - |
|
|
1053
|
+
| `overflow` | `visible \| hidden \| scroll` | No | `-` | - |
|
|
1054
|
+
| `padding` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
1055
|
+
| `paddingBottom` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
1056
|
+
| `paddingEnd` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
1057
|
+
| `paddingStart` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
1058
|
+
| `paddingTop` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
1059
|
+
| `paddingX` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
1060
|
+
| `paddingY` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
1061
|
+
| `paginationAccessibilityLabel` | `string \| ((pageIndex: number) => string)` | No | `-` | Accessibility label for the go to page button. |
|
|
1062
|
+
| `pin` | `top \| bottom \| left \| right \| all` | No | `-` | Direction in which to absolutely pin the box. |
|
|
1063
|
+
| `position` | `absolute \| relative \| static \| fixed \| sticky` | No | `-` | - |
|
|
1064
|
+
| `previousPageAccessibilityLabel` | `string` | No | `-` | Accessibility label for the previous page button. |
|
|
1065
|
+
| `ref` | `((instance: CarouselImperativeHandle \| null) => void) \| RefObject<CarouselImperativeHandle> \| null` | No | `-` | - |
|
|
1066
|
+
| `right` | `string \| number` | No | `-` | - |
|
|
1067
|
+
| `rowGap` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
1068
|
+
| `snapMode` | `item \| page` | No | `'page'` | Specifies the pagination and navigation strategy for the carousel. item treats each item as a separate page for navigation, pagination, and snapping. page groups items into pages based on visible area for navigation, pagination, and snapping. This affects page calculation, navigation button behavior, and snap targets when dragging. |
|
|
1069
|
+
| `style` | `((false \| RegisteredStyle<ViewStyle> \| Value \| AnimatedInterpolation<string \| number> \| WithAnimatedObject<ViewStyle> \| WithAnimatedArray<Falsy \| ViewStyle \| RegisteredStyle<ViewStyle> \| RecursiveArray<Falsy \| ViewStyle \| RegisteredStyle<ViewStyle>> \| readonly (Falsy \| ViewStyle \| RegisteredStyle<ViewStyle>)[]>) & (false \| ViewStyle \| RegisteredStyle<ViewStyle> \| RecursiveArray<Falsy \| ViewStyle \| RegisteredStyle<ViewStyle>>)) \| null` | No | `-` | Custom styles for the root element. |
|
|
1070
|
+
| `styles` | `{ root?: StyleProp<ViewStyle>; title?: StyleProp<TextStyle>; navigation?: StyleProp<ViewStyle>; pagination?: StyleProp<ViewStyle>; carousel?: StyleProp<ViewStyle>; carouselContainer?: StyleProp<ViewStyle>; }` | No | `-` | Custom styles for the component. |
|
|
1071
|
+
| `testID` | `string` | No | `-` | Used to locate this element in unit and end-to-end tests. Under the hood, testID translates to data-testid on Web. On Mobile, testID stays the same - testID Used to locate this element in unit and end-to-end tests. |
|
|
1072
|
+
| `textAlign` | `left \| right \| auto \| center \| justify` | No | `-` | - |
|
|
1073
|
+
| `textDecorationLine` | `none \| underline \| line-through \| underline line-through` | No | `-` | - |
|
|
1074
|
+
| `textDecorationStyle` | `solid \| dotted \| dashed \| double` | No | `-` | - |
|
|
1075
|
+
| `textTransform` | `none \| capitalize \| uppercase \| lowercase` | No | `-` | - |
|
|
1076
|
+
| `title` | `null \| string \| number \| false \| true \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal` | No | `-` | Title to display above the carousel. When a string is provided, it will be rendered with default title styling. When a React element is provided, it completely replaces the default title component and styling. |
|
|
1077
|
+
| `top` | `string \| number` | No | `-` | - |
|
|
1078
|
+
| `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 | `-` | - |
|
|
1079
|
+
| `userSelect` | `none \| auto \| contain \| text \| all` | No | `-` | - |
|
|
1080
|
+
| `width` | `string \| number` | No | `-` | - |
|
|
1081
|
+
| `zIndex` | `number` | No | `-` | - |
|
|
1082
|
+
|
|
1083
|
+
|