@coinbase/cds-mcp-server 8.17.2 → 8.17.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/mcp-docs/mobile/components/Accordion.txt +189 -0
- package/mcp-docs/mobile/components/AccordionItem.txt +30 -0
- package/mcp-docs/mobile/components/Alert.txt +156 -0
- package/mcp-docs/mobile/components/AreaChart.txt +266 -0
- package/mcp-docs/mobile/components/Avatar.txt +196 -0
- package/mcp-docs/mobile/components/AvatarButton.txt +226 -0
- package/mcp-docs/mobile/components/Banner.txt +222 -0
- package/mcp-docs/mobile/components/BarChart.txt +816 -0
- package/mcp-docs/mobile/components/Box.txt +174 -0
- package/mcp-docs/mobile/components/BrowserBar.txt +147 -0
- package/mcp-docs/mobile/components/Button.txt +199 -0
- package/mcp-docs/mobile/components/ButtonGroup.txt +80 -0
- package/mcp-docs/mobile/components/Carousel.txt +1084 -0
- package/mcp-docs/mobile/components/CartesianChart.txt +826 -0
- package/mcp-docs/mobile/components/CellMedia.txt +71 -0
- package/mcp-docs/mobile/components/Checkbox.txt +246 -0
- package/mcp-docs/mobile/components/CheckboxCell.txt +202 -0
- package/mcp-docs/mobile/components/CheckboxGroup.txt +285 -0
- package/mcp-docs/mobile/components/Chip.txt +195 -0
- package/mcp-docs/mobile/components/Coachmark.txt +158 -0
- package/mcp-docs/mobile/components/Collapsible.txt +105 -0
- package/mcp-docs/mobile/components/ContainedAssetCard.txt +135 -0
- package/mcp-docs/mobile/components/ContentCard.txt +366 -0
- package/mcp-docs/mobile/components/ContentCardBody.txt +136 -0
- package/mcp-docs/mobile/components/ContentCardFooter.txt +128 -0
- package/mcp-docs/mobile/components/ContentCardHeader.txt +146 -0
- package/mcp-docs/mobile/components/ContentCell.txt +227 -0
- package/mcp-docs/mobile/components/ControlGroup.txt +444 -0
- package/mcp-docs/mobile/components/DatePicker.txt +497 -0
- package/mcp-docs/mobile/components/Divider.txt +139 -0
- package/mcp-docs/mobile/components/DotCount.txt +146 -0
- package/mcp-docs/mobile/components/DotStatusColor.txt +59 -0
- package/mcp-docs/mobile/components/DotSymbol.txt +135 -0
- package/mcp-docs/mobile/components/Fallback.txt +158 -0
- package/mcp-docs/mobile/components/FloatingAssetCard.txt +156 -0
- package/mcp-docs/mobile/components/HStack.txt +235 -0
- package/mcp-docs/mobile/components/HeroSquare.txt +48 -0
- package/mcp-docs/mobile/components/Icon.txt +52 -0
- package/mcp-docs/mobile/components/IconButton.txt +269 -0
- package/mcp-docs/mobile/components/InputChip.txt +188 -0
- package/mcp-docs/mobile/components/Interactable.txt +187 -0
- package/mcp-docs/mobile/components/LineChart.txt +1325 -0
- package/mcp-docs/mobile/components/Link.txt +292 -0
- package/mcp-docs/mobile/components/ListCell.txt +391 -0
- package/mcp-docs/mobile/components/LogoMark.txt +85 -0
- package/mcp-docs/mobile/components/LogoWordMark.txt +94 -0
- package/mcp-docs/mobile/components/Lottie.txt +139 -0
- package/mcp-docs/mobile/components/LottieStatusAnimation.txt +47 -0
- package/mcp-docs/mobile/components/Modal.txt +84 -0
- package/mcp-docs/mobile/components/ModalBody.txt +34 -0
- package/mcp-docs/mobile/components/ModalFooter.txt +25 -0
- package/mcp-docs/mobile/components/ModalHeader.txt +28 -0
- package/mcp-docs/mobile/components/MultiContentModule.txt +380 -0
- package/mcp-docs/mobile/components/NavigationTitle.txt +132 -0
- package/mcp-docs/mobile/components/NavigationTitleSelect.txt +142 -0
- package/mcp-docs/mobile/components/NudgeCard.txt +90 -0
- package/mcp-docs/mobile/components/Numpad.txt +341 -0
- package/mcp-docs/mobile/components/Overlay.txt +152 -0
- package/mcp-docs/mobile/components/PageFooter.txt +161 -0
- package/mcp-docs/mobile/components/PageHeader.txt +186 -0
- package/mcp-docs/mobile/components/PeriodSelector.txt +408 -0
- package/mcp-docs/mobile/components/Pictogram.txt +48 -0
- package/mcp-docs/mobile/components/Point.txt +205 -0
- package/mcp-docs/mobile/components/PortalProvider.txt +79 -0
- package/mcp-docs/mobile/components/Pressable.txt +211 -0
- package/mcp-docs/mobile/components/ProgressBar.txt +130 -0
- package/mcp-docs/mobile/components/ProgressBarWithFixedLabels.txt +161 -0
- package/mcp-docs/mobile/components/ProgressBarWithFloatLabel.txt +138 -0
- package/mcp-docs/mobile/components/ProgressCircle.txt +237 -0
- package/mcp-docs/mobile/components/Radio.txt +242 -0
- package/mcp-docs/mobile/components/RadioCell.txt +202 -0
- package/mcp-docs/mobile/components/RadioGroup.txt +282 -0
- package/mcp-docs/mobile/components/ReferenceLine.txt +153 -0
- package/mcp-docs/mobile/components/RemoteImage.txt +106 -0
- package/mcp-docs/mobile/components/RemoteImageGroup.txt +61 -0
- package/mcp-docs/mobile/components/RollingNumber.txt +789 -0
- package/mcp-docs/mobile/components/Scrubber.txt +204 -0
- package/mcp-docs/mobile/components/SearchInput.txt +192 -0
- package/mcp-docs/mobile/components/SectionHeader.txt +205 -0
- package/mcp-docs/mobile/components/SegmentedTabs.txt +316 -0
- package/mcp-docs/mobile/components/Select.txt +212 -0
- package/mcp-docs/mobile/components/SelectChip.txt +324 -0
- package/mcp-docs/mobile/components/SelectOption.txt +85 -0
- package/mcp-docs/mobile/components/SlideButton.txt +331 -0
- package/mcp-docs/mobile/components/Spacer.txt +84 -0
- package/mcp-docs/mobile/components/Sparkline.txt +123 -0
- package/mcp-docs/mobile/components/SparklineGradient.txt +107 -0
- package/mcp-docs/mobile/components/SparklineInteractive.txt +157 -0
- package/mcp-docs/mobile/components/SparklineInteractiveHeader.txt +73 -0
- package/mcp-docs/mobile/components/Spinner.txt +49 -0
- package/mcp-docs/mobile/components/SpotIcon.txt +48 -0
- package/mcp-docs/mobile/components/SpotRectangle.txt +48 -0
- package/mcp-docs/mobile/components/SpotSquare.txt +48 -0
- package/mcp-docs/mobile/components/Stepper.txt +528 -0
- package/mcp-docs/mobile/components/SubBrandLogoMark.txt +126 -0
- package/mcp-docs/mobile/components/SubBrandLogoWordMark.txt +126 -0
- package/mcp-docs/mobile/components/Switch.txt +98 -0
- package/mcp-docs/mobile/components/TabIndicator.txt +49 -0
- package/mcp-docs/mobile/components/TabLabel.txt +154 -0
- package/mcp-docs/mobile/components/TabNavigation.txt +147 -0
- package/mcp-docs/mobile/components/TabbedChips.txt +143 -0
- package/mcp-docs/mobile/components/Tabs.txt +191 -0
- package/mcp-docs/mobile/components/Tag.txt +301 -0
- package/mcp-docs/mobile/components/Text.txt +212 -0
- package/mcp-docs/mobile/components/TextInput.txt +718 -0
- package/mcp-docs/mobile/components/ThemeProvider.txt +133 -0
- package/mcp-docs/mobile/components/Toast.txt +197 -0
- package/mcp-docs/mobile/components/Tooltip.txt +60 -0
- package/mcp-docs/mobile/components/TopNavBar.txt +162 -0
- package/mcp-docs/mobile/components/Tour.txt +159 -0
- package/mcp-docs/mobile/components/Tray.txt +253 -0
- package/mcp-docs/mobile/components/UpsellCard.txt +322 -0
- package/mcp-docs/mobile/components/VStack.txt +223 -0
- package/mcp-docs/mobile/components/XAxis.txt +622 -0
- package/mcp-docs/mobile/components/YAxis.txt +568 -0
- package/mcp-docs/mobile/getting-started/introduction.txt +99 -0
- package/mcp-docs/mobile/getting-started/mcp-server.txt +94 -0
- package/mcp-docs/mobile/getting-started/playground.txt +25 -0
- package/mcp-docs/mobile/hooks/useDimensions.txt +47 -0
- package/mcp-docs/mobile/hooks/useOverlayContentContext.txt +215 -0
- package/mcp-docs/mobile/hooks/useTheme.txt +110 -0
- package/mcp-docs/mobile/routes.txt +132 -0
- package/mcp-docs/web/components/Accordion.txt +190 -0
- package/mcp-docs/web/components/AccordionItem.txt +32 -0
- package/mcp-docs/web/components/Alert.txt +165 -0
- package/mcp-docs/web/components/AreaChart.txt +511 -0
- package/mcp-docs/web/components/Avatar.txt +212 -0
- package/mcp-docs/web/components/AvatarButton.txt +241 -0
- package/mcp-docs/web/components/Banner.txt +227 -0
- package/mcp-docs/web/components/BarChart.txt +1268 -0
- package/mcp-docs/web/components/Box.txt +176 -0
- package/mcp-docs/web/components/Button.txt +213 -0
- package/mcp-docs/web/components/ButtonGroup.txt +80 -0
- package/mcp-docs/web/components/Calendar.txt +182 -0
- package/mcp-docs/web/components/Carousel.txt +1576 -0
- package/mcp-docs/web/components/CartesianChart.txt +1045 -0
- package/mcp-docs/web/components/CellMedia.txt +57 -0
- package/mcp-docs/web/components/Checkbox.txt +189 -0
- package/mcp-docs/web/components/CheckboxCell.txt +203 -0
- package/mcp-docs/web/components/CheckboxGroup.txt +220 -0
- package/mcp-docs/web/components/Chip.txt +197 -0
- package/mcp-docs/web/components/Coachmark.txt +189 -0
- package/mcp-docs/web/components/Collapsible.txt +120 -0
- package/mcp-docs/web/components/ContainedAssetCard.txt +233 -0
- package/mcp-docs/web/components/ContentCard.txt +368 -0
- package/mcp-docs/web/components/ContentCardBody.txt +138 -0
- package/mcp-docs/web/components/ContentCardFooter.txt +130 -0
- package/mcp-docs/web/components/ContentCardHeader.txt +148 -0
- package/mcp-docs/web/components/ContentCell.txt +220 -0
- package/mcp-docs/web/components/ControlGroup.txt +437 -0
- package/mcp-docs/web/components/DatePicker.txt +506 -0
- package/mcp-docs/web/components/Divider.txt +144 -0
- package/mcp-docs/web/components/DotCount.txt +150 -0
- package/mcp-docs/web/components/DotStatusColor.txt +59 -0
- package/mcp-docs/web/components/DotSymbol.txt +138 -0
- package/mcp-docs/web/components/Dropdown.txt +120 -0
- package/mcp-docs/web/components/Fallback.txt +164 -0
- package/mcp-docs/web/components/FloatingAssetCard.txt +251 -0
- package/mcp-docs/web/components/FullscreenAlert.txt +70 -0
- package/mcp-docs/web/components/FullscreenModal.txt +146 -0
- package/mcp-docs/web/components/FullscreenModalLayout.txt +188 -0
- package/mcp-docs/web/components/Grid.txt +237 -0
- package/mcp-docs/web/components/GridColumn.txt +210 -0
- package/mcp-docs/web/components/HStack.txt +237 -0
- package/mcp-docs/web/components/HeroSquare.txt +49 -0
- package/mcp-docs/web/components/Icon.txt +146 -0
- package/mcp-docs/web/components/IconButton.txt +391 -0
- package/mcp-docs/web/components/InputChip.txt +188 -0
- package/mcp-docs/web/components/Interactable.txt +194 -0
- package/mcp-docs/web/components/LineChart.txt +1577 -0
- package/mcp-docs/web/components/Link.txt +244 -0
- package/mcp-docs/web/components/ListCell.txt +397 -0
- package/mcp-docs/web/components/LogoMark.txt +85 -0
- package/mcp-docs/web/components/LogoWordMark.txt +94 -0
- package/mcp-docs/web/components/Lottie.txt +158 -0
- package/mcp-docs/web/components/LottieStatusAnimation.txt +58 -0
- package/mcp-docs/web/components/MediaQueryProvider.txt +109 -0
- package/mcp-docs/web/components/Modal.txt +193 -0
- package/mcp-docs/web/components/ModalBody.txt +118 -0
- package/mcp-docs/web/components/ModalFooter.txt +120 -0
- package/mcp-docs/web/components/ModalHeader.txt +124 -0
- package/mcp-docs/web/components/MultiContentModule.txt +382 -0
- package/mcp-docs/web/components/NavigationBar.txt +103 -0
- package/mcp-docs/web/components/NavigationTitle.txt +26 -0
- package/mcp-docs/web/components/NavigationTitleSelect.txt +46 -0
- package/mcp-docs/web/components/NudgeCard.txt +182 -0
- package/mcp-docs/web/components/Overlay.txt +172 -0
- package/mcp-docs/web/components/PageFooter.txt +185 -0
- package/mcp-docs/web/components/PageHeader.txt +244 -0
- package/mcp-docs/web/components/Pagination.txt +500 -0
- package/mcp-docs/web/components/PeriodSelector.txt +704 -0
- package/mcp-docs/web/components/Pictogram.txt +49 -0
- package/mcp-docs/web/components/Point.txt +461 -0
- package/mcp-docs/web/components/PortalProvider.txt +77 -0
- package/mcp-docs/web/components/Pressable.txt +194 -0
- package/mcp-docs/web/components/ProgressBar.txt +164 -0
- package/mcp-docs/web/components/ProgressBarWithFixedLabels.txt +213 -0
- package/mcp-docs/web/components/ProgressBarWithFloatLabel.txt +182 -0
- package/mcp-docs/web/components/ProgressCircle.txt +444 -0
- package/mcp-docs/web/components/Radio.txt +220 -0
- package/mcp-docs/web/components/RadioCell.txt +216 -0
- package/mcp-docs/web/components/RadioGroup.txt +289 -0
- package/mcp-docs/web/components/ReferenceLine.txt +452 -0
- package/mcp-docs/web/components/RemoteImage.txt +166 -0
- package/mcp-docs/web/components/RemoteImageGroup.txt +87 -0
- package/mcp-docs/web/components/RollingNumber.txt +1022 -0
- package/mcp-docs/web/components/Scrubber.txt +232 -0
- package/mcp-docs/web/components/SearchInput.txt +118 -0
- package/mcp-docs/web/components/SectionHeader.txt +218 -0
- package/mcp-docs/web/components/SegmentedTabs.txt +325 -0
- package/mcp-docs/web/components/Select.txt +225 -0
- package/mcp-docs/web/components/SelectChip.txt +315 -0
- package/mcp-docs/web/components/SelectOption.txt +166 -0
- package/mcp-docs/web/components/Sidebar.txt +350 -0
- package/mcp-docs/web/components/SidebarItem.txt +132 -0
- package/mcp-docs/web/components/SidebarMoreMenu.txt +31 -0
- package/mcp-docs/web/components/Spacer.txt +174 -0
- package/mcp-docs/web/components/Sparkline.txt +123 -0
- package/mcp-docs/web/components/SparklineGradient.txt +107 -0
- package/mcp-docs/web/components/SparklineInteractive.txt +154 -0
- package/mcp-docs/web/components/SparklineInteractiveHeader.txt +77 -0
- package/mcp-docs/web/components/Spinner.txt +129 -0
- package/mcp-docs/web/components/SpotIcon.txt +49 -0
- package/mcp-docs/web/components/SpotRectangle.txt +49 -0
- package/mcp-docs/web/components/SpotSquare.txt +49 -0
- package/mcp-docs/web/components/Stepper.txt +683 -0
- package/mcp-docs/web/components/SubBrandLogoMark.txt +126 -0
- package/mcp-docs/web/components/SubBrandLogoWordMark.txt +126 -0
- package/mcp-docs/web/components/Switch.txt +86 -0
- package/mcp-docs/web/components/TabIndicator.txt +49 -0
- package/mcp-docs/web/components/TabLabel.txt +159 -0
- package/mcp-docs/web/components/TabNavigation.txt +160 -0
- package/mcp-docs/web/components/TabbedChips.txt +156 -0
- package/mcp-docs/web/components/Table.txt +368 -0
- package/mcp-docs/web/components/TableBody.txt +84 -0
- package/mcp-docs/web/components/TableCaption.txt +103 -0
- package/mcp-docs/web/components/TableCell.txt +166 -0
- package/mcp-docs/web/components/TableCellFallback.txt +98 -0
- package/mcp-docs/web/components/TableFooter.txt +84 -0
- package/mcp-docs/web/components/TableHeader.txt +101 -0
- package/mcp-docs/web/components/TableRow.txt +141 -0
- package/mcp-docs/web/components/Tabs.txt +213 -0
- package/mcp-docs/web/components/Tag.txt +305 -0
- package/mcp-docs/web/components/Text.txt +233 -0
- package/mcp-docs/web/components/TextInput.txt +653 -0
- package/mcp-docs/web/components/ThemeProvider.txt +200 -0
- package/mcp-docs/web/components/TileButton.txt +159 -0
- package/mcp-docs/web/components/Toast.txt +204 -0
- package/mcp-docs/web/components/Tooltip.txt +90 -0
- package/mcp-docs/web/components/Tour.txt +180 -0
- package/mcp-docs/web/components/Tray.txt +289 -0
- package/mcp-docs/web/components/UpsellCard.txt +320 -0
- package/mcp-docs/web/components/VStack.txt +225 -0
- package/mcp-docs/web/components/XAxis.txt +620 -0
- package/mcp-docs/web/components/YAxis.txt +549 -0
- package/mcp-docs/web/getting-started/introduction.txt +99 -0
- package/mcp-docs/web/getting-started/mcp-server.txt +94 -0
- package/mcp-docs/web/getting-started/playground.txt +25 -0
- package/mcp-docs/web/hooks/useBreakpoints.txt +33 -0
- package/mcp-docs/web/hooks/useDimensions.txt +55 -0
- package/mcp-docs/web/hooks/useHasMounted.txt +55 -0
- package/mcp-docs/web/hooks/useIsoEffect.txt +42 -0
- package/mcp-docs/web/hooks/useMediaQuery.txt +94 -0
- package/mcp-docs/web/hooks/useOverlayContentContext.txt +217 -0
- package/mcp-docs/web/hooks/useScrollBlocker.txt +63 -0
- package/mcp-docs/web/hooks/useTheme.txt +105 -0
- package/mcp-docs/web/routes.txt +155 -0
- package/package.json +1 -1
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
# SegmentedTabs
|
|
2
|
+
|
|
3
|
+
Switches between different views of content.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```jsx
|
|
8
|
+
import { SegmentedTabs } from '@coinbase/cds-web/tabs/SegmentedTabs'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Required | Default | Description |
|
|
14
|
+
| --- | --- | --- | --- | --- |
|
|
15
|
+
| `activeTab` | `TabValue<T> \| null` | Yes | `-` | React state for the currently active tab. Setting it to null results in no active tab. |
|
|
16
|
+
| `onChange` | `(activeTab: TabValue<T> \| null) => void` | Yes | `-` | Callback that is fired when the active tab changes. Use this callback to update the activeTab state. |
|
|
17
|
+
| `tabs` | `(TabValue<T> & { Component?: TabComponent<T> \| undefined; })[]` | Yes | `-` | The array of tabs data. Each tab may optionally define a custom Component to render. |
|
|
18
|
+
| `TabComponent` | `TabComponent<T>` | No | `-` | The default Component to render each tab. |
|
|
19
|
+
| `TabsActiveIndicatorComponent` | `TabsActiveIndicatorComponent` | No | `-` | The default Component to render the tabs active indicator. |
|
|
20
|
+
| `activeBackground` | `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 | `-` | Background color passed to the TabsActiveIndicatorComponent. |
|
|
21
|
+
| `alignContent` | `ResponsiveProp<center \| normal \| start \| end \| flex-start \| flex-end \| stretch \| baseline \| first baseline \| last baseline \| space-between \| space-around \| space-evenly>` | No | `-` | - |
|
|
22
|
+
| `alignItems` | `ResponsiveProp<center \| normal \| start \| end \| flex-start \| flex-end \| self-start \| self-end \| stretch \| baseline \| first baseline \| last baseline>` | No | `-` | - |
|
|
23
|
+
| `alignSelf` | `ResponsiveProp<center \| normal \| auto \| start \| end \| flex-start \| flex-end \| self-start \| self-end \| stretch \| baseline \| first baseline \| last baseline>` | No | `-` | - |
|
|
24
|
+
| `as` | `div` | No | `-` | - |
|
|
25
|
+
| `aspectRatio` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
26
|
+
| `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 | `-` | - |
|
|
27
|
+
| `borderBottomLeftRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
28
|
+
| `borderBottomRightRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
29
|
+
| `borderBottomWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
30
|
+
| `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 | `-` | - |
|
|
31
|
+
| `borderEndWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
32
|
+
| `borderRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
33
|
+
| `borderStartWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
34
|
+
| `borderTopLeftRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
35
|
+
| `borderTopRightRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
36
|
+
| `borderTopWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
37
|
+
| `borderWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
38
|
+
| `bordered` | `boolean` | No | `-` | Add a border around all sides of the box. |
|
|
39
|
+
| `borderedBottom` | `boolean` | No | `-` | Add a border to the bottom side of the box. |
|
|
40
|
+
| `borderedEnd` | `boolean` | No | `-` | Add a border to the trailing side of the box. |
|
|
41
|
+
| `borderedHorizontal` | `boolean` | No | `-` | Add a border to the leading and trailing sides of the box. |
|
|
42
|
+
| `borderedStart` | `boolean` | No | `-` | Add a border to the leading side of the box. |
|
|
43
|
+
| `borderedTop` | `boolean` | No | `-` | Add a border to the top side of the box. |
|
|
44
|
+
| `borderedVertical` | `boolean` | No | `-` | Add a border to the top and bottom sides of the box. |
|
|
45
|
+
| `bottom` | `ResponsiveProp<Bottom<string \| number>>` | No | `-` | - |
|
|
46
|
+
| `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 | `-` | - |
|
|
47
|
+
| `columnGap` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
48
|
+
| `dangerouslySetBackground` | `string` | No | `-` | - |
|
|
49
|
+
| `disabled` | `boolean` | No | `-` | Disable interactions on all the tabs. |
|
|
50
|
+
| `display` | `ResponsiveProp<grid \| revert \| none \| block \| inline \| inline-block \| flex \| inline-flex \| inline-grid \| contents \| flow-root \| list-item>` | No | `-` | - |
|
|
51
|
+
| `elevation` | `0 \| 1 \| 2` | No | `-` | - |
|
|
52
|
+
| `flexBasis` | `ResponsiveProp<FlexBasis<string \| number>>` | No | `-` | - |
|
|
53
|
+
| `flexDirection` | `ResponsiveProp<column \| row \| row-reverse \| column-reverse>` | No | `-` | - |
|
|
54
|
+
| `flexGrow` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset` | No | `-` | - |
|
|
55
|
+
| `flexShrink` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset` | No | `-` | - |
|
|
56
|
+
| `flexWrap` | `ResponsiveProp<nowrap \| wrap \| wrap-reverse>` | No | `-` | - |
|
|
57
|
+
| `font` | `ResponsiveProp<FontFamily \| inherit>` | No | `-` | - |
|
|
58
|
+
| `fontFamily` | `ResponsiveProp<FontFamily \| inherit>` | No | `-` | - |
|
|
59
|
+
| `fontSize` | `ResponsiveProp<FontSize \| inherit>` | No | `-` | - |
|
|
60
|
+
| `fontWeight` | `ResponsiveProp<FontWeight \| inherit>` | No | `-` | - |
|
|
61
|
+
| `gap` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
62
|
+
| `grid` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| none` | No | `-` | - |
|
|
63
|
+
| `gridArea` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
64
|
+
| `gridAutoColumns` | `ResponsiveProp<GridAutoColumns<string \| number>>` | No | `-` | - |
|
|
65
|
+
| `gridAutoFlow` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| row \| column \| dense` | No | `-` | - |
|
|
66
|
+
| `gridAutoRows` | `ResponsiveProp<GridAutoRows<string \| number>>` | No | `-` | - |
|
|
67
|
+
| `gridColumn` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
68
|
+
| `gridColumnEnd` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
69
|
+
| `gridColumnStart` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
70
|
+
| `gridRow` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
71
|
+
| `gridRowEnd` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
72
|
+
| `gridRowStart` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
73
|
+
| `gridTemplate` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| none` | No | `-` | - |
|
|
74
|
+
| `gridTemplateAreas` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| none` | No | `-` | - |
|
|
75
|
+
| `gridTemplateColumns` | `ResponsiveProp<GridTemplateColumns<string \| number>>` | No | `-` | - |
|
|
76
|
+
| `gridTemplateRows` | `ResponsiveProp<GridTemplateRows<string \| number>>` | No | `-` | - |
|
|
77
|
+
| `height` | `ResponsiveProp<Height<string \| number>>` | No | `-` | - |
|
|
78
|
+
| `justifyContent` | `ResponsiveProp<left \| right \| center \| normal \| start \| end \| flex-start \| flex-end \| stretch \| space-between \| space-around \| space-evenly>` | No | `-` | - |
|
|
79
|
+
| `key` | `Key \| null` | No | `-` | - |
|
|
80
|
+
| `left` | `ResponsiveProp<Left<string \| number>>` | No | `-` | - |
|
|
81
|
+
| `lineHeight` | `ResponsiveProp<LineHeight \| inherit>` | No | `-` | - |
|
|
82
|
+
| `margin` | `ResponsiveProp<0 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
|
|
83
|
+
| `marginBottom` | `ResponsiveProp<0 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
|
|
84
|
+
| `marginEnd` | `ResponsiveProp<0 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
|
|
85
|
+
| `marginStart` | `ResponsiveProp<0 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
|
|
86
|
+
| `marginTop` | `ResponsiveProp<0 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
|
|
87
|
+
| `marginX` | `ResponsiveProp<0 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
|
|
88
|
+
| `marginY` | `ResponsiveProp<0 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
|
|
89
|
+
| `maxHeight` | `ResponsiveProp<MaxHeight<string \| number>>` | No | `-` | - |
|
|
90
|
+
| `maxWidth` | `ResponsiveProp<MaxWidth<string \| number>>` | No | `-` | - |
|
|
91
|
+
| `minHeight` | `ResponsiveProp<MinHeight<string \| number>>` | No | `-` | - |
|
|
92
|
+
| `minWidth` | `ResponsiveProp<MinWidth<string \| number>>` | No | `-` | - |
|
|
93
|
+
| `opacity` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset` | No | `-` | - |
|
|
94
|
+
| `overflow` | `ResponsiveProp<hidden \| auto \| visible \| clip \| scroll>` | No | `-` | - |
|
|
95
|
+
| `padding` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
96
|
+
| `paddingBottom` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
97
|
+
| `paddingEnd` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
98
|
+
| `paddingStart` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
99
|
+
| `paddingTop` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
100
|
+
| `paddingX` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
101
|
+
| `paddingY` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
102
|
+
| `pin` | `top \| bottom \| left \| right \| all` | No | `-` | Direction in which to absolutely pin the box. |
|
|
103
|
+
| `position` | `ResponsiveProp<fixed \| static \| relative \| absolute \| sticky>` | No | `-` | - |
|
|
104
|
+
| `ref` | `null \| (instance: HTMLElement \| null) => void \| MutableRefObject<HTMLElement \| null>` | No | `-` | - |
|
|
105
|
+
| `right` | `ResponsiveProp<Right<string \| number>>` | No | `-` | - |
|
|
106
|
+
| `rowGap` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
107
|
+
| `style` | `CSSProperties` | No | `-` | - |
|
|
108
|
+
| `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 |
|
|
109
|
+
| `textAlign` | `ResponsiveProp<center \| start \| end \| justify>` | No | `-` | - |
|
|
110
|
+
| `textDecoration` | `ResponsiveProp<none \| underline \| overline \| line-through \| underline overline \| underline double>` | No | `-` | - |
|
|
111
|
+
| `textTransform` | `ResponsiveProp<capitalize \| lowercase \| none \| uppercase>` | No | `-` | - |
|
|
112
|
+
| `top` | `ResponsiveProp<Top<string \| number>>` | No | `-` | - |
|
|
113
|
+
| `transform` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| none` | No | `-` | - |
|
|
114
|
+
| `userSelect` | `ResponsiveProp<text \| none \| auto \| all>` | No | `-` | - |
|
|
115
|
+
| `visibility` | `ResponsiveProp<hidden \| visible>` | No | `-` | - |
|
|
116
|
+
| `width` | `ResponsiveProp<Width<string \| number>>` | No | `-` | - |
|
|
117
|
+
| `zIndex` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
## Examples
|
|
121
|
+
|
|
122
|
+
### Basic Example
|
|
123
|
+
|
|
124
|
+
Use the `onChange` prop to listen and make changes to the `activeTab` state.
|
|
125
|
+
|
|
126
|
+
```jsx live
|
|
127
|
+
function Example() {
|
|
128
|
+
const tabs = [
|
|
129
|
+
{ id: 'buy', label: 'Buy' },
|
|
130
|
+
{ id: 'sell', label: 'Sell' },
|
|
131
|
+
{ id: 'convert', label: 'Convert' },
|
|
132
|
+
];
|
|
133
|
+
const [activeTab, updateActiveTab] = useState(tabs[0]);
|
|
134
|
+
const handleChange = useCallback((activeTab) => updateActiveTab(activeTab), []);
|
|
135
|
+
return (
|
|
136
|
+
<SegmentedTabs
|
|
137
|
+
accessibilityLabel="Switch token action views"
|
|
138
|
+
activeTab={activeTab}
|
|
139
|
+
onChange={handleChange}
|
|
140
|
+
tabs={tabs}
|
|
141
|
+
/>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### With Initial Value
|
|
147
|
+
|
|
148
|
+
You can set any tab as the initial active tab.
|
|
149
|
+
|
|
150
|
+
```jsx live
|
|
151
|
+
function Example() {
|
|
152
|
+
const tabs = [
|
|
153
|
+
{ id: 'buy', label: 'Buy' },
|
|
154
|
+
{ id: 'sell', label: 'Sell' },
|
|
155
|
+
{ id: 'convert', label: 'Convert' },
|
|
156
|
+
];
|
|
157
|
+
const [activeTab, updateActiveTab] = useState(tabs[1]); // Start with 'Sell'
|
|
158
|
+
const handleChange = useCallback((activeTab) => updateActiveTab(activeTab), []);
|
|
159
|
+
return (
|
|
160
|
+
<SegmentedTabs
|
|
161
|
+
accessibilityLabel="Switch token action views"
|
|
162
|
+
activeTab={activeTab}
|
|
163
|
+
onChange={handleChange}
|
|
164
|
+
tabs={tabs}
|
|
165
|
+
/>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### No Initial Value
|
|
171
|
+
|
|
172
|
+
SegmentedTabs can start with no active selection.
|
|
173
|
+
|
|
174
|
+
```jsx live
|
|
175
|
+
function Example() {
|
|
176
|
+
const tabs = [
|
|
177
|
+
{ id: 'buy', label: 'Buy' },
|
|
178
|
+
{ id: 'sell', label: 'Sell' },
|
|
179
|
+
{ id: 'convert', label: 'Convert' },
|
|
180
|
+
];
|
|
181
|
+
const [activeTab, updateActiveTab] = useState(null); // No initial selection
|
|
182
|
+
const handleChange = useCallback((activeTab) => updateActiveTab(activeTab), []);
|
|
183
|
+
return (
|
|
184
|
+
<SegmentedTabs
|
|
185
|
+
accessibilityLabel="Switch token action views"
|
|
186
|
+
activeTab={activeTab}
|
|
187
|
+
onChange={handleChange}
|
|
188
|
+
tabs={tabs}
|
|
189
|
+
/>
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Disabled State
|
|
195
|
+
|
|
196
|
+
You can disable the entire SegmentedTabs component.
|
|
197
|
+
|
|
198
|
+
```jsx live
|
|
199
|
+
function Example() {
|
|
200
|
+
const tabs = [
|
|
201
|
+
{ id: 'buy', label: 'Buy' },
|
|
202
|
+
{ id: 'sell', label: 'Sell' },
|
|
203
|
+
{ id: 'convert', label: 'Convert' },
|
|
204
|
+
];
|
|
205
|
+
const [activeTab, updateActiveTab] = useState(tabs[0]);
|
|
206
|
+
const handleChange = useCallback((activeTab) => updateActiveTab(activeTab), []);
|
|
207
|
+
return (
|
|
208
|
+
<SegmentedTabs
|
|
209
|
+
accessibilityLabel="Switch token action views"
|
|
210
|
+
activeTab={activeTab}
|
|
211
|
+
disabled
|
|
212
|
+
onChange={handleChange}
|
|
213
|
+
tabs={tabs}
|
|
214
|
+
/>
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Disabled Individual Tab
|
|
220
|
+
|
|
221
|
+
Individual tabs can be disabled while keeping others interactive.
|
|
222
|
+
|
|
223
|
+
```jsx live
|
|
224
|
+
function Example() {
|
|
225
|
+
const tabs = [
|
|
226
|
+
{ id: 'buy', label: 'Buy' },
|
|
227
|
+
{ id: 'sell', label: 'Sell', disabled: true },
|
|
228
|
+
{ id: 'convert', label: 'Convert' },
|
|
229
|
+
];
|
|
230
|
+
const [activeTab, updateActiveTab] = useState(tabs[0]);
|
|
231
|
+
const handleChange = useCallback((activeTab) => updateActiveTab(activeTab), []);
|
|
232
|
+
return (
|
|
233
|
+
<SegmentedTabs
|
|
234
|
+
accessibilityLabel="Switch token action views"
|
|
235
|
+
activeTab={activeTab}
|
|
236
|
+
onChange={handleChange}
|
|
237
|
+
tabs={tabs}
|
|
238
|
+
/>
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Custom Tab Component
|
|
244
|
+
|
|
245
|
+
You can customize individual tabs by providing a custom `Component` for specific tabs.
|
|
246
|
+
|
|
247
|
+
```jsx live
|
|
248
|
+
function Example() {
|
|
249
|
+
const CustomSegmentedTabColor = useCallback(
|
|
250
|
+
(props) => <SegmentedTab {...props} activeColor="fgWarning" color="bgPrimary" font="label2" />,
|
|
251
|
+
[],
|
|
252
|
+
);
|
|
253
|
+
|
|
254
|
+
const CustomSegmentedTabFont = useCallback(
|
|
255
|
+
(props) => <SegmentedTab {...props} font="label2" />,
|
|
256
|
+
[],
|
|
257
|
+
);
|
|
258
|
+
|
|
259
|
+
const tabs = [
|
|
260
|
+
{ id: 'buy', label: 'Buy', Component: CustomSegmentedTabColor },
|
|
261
|
+
{ id: 'sell', label: 'Sell', Component: CustomSegmentedTabFont },
|
|
262
|
+
{ id: 'convert', label: 'Convert', Component: CustomSegmentedTabColor },
|
|
263
|
+
];
|
|
264
|
+
const [activeTab, updateActiveTab] = useState(tabs[0]);
|
|
265
|
+
const handleChange = useCallback((activeTab) => updateActiveTab(activeTab), []);
|
|
266
|
+
return (
|
|
267
|
+
<SegmentedTabs
|
|
268
|
+
accessibilityLabel="Switch token action views"
|
|
269
|
+
activeTab={activeTab}
|
|
270
|
+
onChange={handleChange}
|
|
271
|
+
tabs={tabs}
|
|
272
|
+
/>
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### Custom Active Indicator
|
|
278
|
+
|
|
279
|
+
You can customize the active indicator component and overall styling.
|
|
280
|
+
|
|
281
|
+
```jsx live
|
|
282
|
+
function Example() {
|
|
283
|
+
const CustomActiveIndicator = useCallback(
|
|
284
|
+
({ activeTabRect }) => (
|
|
285
|
+
<TabsActiveIndicator activeTabRect={activeTabRect} background="bgOverlay" />
|
|
286
|
+
),
|
|
287
|
+
[],
|
|
288
|
+
);
|
|
289
|
+
|
|
290
|
+
const AnotherCustomSegmentedTab = useCallback(({ id, label, disabled }) => {
|
|
291
|
+
const { activeTab } = useTabsContext();
|
|
292
|
+
const isActive = activeTab?.id === id;
|
|
293
|
+
const renderedLabel = (
|
|
294
|
+
<Text color={isActive ? 'fgPositive' : 'fgNegative'} font="label2" overflow="truncate">
|
|
295
|
+
{label}
|
|
296
|
+
</Text>
|
|
297
|
+
);
|
|
298
|
+
|
|
299
|
+
return (
|
|
300
|
+
<SegmentedTab disabled={disabled} id={id} label={renderedLabel} style={{ borderRadius: 0 }} />
|
|
301
|
+
);
|
|
302
|
+
}, []);
|
|
303
|
+
|
|
304
|
+
const tabs = [
|
|
305
|
+
{ id: 'buy', label: 'Buy' },
|
|
306
|
+
{ id: 'sell', label: 'Sell' },
|
|
307
|
+
{ id: 'convert', label: 'Convert' },
|
|
308
|
+
];
|
|
309
|
+
const [activeTab, updateActiveTab] = useState(tabs[0]);
|
|
310
|
+
const handleChange = useCallback((activeTab) => updateActiveTab(activeTab), []);
|
|
311
|
+
return (
|
|
312
|
+
<SegmentedTabs
|
|
313
|
+
accessibilityLabel="Switch token action views"
|
|
314
|
+
activeTab={activeTab}
|
|
315
|
+
borderRadius={0}
|
|
316
|
+
onChange={handleChange}
|
|
317
|
+
tabs={tabs}
|
|
318
|
+
TabComponent={AnotherCustomSegmentedTab}
|
|
319
|
+
TabsActiveIndicatorComponent={CustomActiveIndicator}
|
|
320
|
+
/>
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# Select
|
|
2
|
+
|
|
3
|
+
A Dropdown control for selecting from a list of options.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```jsx
|
|
8
|
+
import { Select } from '@coinbase/cds-web/controls/Select'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Required | Default | Description |
|
|
14
|
+
| --- | --- | --- | --- | --- |
|
|
15
|
+
| `accessibilityLabel` | `string` | No | `-` | Accessibility label describing the element. |
|
|
16
|
+
| `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 | `-` | Background color of the overlay (element being interacted with). |
|
|
17
|
+
| `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 | `-` | Border color of the element. |
|
|
18
|
+
| `borderRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
19
|
+
| `borderWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
20
|
+
| `children` | `null \| string \| number \| false \| true \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal` | No | `-` | Label for the control option. |
|
|
21
|
+
| `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 | `black` | - |
|
|
22
|
+
| `controlColor` | `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 | `bgPrimary` | Sets the checked/active color of the control. |
|
|
23
|
+
| `iconStyle` | `CSSProperties` | No | `-` | Style for the icon element |
|
|
24
|
+
| `indeterminate` | `boolean` | No | `-` | Enable indeterminate state. Useful when you want to indicate that sub-items of a control are partially filled. |
|
|
25
|
+
| `labelStyle` | `CSSProperties` | No | `-` | Style for the label element |
|
|
26
|
+
| `onChange` | `ChangeEventHandler<HTMLInputElement>` | No | `-` | - |
|
|
27
|
+
| `ref` | `null \| (instance: HTMLInputElement \| null) => void \| RefObject<HTMLInputElement>` | No | `-` | - |
|
|
28
|
+
| `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 |
|
|
29
|
+
| `type` | `number \| color \| button \| search \| time \| image \| text \| hidden \| string & {} \| email \| checkbox \| radio \| tel \| url \| date \| submit \| reset \| datetime-local \| file \| month \| password \| range \| week` | No | `-` | - |
|
|
30
|
+
| `value` | `string` | No | `-` | Value of the option. Useful for multiple choice. |
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## Examples
|
|
34
|
+
|
|
35
|
+
### Default Composition
|
|
36
|
+
|
|
37
|
+
`Select` can take anything as a child, however, we strongly recommend that you use `SelectOption`. It has the same API as a `ListCell`, but with custom styles specific to usage within a `Select`. `SelectOption` also comes with a lot of baked in functionality, like keyboard navigation, accessibility properties, and focus behaviors.
|
|
38
|
+
|
|
39
|
+
```jsx live
|
|
40
|
+
function DefaultSelect() {
|
|
41
|
+
const [value, setValue] = useState();
|
|
42
|
+
const options = ['Option 1', 'Option 2', 'Option 3', 'Option 4', 'Option 5', 'Option 6'];
|
|
43
|
+
return (
|
|
44
|
+
<VStack padding={2}>
|
|
45
|
+
<Select value={value} placeholder="Choose something..." onChange={setValue}>
|
|
46
|
+
{options.map((option) => (
|
|
47
|
+
<SelectOption value={option} key={option} title={option} description="Description" />
|
|
48
|
+
))}
|
|
49
|
+
</Select>
|
|
50
|
+
</VStack>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Value/Label Object Model
|
|
56
|
+
|
|
57
|
+
Sometimes you may want to surface a label instead of the select value. You can pass a `valueLabel` prop with the currently selected value's corresponding label, which will appear to be the value of the Select.
|
|
58
|
+
|
|
59
|
+
```jsx live
|
|
60
|
+
function DefaultSelect() {
|
|
61
|
+
const [value, setValue] = useState();
|
|
62
|
+
const options = [
|
|
63
|
+
{ value: '1', label: 'Option 1' },
|
|
64
|
+
{ value: '2', label: 'Option 2' },
|
|
65
|
+
{ value: '3', label: 'Option 3' },
|
|
66
|
+
{ value: '4', label: 'Option 4' },
|
|
67
|
+
];
|
|
68
|
+
const selectedValueLabel = value && options.find((option) => option.value === value).label;
|
|
69
|
+
return (
|
|
70
|
+
<VStack padding={2}>
|
|
71
|
+
<Select
|
|
72
|
+
value={value}
|
|
73
|
+
valueLabel={selectedValueLabel}
|
|
74
|
+
placeholder="Choose something..."
|
|
75
|
+
onChange={setValue}
|
|
76
|
+
>
|
|
77
|
+
{options.map((option) => (
|
|
78
|
+
<SelectOption
|
|
79
|
+
value={option.value}
|
|
80
|
+
key={option.value}
|
|
81
|
+
title={option.label}
|
|
82
|
+
description="Description"
|
|
83
|
+
/>
|
|
84
|
+
))}
|
|
85
|
+
</Select>
|
|
86
|
+
</VStack>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Input Stack Options
|
|
92
|
+
|
|
93
|
+
The `Select` trigger can be customized similar to `TextInput`. These options are also available for mobile implementations.
|
|
94
|
+
|
|
95
|
+
#### Label and Helper Text
|
|
96
|
+
|
|
97
|
+
When space is tight, this brings the label inside of the Input. Should be used with a `compact` `SelectOption`.
|
|
98
|
+
|
|
99
|
+
```jsx live
|
|
100
|
+
function LabelHelperTextSelect() {
|
|
101
|
+
const [value, setValue] = useState('Option 2');
|
|
102
|
+
const options = ['Option 1', 'Option 2', 'Option 3', 'Option 4', 'Option 5', 'Option 6'];
|
|
103
|
+
return (
|
|
104
|
+
<VStack padding={2}>
|
|
105
|
+
<Select
|
|
106
|
+
label="Make a selection"
|
|
107
|
+
helperText="You can only choose one"
|
|
108
|
+
value={value}
|
|
109
|
+
onChange={setValue}
|
|
110
|
+
startNode={<InputIcon name="calendar" />}
|
|
111
|
+
>
|
|
112
|
+
{options.map((option) => (
|
|
113
|
+
<SelectOption value={option} key={option} title={option} description="Description" />
|
|
114
|
+
))}
|
|
115
|
+
</Select>
|
|
116
|
+
</VStack>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Compact
|
|
122
|
+
|
|
123
|
+
When space is tight, this brings the label inside of the Input. Should be used with a `compact` `SelectOption`.
|
|
124
|
+
|
|
125
|
+
```jsx live
|
|
126
|
+
function CompactSelect() {
|
|
127
|
+
const [value, setValue] = useState('Option 2');
|
|
128
|
+
const options = ['Option 1', 'Option 2', 'Option 3', 'Option 4', 'Option 5', 'Option 6'];
|
|
129
|
+
return (
|
|
130
|
+
<VStack padding={2}>
|
|
131
|
+
<Select compact label="Make a selection" value={value} onChange={setValue}>
|
|
132
|
+
{options.map((option) => (
|
|
133
|
+
<SelectOption
|
|
134
|
+
value={option}
|
|
135
|
+
key={option}
|
|
136
|
+
compact
|
|
137
|
+
title={option}
|
|
138
|
+
description="Description"
|
|
139
|
+
/>
|
|
140
|
+
))}
|
|
141
|
+
</Select>
|
|
142
|
+
</VStack>
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Variants
|
|
148
|
+
|
|
149
|
+
Variants can be used to surface positive or negative feedback.
|
|
150
|
+
|
|
151
|
+
```jsx live
|
|
152
|
+
function Variant() {
|
|
153
|
+
const [value, setValue] = useState('Positive');
|
|
154
|
+
const options = ['Positive', 'Negative', 'Primary', 'Secondary', 'Foreground'];
|
|
155
|
+
return (
|
|
156
|
+
<VStack padding={2}>
|
|
157
|
+
<Select
|
|
158
|
+
variant={value.toLowerCase()}
|
|
159
|
+
label="Make a selection"
|
|
160
|
+
helperText="You can only choose one"
|
|
161
|
+
value={value}
|
|
162
|
+
onChange={setValue}
|
|
163
|
+
>
|
|
164
|
+
{options.map((option) => (
|
|
165
|
+
<SelectOption value={option} key={option} title={option} />
|
|
166
|
+
))}
|
|
167
|
+
</Select>
|
|
168
|
+
</VStack>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Label Variants
|
|
174
|
+
|
|
175
|
+
Select supports two label variants: `outside` (default) and `inside`. Note that the `compact` prop, when set to true, will override label variant preference.
|
|
176
|
+
|
|
177
|
+
:::warning
|
|
178
|
+
|
|
179
|
+
When using the `inside` label variant, you should always include a `placeholder` prop.
|
|
180
|
+
|
|
181
|
+
:::
|
|
182
|
+
|
|
183
|
+
```jsx live
|
|
184
|
+
<VStack gap={3}>
|
|
185
|
+
<VStack>
|
|
186
|
+
<Text as="p">
|
|
187
|
+
<strong>Outside label (default):</strong>
|
|
188
|
+
</Text>
|
|
189
|
+
<Select placeholder="Choose an option">
|
|
190
|
+
<SelectOption value="option1" title="Option 1" description="Description" />
|
|
191
|
+
<SelectOption value="option2" title="Option 2" description="Description" />
|
|
192
|
+
<SelectOption value="option3" title="Option 3" description="Description" />
|
|
193
|
+
</Select>
|
|
194
|
+
</VStack>
|
|
195
|
+
|
|
196
|
+
<VStack>
|
|
197
|
+
<Text as="p">
|
|
198
|
+
<strong>Inside label:</strong>
|
|
199
|
+
</Text>
|
|
200
|
+
<Select label="Choose Option" labelVariant="inside" placeholder="Select from list">
|
|
201
|
+
<SelectOption value="option1" title="Option 1" description="Description" />
|
|
202
|
+
<SelectOption value="option2" title="Option 2" description="Description" />
|
|
203
|
+
<SelectOption value="option3" title="Option 3" description="Description" />
|
|
204
|
+
</Select>
|
|
205
|
+
</VStack>
|
|
206
|
+
|
|
207
|
+
<VStack>
|
|
208
|
+
<Text as="p">
|
|
209
|
+
<strong>Inside label (with start content):</strong>
|
|
210
|
+
</Text>
|
|
211
|
+
<Select
|
|
212
|
+
label="Filter Options"
|
|
213
|
+
labelVariant="inside"
|
|
214
|
+
startNode={<InputIcon name="search" />}
|
|
215
|
+
placeholder="Search and select"
|
|
216
|
+
>
|
|
217
|
+
<SelectOption value="option1" title="Option 1" description="Description" />
|
|
218
|
+
<SelectOption value="option2" title="Option 2" description="Description" />
|
|
219
|
+
<SelectOption value="option3" title="Option 3" description="Description" />
|
|
220
|
+
</Select>
|
|
221
|
+
</VStack>
|
|
222
|
+
</VStack>
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
|