@coinbase/cds-mcp-server 8.17.1 → 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 +8 -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,568 @@
|
|
|
1
|
+
# YAxis
|
|
2
|
+
|
|
3
|
+
A vertical axis component for CartesianChart. Displays tick marks, labels, gridlines, and supports custom formatting, positioning, and data domains.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```jsx
|
|
8
|
+
import { YAxis } from '@coinbase/cds-mobile-visualization'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Required | Default | Description |
|
|
14
|
+
| --- | --- | --- | --- | --- |
|
|
15
|
+
| `GridLineComponent` | `LineComponent` | No | `DottedLine` | Component to render the grid lines. |
|
|
16
|
+
| `axisId` | `string` | No | `-` | The ID of the axis to render. Defaults to defaultAxisId if not specified. |
|
|
17
|
+
| `className` | `string` | No | `-` | Custom className for the axis. |
|
|
18
|
+
| `classNames` | `{ root?: string; tickLabel?: string \| undefined; gridLine?: string \| undefined; line?: string \| undefined; tickMark?: string \| undefined; } \| undefined` | No | `-` | Custom classNames for the axis. |
|
|
19
|
+
| `minTickLabelGap` | `number` | No | `4` | Minimum gap between tick labels. Labels will be hidden if they are closer than this gap. |
|
|
20
|
+
| `position` | `left \| right` | No | `'right'` | The position of the axis relative to the charts drawing area. |
|
|
21
|
+
| `requestedTickCount` | `number` | No | `5 (for y-axis)` | Requested number of ticks to display. This value is passed into d3 and may not be respected. |
|
|
22
|
+
| `showGrid` | `boolean` | No | `-` | Whether to show grid lines at each tick position. |
|
|
23
|
+
| `showLine` | `boolean` | No | `-` | Whether to show the axis line. |
|
|
24
|
+
| `showTickMarks` | `boolean` | No | `-` | Whether to show tick marks on the axis. |
|
|
25
|
+
| `style` | `CSSProperties` | No | `-` | Custom style for the axis. |
|
|
26
|
+
| `styles` | `{ root?: CSSProperties; tickLabel?: CSSProperties \| undefined; gridLine?: CSSProperties \| undefined; line?: CSSProperties \| undefined; tickMark?: CSSProperties \| undefined; } \| undefined` | No | `-` | Custom styles for the axis. |
|
|
27
|
+
| `tickInterval` | `number` | No | `32 (for x-axis)` | Interval at which to show ticks. When provided, calculates tick count based on available space. |
|
|
28
|
+
| `tickLabelFormatter` | `((value: any) => ChartTextChildren)` | No | `-` | Formatter function for axis tick values. Tick values will be wrapped in ChartText component. |
|
|
29
|
+
| `tickMarkLabelGap` | `number` | No | `2 for x-axis, 8 for y-axis` | Space between the axis tick mark and labels. If tick marks are not shown, this is the gap between the axis and the chart. |
|
|
30
|
+
| `tickMarkSize` | `number` | No | `4` | Size of the tick marks. |
|
|
31
|
+
| `tickMaxStep` | `number` | No | `-` | Maximum step size for tick generation. Prevents the step from being larger than this value. |
|
|
32
|
+
| `tickMinStep` | `number` | No | `1` | Minimum step size for tick generation. Prevents the step from being smaller than this value. |
|
|
33
|
+
| `ticks` | `number[] \| ((value: number) => boolean)` | No | `-` | Custom tick configuration for the axis. When provided, this overrides the requestedTickCount property. - **Array**: Uses these exact values for tick positioning and labels. - **Function**: Filters based on the predicate function. - For **x-axis**: Checks every data index (0, 1, 2, ..., dataLength-1) - For **y-axis**: Filters d3-generated tick values |
|
|
34
|
+
| `width` | `number` | No | `44` | Width of the axis. This value is inclusive of the padding. |
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
## Examples
|
|
38
|
+
|
|
39
|
+
### Basic Example
|
|
40
|
+
|
|
41
|
+
The YAxis component provides a vertical axis for charts with automatic tick generation and labeling.
|
|
42
|
+
|
|
43
|
+
```jsx
|
|
44
|
+
<CartesianChart
|
|
45
|
+
enableScrubbing
|
|
46
|
+
height={250}
|
|
47
|
+
series={[
|
|
48
|
+
{
|
|
49
|
+
id: 'prices',
|
|
50
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
51
|
+
},
|
|
52
|
+
]}
|
|
53
|
+
>
|
|
54
|
+
<YAxis showGrid />
|
|
55
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
56
|
+
<Scrubber />
|
|
57
|
+
</CartesianChart>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Axis Config
|
|
61
|
+
|
|
62
|
+
Properties related to the scale of an axis are set on the Chart component. This includes `scaleType`, `domain`, `domainLimit`, `range`, `data`, and `categoryPadding`.
|
|
63
|
+
|
|
64
|
+
#### Scale Type
|
|
65
|
+
|
|
66
|
+
YAxis supports `linear` (default) and `log` scale types. Both `linear` and `log` are numeric scales.
|
|
67
|
+
|
|
68
|
+
```jsx
|
|
69
|
+
function ScaleTypeExample() {
|
|
70
|
+
const theme = useTheme();
|
|
71
|
+
return (
|
|
72
|
+
<CartesianChart
|
|
73
|
+
height={400}
|
|
74
|
+
series={[
|
|
75
|
+
{
|
|
76
|
+
id: 'growthExponential',
|
|
77
|
+
data: [
|
|
78
|
+
1, 2, 4, 8, 15, 30, 65, 140, 280, 580, 1200, 2400, 4800, 9500, 19000, 38000, 75000,
|
|
79
|
+
150000,
|
|
80
|
+
],
|
|
81
|
+
color: theme.color.fgPositive,
|
|
82
|
+
},
|
|
83
|
+
]}
|
|
84
|
+
yAxis={{
|
|
85
|
+
scaleType: 'log',
|
|
86
|
+
}}
|
|
87
|
+
>
|
|
88
|
+
<Line seriesId="growthExponential" />
|
|
89
|
+
<YAxis
|
|
90
|
+
showGrid
|
|
91
|
+
showLine
|
|
92
|
+
showTickMarks
|
|
93
|
+
requestedTickCount={6}
|
|
94
|
+
width={70}
|
|
95
|
+
tickLabelFormatter={(value) => value.toLocaleString()}
|
|
96
|
+
/>
|
|
97
|
+
</CartesianChart>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
#### Domain
|
|
103
|
+
|
|
104
|
+
An axis's domain is the range of values that the axis will display.
|
|
105
|
+
You can pass in either an object (AxisBounds) with `min` and `max` properties (both optional), or a function that receives initial `AxisBounds` and returns an adjusted `AxisBounds`.
|
|
106
|
+
|
|
107
|
+
```jsx
|
|
108
|
+
<CartesianChart
|
|
109
|
+
height={250}
|
|
110
|
+
series={[
|
|
111
|
+
{
|
|
112
|
+
id: 'prices',
|
|
113
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
114
|
+
},
|
|
115
|
+
]}
|
|
116
|
+
yAxis={{
|
|
117
|
+
domain: ({ min, max }) => ({ min: min - 50, max: max + 50 }),
|
|
118
|
+
}}
|
|
119
|
+
>
|
|
120
|
+
<YAxis showGrid />
|
|
121
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
122
|
+
</CartesianChart>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
##### Domain Limit
|
|
126
|
+
|
|
127
|
+
You can set the domain limit to `nice` (default for YAxis) or `strict`. `nice` will round the domain to human-friendly values, while `strict` will use the exact min/max values from the data. See [d3-scale](https://d3js.org/d3-scale/linear#linear_nice) for more details.
|
|
128
|
+
|
|
129
|
+
#### Range
|
|
130
|
+
|
|
131
|
+
An axis's range is the range of values that the axis will display in pixels. This is most useful for adjusting the sizing of the data inside of the chart's drawing area.
|
|
132
|
+
|
|
133
|
+
You can pass in either an object (AxisBounds) with `min` and `max` properties (both optional), or a function that receives initial `AxisBounds` and returns an adjusted `AxisBounds`.
|
|
134
|
+
|
|
135
|
+
```jsx
|
|
136
|
+
<CartesianChart
|
|
137
|
+
height={250}
|
|
138
|
+
series={[
|
|
139
|
+
{
|
|
140
|
+
id: 'prices',
|
|
141
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
142
|
+
},
|
|
143
|
+
]}
|
|
144
|
+
yAxis={{
|
|
145
|
+
range: ({ min, max }) => ({ min: min + 96, max: max - 96 }),
|
|
146
|
+
}}
|
|
147
|
+
>
|
|
148
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
149
|
+
</CartesianChart>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Axis Props
|
|
153
|
+
|
|
154
|
+
Properties related to the visual appearance of the YAxis are set on the component itself. This includes `position`, `showGrid`, `showLine`, `showTickMarks`, `size`, `tickInterval`, `ticks`, `tickLabelFormatter`, and `tickMarkSize`.
|
|
155
|
+
|
|
156
|
+
#### Position
|
|
157
|
+
|
|
158
|
+
You can set the position of an axis to `left` or `right` (default).
|
|
159
|
+
|
|
160
|
+
```jsx
|
|
161
|
+
<CartesianChart
|
|
162
|
+
enableScrubbing
|
|
163
|
+
height={512}
|
|
164
|
+
series={[
|
|
165
|
+
{
|
|
166
|
+
id: 'linear',
|
|
167
|
+
yAxisId: 'linearAxis',
|
|
168
|
+
data: [1, 10, 30, 50, 70, 90, 100],
|
|
169
|
+
label: 'linear',
|
|
170
|
+
},
|
|
171
|
+
{ id: 'log', yAxisId: 'logAxis', data: [1, 10, 30, 50, 70, 90, 100], label: 'log' },
|
|
172
|
+
]}
|
|
173
|
+
xAxis={[{ data: [1, 10, 30, 50, 70, 90, 100] }]}
|
|
174
|
+
yAxis={[
|
|
175
|
+
{ id: 'linearAxis', scaleType: 'linear' },
|
|
176
|
+
{ id: 'logAxis', scaleType: 'log' },
|
|
177
|
+
]}
|
|
178
|
+
>
|
|
179
|
+
<YAxis showLine showTickMarks axisId="logAxis" position="left" />
|
|
180
|
+
<YAxis showLine showTickMarks axisId="linearAxis" />
|
|
181
|
+
<Line curve="natural" seriesId="linear" />
|
|
182
|
+
<Line curve="natural" seriesId="log" />
|
|
183
|
+
<Scrubber />
|
|
184
|
+
</CartesianChart>
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
#### Grid
|
|
188
|
+
|
|
189
|
+
You can show grid lines at each tick position using the `showGrid` prop.
|
|
190
|
+
|
|
191
|
+
```jsx
|
|
192
|
+
function YAxisGridExample() {
|
|
193
|
+
const [showGrid, setShowGrid] = useState(true);
|
|
194
|
+
return (
|
|
195
|
+
<VStack gap={2}>
|
|
196
|
+
<HStack gap={2} style={{ flexWrap: 'wrap' }}>
|
|
197
|
+
<Switch checked={showGrid} onChange={() => setShowGrid(!showGrid)}>
|
|
198
|
+
Show Grid
|
|
199
|
+
</Switch>
|
|
200
|
+
</HStack>
|
|
201
|
+
<CartesianChart
|
|
202
|
+
enableScrubbing
|
|
203
|
+
height={250}
|
|
204
|
+
series={[
|
|
205
|
+
{
|
|
206
|
+
id: 'prices',
|
|
207
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
208
|
+
},
|
|
209
|
+
]}
|
|
210
|
+
>
|
|
211
|
+
<YAxis showGrid={showGrid} />
|
|
212
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
213
|
+
<Scrubber />
|
|
214
|
+
</CartesianChart>
|
|
215
|
+
</VStack>
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
You can also customize the grid lines using the `GridLineComponent` prop.
|
|
221
|
+
|
|
222
|
+
```jsx
|
|
223
|
+
function CustomGridLineExample() {
|
|
224
|
+
const theme = useTheme();
|
|
225
|
+
const ThinSolidLine = memo((props: SolidLineProps) => <SolidLine {...props} strokeWidth={1} />);
|
|
226
|
+
|
|
227
|
+
const categories = Array.from({ length: 31 }, (_, i) => `3/${i + 1}`);
|
|
228
|
+
const gains = [
|
|
229
|
+
5, 0, 6, 18, 0, 5, 12, 0, 12, 22, 28, 18, 0, 12, 6, 0, 0, 24, 0, 0, 4, 0, 18, 0, 0, 14, 10, 16,
|
|
230
|
+
0, 0, 0,
|
|
231
|
+
];
|
|
232
|
+
const losses = [
|
|
233
|
+
-4, 0, -8, -12, -6, 0, 0, 0, -18, 0, -12, 0, -9, -6, 0, 0, 0, 0, -22, -8, 0, 0, -10, -14, 0, 0,
|
|
234
|
+
0, 0, 0, -12, -10,
|
|
235
|
+
];
|
|
236
|
+
const series = [
|
|
237
|
+
{ id: 'gains', data: gains, color: theme.color.fgPositive, stackId: 'bars' },
|
|
238
|
+
{ id: 'losses', data: losses, color: theme.color.fgNegative, stackId: 'bars' },
|
|
239
|
+
];
|
|
240
|
+
|
|
241
|
+
return (
|
|
242
|
+
<CartesianChart
|
|
243
|
+
height={420}
|
|
244
|
+
padding={4}
|
|
245
|
+
series={series}
|
|
246
|
+
xAxis={{ data: categories, scaleType: 'band' }}
|
|
247
|
+
>
|
|
248
|
+
<XAxis />
|
|
249
|
+
<YAxis
|
|
250
|
+
showGrid
|
|
251
|
+
GridLineComponent={ThinSolidLine}
|
|
252
|
+
tickLabelFormatter={(value) => `$${value}M`}
|
|
253
|
+
/>
|
|
254
|
+
<BarPlot />
|
|
255
|
+
<ReferenceLine LineComponent={SolidLine} dataY={0} />
|
|
256
|
+
</CartesianChart>
|
|
257
|
+
);
|
|
258
|
+
};
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
#### Line
|
|
262
|
+
|
|
263
|
+
You can show the axis line using the `showLine` prop.
|
|
264
|
+
|
|
265
|
+
```jsx
|
|
266
|
+
function YAxisLineExample() {
|
|
267
|
+
const [showLine, setShowLine] = useState(true);
|
|
268
|
+
return (
|
|
269
|
+
<VStack gap={2}>
|
|
270
|
+
<HStack gap={2} style={{ flexWrap: 'wrap' }}>
|
|
271
|
+
<Switch checked={showLine} onChange={() => setShowLine(!showLine)}>
|
|
272
|
+
Show Line
|
|
273
|
+
</Switch>
|
|
274
|
+
</HStack>
|
|
275
|
+
<CartesianChart
|
|
276
|
+
enableScrubbing
|
|
277
|
+
height={250}
|
|
278
|
+
series={[
|
|
279
|
+
{
|
|
280
|
+
id: 'prices',
|
|
281
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
282
|
+
},
|
|
283
|
+
]}
|
|
284
|
+
>
|
|
285
|
+
<YAxis showLine={showLine} />
|
|
286
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
287
|
+
<Scrubber />
|
|
288
|
+
</CartesianChart>
|
|
289
|
+
</VStack>
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
You can also customize the axis line using the `classNames` and `styles` props.
|
|
295
|
+
|
|
296
|
+
```jsx
|
|
297
|
+
function YAxisLineStylesExample() {
|
|
298
|
+
const theme = useTheme();
|
|
299
|
+
const [showLine, setShowLine] = useState(true);
|
|
300
|
+
return (
|
|
301
|
+
<VStack gap={2}>
|
|
302
|
+
<HStack gap={2} style={{ flexWrap: 'wrap' }}>
|
|
303
|
+
<Switch checked={showLine} onChange={() => setShowLine(!showLine)}>
|
|
304
|
+
Show Line
|
|
305
|
+
</Switch>
|
|
306
|
+
</HStack>
|
|
307
|
+
<CartesianChart
|
|
308
|
+
enableScrubbing
|
|
309
|
+
height={250}
|
|
310
|
+
series={[
|
|
311
|
+
{
|
|
312
|
+
id: 'prices',
|
|
313
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
314
|
+
},
|
|
315
|
+
]}
|
|
316
|
+
>
|
|
317
|
+
<YAxis
|
|
318
|
+
showLine={showLine}
|
|
319
|
+
showGrid
|
|
320
|
+
styles={{ line: { stroke: theme.color.accentBoldGreen, strokeWidth: 4 } }}
|
|
321
|
+
/>
|
|
322
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
323
|
+
<Scrubber />
|
|
324
|
+
</CartesianChart>
|
|
325
|
+
</VStack>
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
#### Size
|
|
331
|
+
|
|
332
|
+
The `size` prop sets the size of the axis in pixels. The default is 44 for YAxis, but can be adjusted to fit the size of your data.
|
|
333
|
+
|
|
334
|
+
```jsx
|
|
335
|
+
function YAxisSizeExample() {
|
|
336
|
+
const theme = useTheme();
|
|
337
|
+
return (
|
|
338
|
+
<CartesianChart
|
|
339
|
+
height={400}
|
|
340
|
+
series={[
|
|
341
|
+
{
|
|
342
|
+
id: 'growthExponential',
|
|
343
|
+
data: [
|
|
344
|
+
1, 2, 4, 8, 15, 30, 65, 140, 280, 580, 1200, 2400, 4800, 9500, 19000, 38000, 75000,
|
|
345
|
+
150000,
|
|
346
|
+
],
|
|
347
|
+
color: theme.color.fgPositive,
|
|
348
|
+
},
|
|
349
|
+
]}
|
|
350
|
+
>
|
|
351
|
+
<Line curve="natural" showArea seriesId="growthExponential" />
|
|
352
|
+
<YAxis
|
|
353
|
+
showGrid
|
|
354
|
+
showLine
|
|
355
|
+
showTickMarks
|
|
356
|
+
requestedTickCount={6}
|
|
357
|
+
width={70}
|
|
358
|
+
tickLabelFormatter={(value) => value.toLocaleString()}
|
|
359
|
+
/>
|
|
360
|
+
</CartesianChart>
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
#### Ticks
|
|
366
|
+
|
|
367
|
+
You can use the `ticks`, `requestedTickCount` (default for YAxis), and `tickInterval` props to control the number and placement of ticks on the YAxis.
|
|
368
|
+
|
|
369
|
+
`ticks` accepts an array of numbers, which corresponds to the values of that axis that you would like to display ticks for.
|
|
370
|
+
|
|
371
|
+
```jsx
|
|
372
|
+
<CartesianChart
|
|
373
|
+
enableScrubbing
|
|
374
|
+
height={250}
|
|
375
|
+
series={[
|
|
376
|
+
{
|
|
377
|
+
id: 'prices',
|
|
378
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
379
|
+
},
|
|
380
|
+
]}
|
|
381
|
+
>
|
|
382
|
+
<YAxis showLine showTickMarks showGrid ticks={[34, 56, 80]} />
|
|
383
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
384
|
+
<Scrubber />
|
|
385
|
+
</CartesianChart>
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
Using `requestedTickCount` will use [D3's ticks function](https://d3js.org/d3-array/ticks#ticks) to determine the number and placement of ticks. Note that this count is not guaranteed to be respected.
|
|
389
|
+
|
|
390
|
+
This is the default behavior for YAxis, and defaults to `5`.
|
|
391
|
+
|
|
392
|
+
```jsx
|
|
393
|
+
<CartesianChart
|
|
394
|
+
enableScrubbing
|
|
395
|
+
height={250}
|
|
396
|
+
series={[
|
|
397
|
+
{
|
|
398
|
+
id: 'prices',
|
|
399
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
400
|
+
},
|
|
401
|
+
]}
|
|
402
|
+
>
|
|
403
|
+
<YAxis showLine showTickMarks showGrid requestedTickCount={5} />
|
|
404
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
405
|
+
<Scrubber />
|
|
406
|
+
</CartesianChart>
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
`tickInterval`, which accepts a number for the gap between ticks in pixels, will measure the available space and try to create evenly spaced ticks. It will always include the first and last values of the domain.
|
|
410
|
+
|
|
411
|
+
```jsx
|
|
412
|
+
<CartesianChart
|
|
413
|
+
enableScrubbing
|
|
414
|
+
height={250}
|
|
415
|
+
series={[
|
|
416
|
+
{
|
|
417
|
+
id: 'prices',
|
|
418
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
419
|
+
},
|
|
420
|
+
]}
|
|
421
|
+
>
|
|
422
|
+
<YAxis showLine showTickMarks showGrid tickInterval={8} />
|
|
423
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
424
|
+
<Scrubber />
|
|
425
|
+
</CartesianChart>
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
#### Tick Marks
|
|
429
|
+
|
|
430
|
+
You can show tick marks on the axis using the `showTickMarks` prop.
|
|
431
|
+
You can also customize the tick mark size using the `tickMarkSize` prop.
|
|
432
|
+
|
|
433
|
+
```jsx
|
|
434
|
+
function YAxisTickMarksExample() {
|
|
435
|
+
const [showTickMarks, setShowTickMarks] = useState(true);
|
|
436
|
+
return (
|
|
437
|
+
<VStack gap={2}>
|
|
438
|
+
<HStack gap={2} style={{ flexWrap: 'wrap' }}>
|
|
439
|
+
<Switch checked={showTickMarks} onChange={() => setShowTickMarks(!showTickMarks)}>
|
|
440
|
+
Show Tick Marks
|
|
441
|
+
</Switch>
|
|
442
|
+
</HStack>
|
|
443
|
+
<CartesianChart
|
|
444
|
+
enableScrubbing
|
|
445
|
+
height={250}
|
|
446
|
+
series={[
|
|
447
|
+
{
|
|
448
|
+
id: 'prices',
|
|
449
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
450
|
+
},
|
|
451
|
+
]}
|
|
452
|
+
>
|
|
453
|
+
<YAxis showLine showTickMarks={showTickMarks} tickMarkSize={16} showGrid />
|
|
454
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
455
|
+
<Scrubber />
|
|
456
|
+
</CartesianChart>
|
|
457
|
+
</VStack>
|
|
458
|
+
);
|
|
459
|
+
}
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
#### Tick Labels
|
|
463
|
+
|
|
464
|
+
You can customize the tick labels using the `tickLabelFormatter` prop.
|
|
465
|
+
|
|
466
|
+
```jsx
|
|
467
|
+
<CartesianChart
|
|
468
|
+
enableScrubbing
|
|
469
|
+
height={250}
|
|
470
|
+
series={[
|
|
471
|
+
{
|
|
472
|
+
id: 'prices',
|
|
473
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
474
|
+
},
|
|
475
|
+
]}
|
|
476
|
+
>
|
|
477
|
+
<YAxis showGrid tickLabelFormatter={(value) => `$${value}`} />
|
|
478
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
479
|
+
<Scrubber />
|
|
480
|
+
</CartesianChart>
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
### Customization
|
|
484
|
+
|
|
485
|
+
#### Multiple Y Axes
|
|
486
|
+
|
|
487
|
+
```jsx
|
|
488
|
+
function MultipleYAxesExample() {
|
|
489
|
+
const theme = useTheme();
|
|
490
|
+
return (
|
|
491
|
+
<VStack gap={2}>
|
|
492
|
+
<CartesianChart
|
|
493
|
+
height={400}
|
|
494
|
+
series={[
|
|
495
|
+
{
|
|
496
|
+
id: 'revenue',
|
|
497
|
+
data: [455, 520, 380, 455, 285, 235],
|
|
498
|
+
yAxisId: 'revenue',
|
|
499
|
+
color: theme.color.accentBoldYellow,
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
id: 'profitMargin',
|
|
503
|
+
data: [23, 20, 16, 38, 12, 9],
|
|
504
|
+
yAxisId: 'profitMargin',
|
|
505
|
+
color: theme.color.fgPositive,
|
|
506
|
+
},
|
|
507
|
+
]}
|
|
508
|
+
xAxis={{
|
|
509
|
+
data: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
|
|
510
|
+
scaleType: 'band',
|
|
511
|
+
}}
|
|
512
|
+
yAxis={[
|
|
513
|
+
{
|
|
514
|
+
id: 'revenue',
|
|
515
|
+
domain: { min: 0 },
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
id: 'profitMargin',
|
|
519
|
+
domain: { min: 0, max: 100 },
|
|
520
|
+
},
|
|
521
|
+
]}
|
|
522
|
+
>
|
|
523
|
+
<XAxis showLine showTickMarks />
|
|
524
|
+
<YAxis
|
|
525
|
+
showGrid
|
|
526
|
+
showLine
|
|
527
|
+
showTickMarks
|
|
528
|
+
axisId="revenue"
|
|
529
|
+
position="left"
|
|
530
|
+
requestedTickCount={5}
|
|
531
|
+
width={60}
|
|
532
|
+
tickLabelFormatter={(value) => `$${value}k`}
|
|
533
|
+
/>
|
|
534
|
+
<YAxis
|
|
535
|
+
showLine
|
|
536
|
+
showTickMarks
|
|
537
|
+
axisId="profitMargin"
|
|
538
|
+
requestedTickCount={5}
|
|
539
|
+
tickLabelFormatter={(value) => `${value}%`}
|
|
540
|
+
/>
|
|
541
|
+
<BarPlot />
|
|
542
|
+
</CartesianChart>
|
|
543
|
+
<HStack justifyContent="center" gap={2}>
|
|
544
|
+
<Box alignItems="center" gap={0.5}>
|
|
545
|
+
<Box
|
|
546
|
+
borderRadius={1000}
|
|
547
|
+
width={10}
|
|
548
|
+
height={10}
|
|
549
|
+
style={{ background: theme.color.accentBoldYellow }}
|
|
550
|
+
/>
|
|
551
|
+
<Text font="label2">Revenue ($)</Text>
|
|
552
|
+
</Box>
|
|
553
|
+
<Box alignItems="center" gap={0.5}>
|
|
554
|
+
<Box
|
|
555
|
+
borderRadius={1000}
|
|
556
|
+
width={10}
|
|
557
|
+
height={10}
|
|
558
|
+
style={{ background: theme.color.fgPositive }}
|
|
559
|
+
/>
|
|
560
|
+
<Text font="label2">Profit Margin (%)</Text>
|
|
561
|
+
</Box>
|
|
562
|
+
</HStack>
|
|
563
|
+
</VStack>
|
|
564
|
+
);
|
|
565
|
+
}
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: introduction
|
|
3
|
+
title: Introduction
|
|
4
|
+
hide_title: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
import { MDXSection } from '@site/src/components/page/MDXSection';
|
|
8
|
+
import { MDXArticle } from '@site/src/components/page/MDXArticle';
|
|
9
|
+
import { ContentHeader } from '@site/src/components/page/ContentHeader';
|
|
10
|
+
import { GettingStartedBanner } from '@site/src/components/page/ComponentBanner/GettingStartedBanner';
|
|
11
|
+
|
|
12
|
+
<ContentHeader
|
|
13
|
+
title="Introduction"
|
|
14
|
+
description="Coinbase Design System is a cross-platform component library for React and React Native. CDS has high adoption in every product at Coinbase, accelerating development and ensuring a consistent user experience across all platforms."
|
|
15
|
+
banner={<GettingStartedBanner />}
|
|
16
|
+
/>
|
|
17
|
+
|
|
18
|
+
<MDXSection>
|
|
19
|
+
<MDXArticle>
|
|
20
|
+
## Key features
|
|
21
|
+
|
|
22
|
+
- **Cross-platform** - CDS provides components for both React DOM and React Native. We go to great lengths to ensure that the source code is as identical as possible across React and React Native without compromising on platform-specific features.
|
|
23
|
+
|
|
24
|
+
- **Powerful theming** - The ThemeProvider can be used to define a custom theme for your application supporting light and dark mode.
|
|
25
|
+
|
|
26
|
+
- **Rich styling capabilities** - Components are designed to integrate with third-party libraries like styled-components, and to be customizable via theming, props, StyleProps, classnames, and inline styles.
|
|
27
|
+
|
|
28
|
+
- **Subcomponent composition** - Components are built using smaller subcomponents that can be fully customized or replaced via props.
|
|
29
|
+
|
|
30
|
+
- **Accessibility** - Components are accessible out of the box, and can be customized to different accessibility standards.
|
|
31
|
+
|
|
32
|
+
</MDXArticle>
|
|
33
|
+
</MDXSection>
|
|
34
|
+
|
|
35
|
+
<MDXSection>
|
|
36
|
+
<MDXArticle>
|
|
37
|
+
## Web-only features
|
|
38
|
+
|
|
39
|
+
- **Atomic static CSS** - CSS is compiled to atomic static classnames at library build time.
|
|
40
|
+
|
|
41
|
+
- **Responsive styles** - Components support responsive styles out of the box. Use the responsive syntax to adjust layouts and styles based on device breakpoints without writing custom media queries.
|
|
42
|
+
|
|
43
|
+
- **CSS layers** - All CSS is added to the `cds` layer. This allows you to easily override CDS styles with your own styles.
|
|
44
|
+
|
|
45
|
+
- **Polymorphic components** - Components can be rendered as different HTML elements or as other components.
|
|
46
|
+
|
|
47
|
+
</MDXArticle>
|
|
48
|
+
</MDXSection>
|
|
49
|
+
|
|
50
|
+
<MDXSection>
|
|
51
|
+
<MDXArticle>
|
|
52
|
+
## Developer experience
|
|
53
|
+
|
|
54
|
+
CDS is designed to make your development workflow as smooth as possible.
|
|
55
|
+
|
|
56
|
+
- **TypeScript first** - Full type safety with excellent IDE autocomplete for props, theme values, and style props. Most mistakes are caught at compile time.
|
|
57
|
+
|
|
58
|
+
- **Flexible styling** - Use the StyleProps API for rapid development with theme-aware values, or drop down to className and style props for full control. Mix and match approaches as needed.
|
|
59
|
+
|
|
60
|
+
- **Component composition** - Build complex UIs by composing simple primitives. Most components expose subcomponents that can be customized or replaced entirely.
|
|
61
|
+
|
|
62
|
+
- **Performance optimized** - All web components use atomic CSS with zero runtime overhead. CSS is generated at build time and styles are applied via static classnames.
|
|
63
|
+
|
|
64
|
+
- **Extensive documentation** - Every component includes Storybook stories, interactive examples, detailed prop tables, and usage guidelines.
|
|
65
|
+
|
|
66
|
+
```jsx
|
|
67
|
+
import { ThemeProvider } from '@coinbase/cds-web';
|
|
68
|
+
import { defaultTheme } from '@coinbase/cds-web/themes/defaultTheme';
|
|
69
|
+
import { Box } from '@coinbase/cds-web/layout';
|
|
70
|
+
import { Text } from '@coinbase/cds-web/typography';
|
|
71
|
+
import { Button } from '@coinbase/cds-web/buttons';
|
|
72
|
+
|
|
73
|
+
const App = () => (
|
|
74
|
+
<ThemeProvider theme={defaultTheme} activeColorScheme="light">
|
|
75
|
+
<Box padding={4} background="bgPrimary" borderRadius={200}>
|
|
76
|
+
<Text font="title1" color="fg">
|
|
77
|
+
Welcome to CDS
|
|
78
|
+
</Text>
|
|
79
|
+
<Button variant="positive" marginTop={2}>
|
|
80
|
+
Get started
|
|
81
|
+
</Button>
|
|
82
|
+
</Box>
|
|
83
|
+
</ThemeProvider>
|
|
84
|
+
);
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
</MDXArticle>
|
|
88
|
+
</MDXSection>
|
|
89
|
+
|
|
90
|
+
<MDXSection>
|
|
91
|
+
<MDXArticle>
|
|
92
|
+
## Next steps
|
|
93
|
+
|
|
94
|
+
Learn how to install and use CDS.
|
|
95
|
+
|
|
96
|
+
[See the installation docs here →](/getting-started/installation)
|
|
97
|
+
|
|
98
|
+
</MDXArticle>
|
|
99
|
+
</MDXSection>
|