@dodopayments/ui 1.4.0 → 1.6.0
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/ai/component-registry.json +1258 -257
- package/ai/component-registry.md +5 -1
- package/ai/components/area-chart.md +4 -4
- package/ai/components/avatar.md +1 -1
- package/ai/components/badge.md +24 -0
- package/ai/components/bar-chart.md +18 -18
- package/ai/components/brand-logos.md +1 -1
- package/ai/components/button.md +24 -1
- package/ai/components/chart-tooltip.md +3 -3
- package/ai/components/chart.md +6 -6
- package/ai/components/checkout-page.md +1 -1
- package/ai/components/collapsible.md +1 -1
- package/ai/components/color-input.md +1 -1
- package/ai/components/composed-chart.md +7 -7
- package/ai/components/copyable-id.md +1 -0
- package/ai/components/country-select.md +1 -0
- package/ai/components/currency-select.md +1 -0
- package/ai/components/data-grid.md +92 -2
- package/ai/components/date-picker.md +1 -1
- package/ai/components/dialog.md +4 -2
- package/ai/components/drawer.md +292 -0
- package/ai/components/featured-icon.md +1 -0
- package/ai/components/field.md +1 -1
- package/ai/components/file-upload.md +1 -1
- package/ai/components/filter-grid.md +4 -7
- package/ai/components/funnel-chart.md +14 -12
- package/ai/components/gauge-chart.md +9 -11
- package/ai/components/icon-morph.md +1 -1
- package/ai/components/image-crop.md +89 -0
- package/ai/components/input-group.md +1 -1
- package/ai/components/input.md +43 -2
- package/ai/components/invoice-document.md +182 -0
- package/ai/components/line-chart.md +2 -2
- package/ai/components/load-more.md +1 -1
- package/ai/components/logo.md +1 -1
- package/ai/components/menu.md +10 -9
- package/ai/components/milestone.md +1 -1
- package/ai/components/money.md +3 -3
- package/ai/components/new-items-pill.md +1 -1
- package/ai/components/payment-logos.md +1 -1
- package/ai/components/pie-chart.md +11 -2
- package/ai/components/popover.md +2 -1
- package/ai/components/reorder-list.md +46 -1
- package/ai/components/ring-chart.md +17 -8
- package/ai/components/sale-share-card.md +48 -0
- package/ai/components/sankey-chart.md +23 -23
- package/ai/components/scaled-frame.md +1 -1
- package/ai/components/select.md +29 -2
- package/ai/components/setup-guide.md +1 -1
- package/ai/components/sidebar.md +2 -2
- package/ai/components/stat-card.md +32 -5
- package/ai/components/sunburst-chart.md +7 -4
- package/ai/components/tabs.md +39 -0
- package/ai/components/test-mode-banner.md +6 -3
- package/ai/components/timestamp.md +11 -2
- package/ai/components/timezone-select.md +1 -0
- package/ai/skills/dodo-charts/SKILL.md +12 -7
- package/ai/skills/dodo-design/SKILL.md +17 -7
- package/dist/components/avatar/avatar.d.ts +9 -7
- package/dist/components/avatar/avatar.d.ts.map +1 -1
- package/dist/components/avatar/avatar.js +9 -7
- package/dist/components/avatar/avatar.js.map +1 -1
- package/dist/components/badge/badge.d.ts +12 -0
- package/dist/components/badge/badge.d.ts.map +1 -1
- package/dist/components/badge/badge.js +23 -4
- package/dist/components/badge/badge.js.map +1 -1
- package/dist/components/brand-logos/brand-artwork.d.ts +30 -1
- package/dist/components/brand-logos/brand-artwork.d.ts.map +1 -1
- package/dist/components/brand-logos/brand-artwork.js +30 -1
- package/dist/components/brand-logos/brand-artwork.js.map +1 -1
- package/dist/components/brand-logos/brand-logos.d.ts +2 -2
- package/dist/components/brand-logos/brand-logos.d.ts.map +1 -1
- package/dist/components/brand-logos/brand-logos.js +11 -1
- package/dist/components/brand-logos/brand-logos.js.map +1 -1
- package/dist/components/button/button.d.ts +12 -0
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/button.js +8 -0
- package/dist/components/button/button.js.map +1 -1
- package/dist/components/card/card-notice.d.ts.map +1 -1
- package/dist/components/card/card-notice.js +1 -1
- package/dist/components/card/card-notice.js.map +1 -1
- package/dist/components/code-block/code-block.d.ts.map +1 -1
- package/dist/components/code-block/code-block.js +3 -1
- package/dist/components/code-block/code-block.js.map +1 -1
- package/dist/components/comparison-bars/comparison-bars.js +2 -2
- package/dist/components/comparison-bars/comparison-bars.js.map +1 -1
- package/dist/components/copyable-id/copyable-id.d.ts +7 -1
- package/dist/components/copyable-id/copyable-id.d.ts.map +1 -1
- package/dist/components/copyable-id/copyable-id.js +21 -3
- package/dist/components/copyable-id/copyable-id.js.map +1 -1
- package/dist/components/country-select/country-select.d.ts +6 -1
- package/dist/components/country-select/country-select.d.ts.map +1 -1
- package/dist/components/country-select/country-select.js +2 -2
- package/dist/components/country-select/country-select.js.map +1 -1
- package/dist/components/currency-select/currency-select.d.ts +6 -1
- package/dist/components/currency-select/currency-select.d.ts.map +1 -1
- package/dist/components/currency-select/currency-select.js +2 -2
- package/dist/components/currency-select/currency-select.js.map +1 -1
- package/dist/components/data-grid/bulk-actions.js +2 -2
- package/dist/components/data-grid/bulk-actions.js.map +1 -1
- package/dist/components/data-grid/data-grid.d.ts +17 -2
- package/dist/components/data-grid/data-grid.d.ts.map +1 -1
- package/dist/components/data-grid/data-grid.js +111 -9
- package/dist/components/data-grid/data-grid.js.map +1 -1
- package/dist/components/data-grid/table.d.ts.map +1 -1
- package/dist/components/data-grid/table.js +5 -0
- package/dist/components/data-grid/table.js.map +1 -1
- package/dist/components/date-picker/date-picker.js +2 -2
- package/dist/components/date-picker/date-picker.js.map +1 -1
- package/dist/components/dialog/dialog.d.ts +12 -4
- package/dist/components/dialog/dialog.d.ts.map +1 -1
- package/dist/components/dialog/dialog.js +46 -7
- package/dist/components/dialog/dialog.js.map +1 -1
- package/dist/components/drawer/drawer.d.ts +73 -0
- package/dist/components/drawer/drawer.d.ts.map +1 -0
- package/dist/components/drawer/drawer.js +56 -0
- package/dist/components/drawer/drawer.js.map +1 -0
- package/dist/components/drawer/index.d.ts +2 -0
- package/dist/components/drawer/index.d.ts.map +1 -0
- package/dist/components/drawer/index.js +2 -0
- package/dist/components/drawer/index.js.map +1 -0
- package/dist/components/featured-icon/featured-icon.d.ts +103 -1
- package/dist/components/featured-icon/featured-icon.d.ts.map +1 -1
- package/dist/components/featured-icon/featured-icon.js +61 -3
- package/dist/components/featured-icon/featured-icon.js.map +1 -1
- package/dist/components/featured-icon/index.d.ts +1 -1
- package/dist/components/featured-icon/index.d.ts.map +1 -1
- package/dist/components/featured-icon/index.js +1 -1
- package/dist/components/featured-icon/index.js.map +1 -1
- package/dist/components/featured-icon/sphere.d.ts +7 -0
- package/dist/components/featured-icon/sphere.d.ts.map +1 -0
- package/dist/components/featured-icon/sphere.js +29 -0
- package/dist/components/featured-icon/sphere.js.map +1 -0
- package/dist/components/file-upload/file-upload.js +1 -1
- package/dist/components/file-upload/file-upload.js.map +1 -1
- package/dist/components/filter-grid/filter-grid.d.ts +7 -2
- package/dist/components/filter-grid/filter-grid.d.ts.map +1 -1
- package/dist/components/filter-grid/filter-grid.js +3 -2
- package/dist/components/filter-grid/filter-grid.js.map +1 -1
- package/dist/components/funnel-chart/funnel-chart.d.ts +3 -2
- package/dist/components/funnel-chart/funnel-chart.d.ts.map +1 -1
- package/dist/components/funnel-chart/funnel-chart.js +3 -2
- package/dist/components/funnel-chart/funnel-chart.js.map +1 -1
- package/dist/components/gauge-chart/gauge-chart.d.ts +3 -4
- package/dist/components/gauge-chart/gauge-chart.d.ts.map +1 -1
- package/dist/components/gauge-chart/gauge-chart.js +3 -4
- package/dist/components/gauge-chart/gauge-chart.js.map +1 -1
- package/dist/components/image-crop/crop-math.d.ts +28 -0
- package/dist/components/image-crop/crop-math.d.ts.map +1 -0
- package/dist/components/image-crop/crop-math.js +53 -0
- package/dist/components/image-crop/crop-math.js.map +1 -0
- package/dist/components/image-crop/image-crop.d.ts +31 -0
- package/dist/components/image-crop/image-crop.d.ts.map +1 -0
- package/dist/components/image-crop/image-crop.js +165 -0
- package/dist/components/image-crop/image-crop.js.map +1 -0
- package/dist/components/image-crop/index.d.ts +2 -0
- package/dist/components/image-crop/index.d.ts.map +1 -0
- package/dist/components/image-crop/index.js +2 -0
- package/dist/components/image-crop/index.js.map +1 -0
- package/dist/components/input/input.d.ts +8 -2
- package/dist/components/input/input.d.ts.map +1 -1
- package/dist/components/input/input.js +12 -3
- package/dist/components/input/input.js.map +1 -1
- package/dist/components/input-group/input-group.d.ts +1 -1
- package/dist/components/input-group/input-group.js +1 -1
- package/dist/components/input-group/input-group.js.map +1 -1
- package/dist/components/invoice-document/index.d.ts +2 -0
- package/dist/components/invoice-document/index.d.ts.map +1 -0
- package/dist/components/invoice-document/index.js +2 -0
- package/dist/components/invoice-document/index.js.map +1 -0
- package/dist/components/invoice-document/invoice-document.d.ts +180 -0
- package/dist/components/invoice-document/invoice-document.d.ts.map +1 -0
- package/dist/components/invoice-document/invoice-document.js +58 -0
- package/dist/components/invoice-document/invoice-document.js.map +1 -0
- package/dist/components/list-item/list-item.d.ts +2 -2
- package/dist/components/list-item/list-item.d.ts.map +1 -1
- package/dist/components/list-item/list-item.js +3 -3
- package/dist/components/list-item/list-item.js.map +1 -1
- package/dist/components/list-toolbar/list-toolbar-date-range.js +1 -1
- package/dist/components/list-toolbar/list-toolbar-date-range.js.map +1 -1
- package/dist/components/live-activity/live-activity.d.ts.map +1 -1
- package/dist/components/live-activity/live-activity.js +8 -3
- package/dist/components/live-activity/live-activity.js.map +1 -1
- package/dist/components/logo/logo.d.ts +5 -1
- package/dist/components/logo/logo.d.ts.map +1 -1
- package/dist/components/logo/logo.js +7 -3
- package/dist/components/logo/logo.js.map +1 -1
- package/dist/components/menu/menu.d.ts +10 -9
- package/dist/components/menu/menu.d.ts.map +1 -1
- package/dist/components/menu/menu.js +5 -4
- package/dist/components/menu/menu.js.map +1 -1
- package/dist/components/page-header/page-header.d.ts.map +1 -1
- package/dist/components/page-header/page-header.js +6 -6
- package/dist/components/page-header/page-header.js.map +1 -1
- package/dist/components/pagination/pagination.d.ts.map +1 -1
- package/dist/components/pagination/pagination.js +4 -2
- package/dist/components/pagination/pagination.js.map +1 -1
- package/dist/components/payment-logos/artwork/link.d.ts +2 -0
- package/dist/components/payment-logos/artwork/link.d.ts.map +1 -0
- package/dist/components/payment-logos/artwork/link.js +5 -0
- package/dist/components/payment-logos/artwork/link.js.map +1 -0
- package/dist/components/payment-logos/payment-logos.d.ts +1 -1
- package/dist/components/payment-logos/payment-logos.d.ts.map +1 -1
- package/dist/components/payment-logos/payment-logos.js +3 -0
- package/dist/components/payment-logos/payment-logos.js.map +1 -1
- package/dist/components/payment-method-list/payment-method-list.d.ts.map +1 -1
- package/dist/components/payment-method-list/payment-method-list.js +4 -1
- package/dist/components/payment-method-list/payment-method-list.js.map +1 -1
- package/dist/components/popover/popover.d.ts +7 -0
- package/dist/components/popover/popover.d.ts.map +1 -1
- package/dist/components/popover/popover.js.map +1 -1
- package/dist/components/quantity-stepper/quantity-stepper.js +1 -1
- package/dist/components/quantity-stepper/quantity-stepper.js.map +1 -1
- package/dist/components/radio-group/radio-group.js +2 -2
- package/dist/components/radio-group/radio-group.js.map +1 -1
- package/dist/components/reorder-list/reorder-list.d.ts +11 -2
- package/dist/components/reorder-list/reorder-list.d.ts.map +1 -1
- package/dist/components/reorder-list/reorder-list.js +39 -16
- package/dist/components/reorder-list/reorder-list.js.map +1 -1
- package/dist/components/rich-text-editor/rich-text-editor.js +1 -1
- package/dist/components/rich-text-editor/rich-text-editor.js.map +1 -1
- package/dist/components/sale-share-card/index.d.ts +2 -0
- package/dist/components/sale-share-card/index.d.ts.map +1 -0
- package/dist/components/sale-share-card/index.js +2 -0
- package/dist/components/sale-share-card/index.js.map +1 -0
- package/dist/components/sale-share-card/sale-share-card.d.ts +27 -0
- package/dist/components/sale-share-card/sale-share-card.d.ts.map +1 -0
- package/dist/components/sale-share-card/sale-share-card.js +46 -0
- package/dist/components/sale-share-card/sale-share-card.js.map +1 -0
- package/dist/components/sankey-chart/sankey-chart.d.ts +4 -4
- package/dist/components/sankey-chart/sankey-chart.js +4 -4
- package/dist/components/scaled-frame/scaled-frame.d.ts +6 -2
- package/dist/components/scaled-frame/scaled-frame.d.ts.map +1 -1
- package/dist/components/scaled-frame/scaled-frame.js +20 -1
- package/dist/components/scaled-frame/scaled-frame.js.map +1 -1
- package/dist/components/segmented-control/segmented-control.d.ts +2 -2
- package/dist/components/segmented-control/segmented-control.d.ts.map +1 -1
- package/dist/components/segmented-control/segmented-control.js +10 -2
- package/dist/components/segmented-control/segmented-control.js.map +1 -1
- package/dist/components/select/select.d.ts +21 -3
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/components/select/select.js +24 -9
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/sidebar/sidebar.d.ts +2 -2
- package/dist/components/sidebar/sidebar.js +2 -2
- package/dist/components/skeleton/skeleton.d.ts.map +1 -1
- package/dist/components/skeleton/skeleton.js +7 -7
- package/dist/components/skeleton/skeleton.js.map +1 -1
- package/dist/components/slider/slider-thumb.d.ts +2 -2
- package/dist/components/slider/slider-thumb.d.ts.map +1 -1
- package/dist/components/slider/slider-thumb.js +2 -2
- package/dist/components/slider/slider-thumb.js.map +1 -1
- package/dist/components/slider/slider.js +1 -1
- package/dist/components/slider/slider.js.map +1 -1
- package/dist/components/stat-card/index.d.ts +1 -1
- package/dist/components/stat-card/index.d.ts.map +1 -1
- package/dist/components/stat-card/index.js +1 -1
- package/dist/components/stat-card/index.js.map +1 -1
- package/dist/components/stat-card/stat-card.d.ts +47 -7
- package/dist/components/stat-card/stat-card.d.ts.map +1 -1
- package/dist/components/stat-card/stat-card.js +72 -12
- package/dist/components/stat-card/stat-card.js.map +1 -1
- package/dist/components/subscription-card/subscription-card.js +1 -1
- package/dist/components/subscription-card/subscription-card.js.map +1 -1
- package/dist/components/sunburst-chart/sunburst-chart.d.ts +2 -1
- package/dist/components/sunburst-chart/sunburst-chart.d.ts.map +1 -1
- package/dist/components/sunburst-chart/sunburst-chart.js +2 -1
- package/dist/components/sunburst-chart/sunburst-chart.js.map +1 -1
- package/dist/components/tabs/tabs.d.ts +30 -1
- package/dist/components/tabs/tabs.d.ts.map +1 -1
- package/dist/components/tabs/tabs.js +14 -4
- package/dist/components/tabs/tabs.js.map +1 -1
- package/dist/components/test-mode-banner/test-mode-banner.d.ts.map +1 -1
- package/dist/components/test-mode-banner/test-mode-banner.js +3 -2
- package/dist/components/test-mode-banner/test-mode-banner.js.map +1 -1
- package/dist/components/timestamp/index.d.ts +1 -1
- package/dist/components/timestamp/index.d.ts.map +1 -1
- package/dist/components/timestamp/index.js +1 -1
- package/dist/components/timestamp/index.js.map +1 -1
- package/dist/components/timestamp/timestamp.d.ts +12 -2
- package/dist/components/timestamp/timestamp.d.ts.map +1 -1
- package/dist/components/timestamp/timestamp.js +12 -2
- package/dist/components/timestamp/timestamp.js.map +1 -1
- package/dist/components/timezone-select/timezone-select.d.ts +6 -1
- package/dist/components/timezone-select/timezone-select.d.ts.map +1 -1
- package/dist/components/timezone-select/timezone-select.js +2 -2
- package/dist/components/timezone-select/timezone-select.js.map +1 -1
- package/dist/components/tooltip/tooltip.js +1 -1
- package/dist/components/tooltip/tooltip.js.map +1 -1
- package/dist/icons/index.d.ts +9 -0
- package/dist/icons/index.js +9 -0
- package/dist/icons/ui/arrow-turn-right.d.ts +3 -0
- package/dist/icons/ui/arrow-turn-right.d.ts.map +1 -0
- package/dist/icons/ui/arrow-turn-right.js +5 -0
- package/dist/icons/ui/arrow-turn-right.js.map +1 -0
- package/dist/icons/ui/box-glyph.d.ts +3 -0
- package/dist/icons/ui/box-glyph.js +5 -0
- package/dist/icons/ui/circle-check-glyph.d.ts +3 -0
- package/dist/icons/ui/circle-check-glyph.js +5 -0
- package/dist/icons/ui/crop.d.ts +3 -0
- package/dist/icons/ui/crop.d.ts.map +1 -0
- package/dist/icons/ui/crop.js +5 -0
- package/dist/icons/ui/crop.js.map +1 -0
- package/dist/icons/ui/greek-temple-glyph.d.ts +3 -0
- package/dist/icons/ui/greek-temple-glyph.js +5 -0
- package/dist/icons/ui/hourglass-glyph.d.ts +3 -0
- package/dist/icons/ui/hourglass-glyph.js +5 -0
- package/dist/icons/ui/shop-glyph.d.ts +3 -0
- package/dist/icons/ui/shop-glyph.js +5 -0
- package/dist/icons/ui/triangle-warning-glyph.d.ts +3 -0
- package/dist/icons/ui/triangle-warning-glyph.js +5 -0
- package/dist/icons/ui/user-glyph.d.ts +3 -0
- package/dist/icons/ui/user-glyph.js +5 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/cn-tables.js +5 -5
- package/dist/lib/cn-tables.js.map +1 -1
- package/dist/lib/locale-messages.d.ts +8 -0
- package/dist/lib/locale-messages.d.ts.map +1 -1
- package/dist/lib/locale-messages.js +9 -0
- package/dist/lib/locale-messages.js.map +1 -1
- package/dist/locales/ar.d.ts.map +1 -1
- package/dist/locales/ar.js +6 -0
- package/dist/locales/ar.js.map +1 -1
- package/dist/locales/de.d.ts.map +1 -1
- package/dist/locales/de.js +6 -0
- package/dist/locales/de.js.map +1 -1
- package/dist/locales/es.d.ts.map +1 -1
- package/dist/locales/es.js +6 -0
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/fr.d.ts.map +1 -1
- package/dist/locales/fr.js +6 -0
- package/dist/locales/fr.js.map +1 -1
- package/dist/locales/he.d.ts.map +1 -1
- package/dist/locales/he.js +6 -0
- package/dist/locales/he.js.map +1 -1
- package/dist/locales/hi.d.ts.map +1 -1
- package/dist/locales/hi.js +6 -0
- package/dist/locales/hi.js.map +1 -1
- package/dist/locales/ja.d.ts.map +1 -1
- package/dist/locales/ja.js +6 -0
- package/dist/locales/ja.js.map +1 -1
- package/dist/locales/pt-BR.d.ts.map +1 -1
- package/dist/locales/pt-BR.js +6 -0
- package/dist/locales/pt-BR.js.map +1 -1
- package/dist/locales/zh-CN.d.ts.map +1 -1
- package/dist/locales/zh-CN.js +6 -0
- package/dist/locales/zh-CN.js.map +1 -1
- package/dist/primitives/charts/area-chart.js +1 -1
- package/dist/primitives/charts/area-chart.js.map +1 -1
- package/dist/primitives/charts/area.d.ts +1 -1
- package/dist/primitives/charts/area.d.ts.map +1 -1
- package/dist/primitives/charts/bar-chart.js +1 -1
- package/dist/primitives/charts/bar-chart.js.map +1 -1
- package/dist/primitives/charts/bar-squares.d.ts +1 -1
- package/dist/primitives/charts/bar-squares.d.ts.map +1 -1
- package/dist/primitives/charts/bar.d.ts +6 -5
- package/dist/primitives/charts/bar.d.ts.map +1 -1
- package/dist/primitives/charts/bar.js +1 -1
- package/dist/primitives/charts/bar.js.map +1 -1
- package/dist/primitives/charts/chart-context.js +2 -2
- package/dist/primitives/charts/chart-context.js.map +1 -1
- package/dist/primitives/charts/composed-chart.js +3 -3
- package/dist/primitives/charts/composed-chart.js.map +1 -1
- package/dist/primitives/charts/funnel-chart.d.ts +12 -8
- package/dist/primitives/charts/funnel-chart.d.ts.map +1 -1
- package/dist/primitives/charts/funnel-chart.js +38 -9
- package/dist/primitives/charts/funnel-chart.js.map +1 -1
- package/dist/primitives/charts/gauge.d.ts +4 -4
- package/dist/primitives/charts/gauge.js +8 -8
- package/dist/primitives/charts/gauge.js.map +1 -1
- package/dist/primitives/charts/line-chart.js +1 -1
- package/dist/primitives/charts/line-chart.js.map +1 -1
- package/dist/primitives/charts/line-series-terminal-marker.d.ts.map +1 -1
- package/dist/primitives/charts/line-series-terminal-marker.js +1 -1
- package/dist/primitives/charts/line-series-terminal-marker.js.map +1 -1
- package/dist/primitives/charts/line.d.ts +1 -1
- package/dist/primitives/charts/line.d.ts.map +1 -1
- package/dist/primitives/charts/notch-gauge-shared.d.ts.map +1 -1
- package/dist/primitives/charts/notch-gauge-shared.js +4 -3
- package/dist/primitives/charts/notch-gauge-shared.js.map +1 -1
- package/dist/primitives/charts/pie-context.d.ts +3 -2
- package/dist/primitives/charts/pie-context.d.ts.map +1 -1
- package/dist/primitives/charts/pie-context.js +7 -6
- package/dist/primitives/charts/pie-context.js.map +1 -1
- package/dist/primitives/charts/pie-slice.d.ts +2 -2
- package/dist/primitives/charts/pie-slice.js +1 -1
- package/dist/primitives/charts/pie-slice.js.map +1 -1
- package/dist/primitives/charts/ring-context.d.ts +4 -2
- package/dist/primitives/charts/ring-context.d.ts.map +1 -1
- package/dist/primitives/charts/ring-context.js +8 -6
- package/dist/primitives/charts/ring-context.js.map +1 -1
- package/dist/primitives/charts/ring.d.ts +8 -8
- package/dist/primitives/charts/ring.d.ts.map +1 -1
- package/dist/primitives/charts/ring.js +4 -4
- package/dist/primitives/charts/ring.js.map +1 -1
- package/dist/primitives/charts/sankey/sankey-link.d.ts +9 -10
- package/dist/primitives/charts/sankey/sankey-link.d.ts.map +1 -1
- package/dist/primitives/charts/sankey/sankey-link.js +14 -9
- package/dist/primitives/charts/sankey/sankey-link.js.map +1 -1
- package/dist/primitives/charts/sankey/sankey-node.d.ts +5 -5
- package/dist/primitives/charts/sankey/sankey-node.d.ts.map +1 -1
- package/dist/primitives/charts/sankey/sankey-node.js +6 -6
- package/dist/primitives/charts/sankey/sankey-node.js.map +1 -1
- package/dist/primitives/charts/series-bar.d.ts +4 -4
- package/dist/primitives/charts/series-bar.d.ts.map +1 -1
- package/dist/primitives/charts/series-bar.js +1 -1
- package/dist/primitives/charts/series-bar.js.map +1 -1
- package/dist/primitives/charts/sunburst-context.d.ts +3 -2
- package/dist/primitives/charts/sunburst-context.d.ts.map +1 -1
- package/dist/primitives/charts/sunburst-context.js +6 -5
- package/dist/primitives/charts/sunburst-context.js.map +1 -1
- package/dist/primitives/charts/sunburst-legend.d.ts +7 -2
- package/dist/primitives/charts/sunburst-legend.d.ts.map +1 -1
- package/dist/primitives/charts/sunburst-legend.js +8 -6
- package/dist/primitives/charts/sunburst-legend.js.map +1 -1
- package/dist/primitives/charts/sunburst-segment.d.ts +3 -3
- package/dist/primitives/charts/sunburst-segment.js +2 -2
- package/dist/primitives/charts/sunburst-segment.js.map +1 -1
- package/dist/primitives/charts/tooltip/date-ticker.js +2 -2
- package/dist/primitives/charts/tooltip/date-ticker.js.map +1 -1
- package/dist/primitives/charts/tooltip/tooltip-box.js +1 -1
- package/dist/primitives/charts/tooltip/tooltip-box.js.map +1 -1
- package/dist/primitives/hooks/use-media-query.d.ts +1 -1
- package/dist/primitives/hooks/use-media-query.js +1 -1
- package/dist/primitives/lib/mobile-sheet.d.ts +25 -0
- package/dist/primitives/lib/mobile-sheet.d.ts.map +1 -0
- package/dist/primitives/lib/mobile-sheet.js +28 -0
- package/dist/primitives/lib/mobile-sheet.js.map +1 -0
- package/dist/primitives/lib/segmented-control.d.ts +8 -2
- package/dist/primitives/lib/segmented-control.d.ts.map +1 -1
- package/dist/primitives/lib/segmented-control.js +8 -2
- package/dist/primitives/lib/segmented-control.js.map +1 -1
- package/dist/primitives/ui/alert-dialog.js +1 -1
- package/dist/primitives/ui/alert-dialog.js.map +1 -1
- package/dist/primitives/ui/autocomplete.js +1 -1
- package/dist/primitives/ui/autocomplete.js.map +1 -1
- package/dist/primitives/ui/button.d.ts +1 -1
- package/dist/primitives/ui/button.d.ts.map +1 -1
- package/dist/primitives/ui/button.js +3 -1
- package/dist/primitives/ui/button.js.map +1 -1
- package/dist/primitives/ui/calendar.d.ts.map +1 -1
- package/dist/primitives/ui/calendar.js +4 -2
- package/dist/primitives/ui/calendar.js.map +1 -1
- package/dist/primitives/ui/checkbox.d.ts.map +1 -1
- package/dist/primitives/ui/checkbox.js +3 -1
- package/dist/primitives/ui/checkbox.js.map +1 -1
- package/dist/primitives/ui/combobox.js +2 -2
- package/dist/primitives/ui/combobox.js.map +1 -1
- package/dist/primitives/ui/dialog.d.ts +7 -0
- package/dist/primitives/ui/dialog.d.ts.map +1 -1
- package/dist/primitives/ui/dialog.js +12 -1
- package/dist/primitives/ui/dialog.js.map +1 -1
- package/dist/primitives/ui/drawer.d.ts +1 -2
- package/dist/primitives/ui/drawer.d.ts.map +1 -1
- package/dist/primitives/ui/drawer.js +30 -14
- package/dist/primitives/ui/drawer.js.map +1 -1
- package/dist/primitives/ui/input-group.d.ts.map +1 -1
- package/dist/primitives/ui/input-group.js +4 -1
- package/dist/primitives/ui/input-group.js.map +1 -1
- package/dist/primitives/ui/input.js +1 -1
- package/dist/primitives/ui/input.js.map +1 -1
- package/dist/primitives/ui/menu.d.ts.map +1 -1
- package/dist/primitives/ui/menu.js +15 -16
- package/dist/primitives/ui/menu.js.map +1 -1
- package/dist/primitives/ui/number-field.js +1 -1
- package/dist/primitives/ui/number-field.js.map +1 -1
- package/dist/primitives/ui/otp-field.js +2 -2
- package/dist/primitives/ui/otp-field.js.map +1 -1
- package/dist/primitives/ui/popover.d.ts +3 -1
- package/dist/primitives/ui/popover.d.ts.map +1 -1
- package/dist/primitives/ui/popover.js +11 -5
- package/dist/primitives/ui/popover.js.map +1 -1
- package/dist/primitives/ui/preview-card.js +1 -1
- package/dist/primitives/ui/preview-card.js.map +1 -1
- package/dist/primitives/ui/radio-group.js +1 -1
- package/dist/primitives/ui/radio-group.js.map +1 -1
- package/dist/primitives/ui/select.d.ts +7 -3
- package/dist/primitives/ui/select.d.ts.map +1 -1
- package/dist/primitives/ui/select.js +14 -5
- package/dist/primitives/ui/select.js.map +1 -1
- package/dist/primitives/ui/sheet.d.ts.map +1 -1
- package/dist/primitives/ui/sheet.js +5 -4
- package/dist/primitives/ui/sheet.js.map +1 -1
- package/dist/primitives/ui/sidebar.js +1 -1
- package/dist/primitives/ui/slider.js +1 -1
- package/dist/primitives/ui/slider.js.map +1 -1
- package/dist/primitives/ui/switch.d.ts +1 -1
- package/dist/primitives/ui/switch.d.ts.map +1 -1
- package/dist/primitives/ui/switch.js +1 -1
- package/dist/primitives/ui/switch.js.map +1 -1
- package/dist/primitives/ui/tabs.d.ts.map +1 -1
- package/dist/primitives/ui/tabs.js +1 -1
- package/dist/primitives/ui/tabs.js.map +1 -1
- package/dist/primitives/ui/textarea.js +1 -1
- package/dist/primitives/ui/textarea.js.map +1 -1
- package/dist/primitives/ui/toast.js +2 -2
- package/dist/primitives/ui/toast.js.map +1 -1
- package/dist/primitives/ui/tooltip.js +1 -1
- package/dist/primitives/ui/tooltip.js.map +1 -1
- package/dist/styles/motion.test.tsx +15 -0
- package/dist/styles/theme.css +13 -0
- package/dist/styles/tokens.css +142 -39
- package/dist/styles/tokens.test.tsx +154 -3
- package/dist/theme/color.d.ts +5 -0
- package/dist/theme/color.d.ts.map +1 -1
- package/dist/theme/color.js +22 -0
- package/dist/theme/color.js.map +1 -1
- package/dist/theme/css.d.ts +3 -3
- package/dist/theme/css.d.ts.map +1 -1
- package/dist/theme/css.js +33 -15
- package/dist/theme/css.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://dodo-ui.dev/schema/component-registry.json",
|
|
3
3
|
"name": "@dodopayments/ui",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.6.0",
|
|
5
5
|
"components": [
|
|
6
6
|
{
|
|
7
7
|
"slug": "alert",
|
|
@@ -336,7 +336,7 @@
|
|
|
336
336
|
"name": "fill",
|
|
337
337
|
"type": "string",
|
|
338
338
|
"required": false,
|
|
339
|
-
"description": "Fill color for the area gradient start. Default: var(--chart-1)",
|
|
339
|
+
"description": "Fill color for the area gradient start. Default: var(--chart-solid-1)",
|
|
340
340
|
"source": "dodo"
|
|
341
341
|
},
|
|
342
342
|
{
|
|
@@ -582,7 +582,7 @@
|
|
|
582
582
|
"examples": [
|
|
583
583
|
{
|
|
584
584
|
"name": "area-chart/default",
|
|
585
|
-
"code": "\"use client\";\n\nimport { Area, AreaChart } from \"@dodopayments/ui/area-chart\";\nimport { ChartGrid, XAxis, YAxis } from \"@dodopayments/ui/chart\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\n\n// Daily gross revenue for September.\nconst data = Array.from({ length: 30 }, (_, day) => ({\n date: new Date(2026, 8, 1 + day),\n revenue: Math.round(4200 + 1500 * Math.sin(day / 4) + 110 * day),\n}));\n\nconst usd = new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n maximumFractionDigits: 0,\n});\nconst usdCompact = new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n notation: \"compact\",\n});\n\nexport default function AreaChartDefault() {\n return (\n <AreaChart data={data} label=\"Gross revenue, September 2026\" margin={{ left: 56 }}>\n <ChartGrid horizontal />\n <Area dataKey=\"revenue\" />\n <XAxis />\n <YAxis formatValue={(value) => usdCompact.format(value)} />\n <ChartTooltip\n rows={(point) => [\n { color: \"var(--chart-1)\", label: \"Gross revenue\", value: usd.format(point[\"revenue\"] as number) },\n ]}\n />\n </AreaChart>\n );\n}"
|
|
585
|
+
"code": "\"use client\";\n\nimport { Area, AreaChart } from \"@dodopayments/ui/area-chart\";\nimport { ChartGrid, XAxis, YAxis } from \"@dodopayments/ui/chart\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\n\n// Daily gross revenue for September.\nconst data = Array.from({ length: 30 }, (_, day) => ({\n date: new Date(2026, 8, 1 + day),\n revenue: Math.round(4200 + 1500 * Math.sin(day / 4) + 110 * day),\n}));\n\nconst usd = new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n maximumFractionDigits: 0,\n});\nconst usdCompact = new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n notation: \"compact\",\n});\n\nexport default function AreaChartDefault() {\n return (\n <AreaChart data={data} label=\"Gross revenue, September 2026\" margin={{ left: 56 }}>\n <ChartGrid horizontal />\n <Area dataKey=\"revenue\" />\n <XAxis />\n <YAxis formatValue={(value) => usdCompact.format(value)} />\n <ChartTooltip\n rows={(point) => [\n { color: \"var(--chart-solid-1)\", label: \"Gross revenue\", value: usd.format(point[\"revenue\"] as number) },\n ]}\n />\n </AreaChart>\n );\n}"
|
|
586
586
|
},
|
|
587
587
|
{
|
|
588
588
|
"name": "area-chart/loading",
|
|
@@ -590,11 +590,11 @@
|
|
|
590
590
|
},
|
|
591
591
|
{
|
|
592
592
|
"name": "area-chart/multiple",
|
|
593
|
-
"code": "\"use client\";\n\nimport { Area, AreaChart } from \"@dodopayments/ui/area-chart\";\nimport { ChartGrid, XAxis } from \"@dodopayments/ui/chart\";\nimport { Legend, LegendItem, LegendLabel, LegendMarker } from \"@dodopayments/ui/chart-legend\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\n\n// Weekly revenue by plan, for one quarter.\nconst data = Array.from({ length: 13 }, (_, week) => ({\n date: new Date(2026, 6, 6 + week * 7),\n scale: Math.round(9200 + 2100 * Math.sin(week / 3) + 380 * week),\n growth: Math.round(6100 + 1200 * Math.cos(week / 2.5) + 210 * week),\n starter: Math.round(2400 + 500 * Math.sin(week / 2) + 90 * week),\n}));\n\nconst series = [\n { key: \"scale\", label: \"Scale\", color: \"var(--chart-1)\" },\n { key: \"growth\", label: \"Growth\", color: \"var(--chart-2)\" },\n { key: \"starter\", label: \"Starter\", color: \"var(--chart-3)\" },\n] as const;\n\nconst legendItems = series.map(({ label, color }) => ({ label, value: 0, color }));\n\nconst usd = new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n maximumFractionDigits: 0,\n});\n\nexport default function AreaChartMultiple() {\n return (\n <div className=\"flex w-full flex-col gap-3\">\n <Legend items={legendItems} className=\"flex-row flex-wrap gap-1\">\n <LegendItem className=\"flex items-center gap-2\">\n <LegendMarker />\n <LegendLabel />\n </LegendItem>\n </Legend>\n <AreaChart data={data} label=\"Weekly revenue by plan, Q3 2026\">\n <ChartGrid horizontal />\n {series.map(({ key, color }) => (\n <Area key={key} dataKey={key} fill={color} fillOpacity={0.25} />\n ))}\n <XAxis />\n <ChartTooltip\n rows={(point) =>\n series.map(({ key, label, color }) => ({\n color,\n label,\n value: usd.format(point[key] as number),\n }))\n }\n />\n </AreaChart>\n </div>\n );\n}"
|
|
593
|
+
"code": "\"use client\";\n\nimport { Area, AreaChart } from \"@dodopayments/ui/area-chart\";\nimport { ChartGrid, XAxis } from \"@dodopayments/ui/chart\";\nimport { Legend, LegendItem, LegendLabel, LegendMarker } from \"@dodopayments/ui/chart-legend\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\n\n// Weekly revenue by plan, for one quarter.\nconst data = Array.from({ length: 13 }, (_, week) => ({\n date: new Date(2026, 6, 6 + week * 7),\n scale: Math.round(9200 + 2100 * Math.sin(week / 3) + 380 * week),\n growth: Math.round(6100 + 1200 * Math.cos(week / 2.5) + 210 * week),\n starter: Math.round(2400 + 500 * Math.sin(week / 2) + 90 * week),\n}));\n\nconst series = [\n { key: \"scale\", label: \"Scale\", color: \"var(--chart-solid-1)\" },\n { key: \"growth\", label: \"Growth\", color: \"var(--chart-2)\" },\n { key: \"starter\", label: \"Starter\", color: \"var(--chart-3)\" },\n] as const;\n\nconst legendItems = series.map(({ label, color }) => ({ label, value: 0, color }));\n\nconst usd = new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n maximumFractionDigits: 0,\n});\n\nexport default function AreaChartMultiple() {\n return (\n <div className=\"flex w-full flex-col gap-3\">\n <Legend items={legendItems} className=\"flex-row flex-wrap gap-1\">\n <LegendItem className=\"flex items-center gap-2\">\n <LegendMarker />\n <LegendLabel />\n </LegendItem>\n </Legend>\n <AreaChart data={data} label=\"Weekly revenue by plan, Q3 2026\">\n <ChartGrid horizontal />\n {series.map(({ key, color }) => (\n <Area key={key} dataKey={key} fill={color} fillOpacity={0.25} />\n ))}\n <XAxis />\n <ChartTooltip\n rows={(point) =>\n series.map(({ key, label, color }) => ({\n color,\n label,\n value: usd.format(point[key] as number),\n }))\n }\n />\n </AreaChart>\n </div>\n );\n}"
|
|
594
594
|
},
|
|
595
595
|
{
|
|
596
596
|
"name": "area-chart/reference-area",
|
|
597
|
-
"code": "\"use client\";\n\nimport { Area, AreaChart } from \"@dodopayments/ui/area-chart\";\nimport { ChartGrid, ReferenceArea, XAxis } from \"@dodopayments/ui/chart\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\n\n// Daily checkouts for September, with a launch promotion from Sep 12 to Sep 18.\nconst data = Array.from({ length: 30 }, (_, day) => {\n const promo = day >= 11 && day <= 17 ? 380 : 0;\n return {\n date: new Date(2026, 8, 1 + day),\n checkouts: Math.round(820 + 160 * Math.sin(day / 3.5) + 9 * day + promo),\n };\n});\n\nexport default function AreaChartReferenceArea() {\n return (\n <AreaChart data={data} label=\"Daily checkouts, September 2026, with the launch promotion marked\">\n <ChartGrid horizontal />\n <ReferenceArea\n x1={new Date(2026, 8, 12)}\n x2={new Date(2026, 8, 18)}\n pattern=\"diagonal\"\n patternColor=\"var(--chart-scale-pattern-color)\"\n strokeStyle=\"dashed\"\n />\n <Area dataKey=\"checkouts\" fill=\"var(--chart-1)\" />\n <XAxis />\n <ChartTooltip />\n </AreaChart>\n );\n}"
|
|
597
|
+
"code": "\"use client\";\n\nimport { Area, AreaChart } from \"@dodopayments/ui/area-chart\";\nimport { ChartGrid, ReferenceArea, XAxis } from \"@dodopayments/ui/chart\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\n\n// Daily checkouts for September, with a launch promotion from Sep 12 to Sep 18.\nconst data = Array.from({ length: 30 }, (_, day) => {\n const promo = day >= 11 && day <= 17 ? 380 : 0;\n return {\n date: new Date(2026, 8, 1 + day),\n checkouts: Math.round(820 + 160 * Math.sin(day / 3.5) + 9 * day + promo),\n };\n});\n\nexport default function AreaChartReferenceArea() {\n return (\n <AreaChart data={data} label=\"Daily checkouts, September 2026, with the launch promotion marked\">\n <ChartGrid horizontal />\n <ReferenceArea\n x1={new Date(2026, 8, 12)}\n x2={new Date(2026, 8, 18)}\n pattern=\"diagonal\"\n patternColor=\"var(--chart-scale-pattern-color)\"\n strokeStyle=\"dashed\"\n />\n <Area dataKey=\"checkouts\" fill=\"var(--chart-solid-1)\" />\n <XAxis />\n <ChartTooltip />\n </AreaChart>\n );\n}"
|
|
598
598
|
}
|
|
599
599
|
],
|
|
600
600
|
"docsUrl": "/charts#area-chart"
|
|
@@ -703,11 +703,11 @@
|
|
|
703
703
|
},
|
|
704
704
|
{
|
|
705
705
|
"value": "purple",
|
|
706
|
-
"description": "The
|
|
706
|
+
"description": "The violet category tone: a soft violet fill with violet initials."
|
|
707
707
|
},
|
|
708
708
|
{
|
|
709
709
|
"value": "pink",
|
|
710
|
-
"description": "The
|
|
710
|
+
"description": "The pink category tone: a soft pink fill with pink initials."
|
|
711
711
|
},
|
|
712
712
|
{
|
|
713
713
|
"value": "lime",
|
|
@@ -1014,6 +1014,24 @@
|
|
|
1014
1014
|
"description": "An icon before the label (Figma \"Show leading icon\"), 12px, e.g. a clock on a session timer or a card on a\npayment method chip. Decorative: the label names the badge. Replaces the `dot`.",
|
|
1015
1015
|
"source": "dodo"
|
|
1016
1016
|
},
|
|
1017
|
+
{
|
|
1018
|
+
"name": "size",
|
|
1019
|
+
"type": "\"md\" | \"sm\"",
|
|
1020
|
+
"required": false,
|
|
1021
|
+
"description": "",
|
|
1022
|
+
"source": "dodo",
|
|
1023
|
+
"values": [
|
|
1024
|
+
{
|
|
1025
|
+
"value": "md",
|
|
1026
|
+
"description": "22px tall, as in Figma. The default."
|
|
1027
|
+
},
|
|
1028
|
+
{
|
|
1029
|
+
"value": "sm",
|
|
1030
|
+
"description": "18px tall with 6px inline padding: a compact pill for a dense table row or next to `sm` controls. Not a Figma size."
|
|
1031
|
+
}
|
|
1032
|
+
],
|
|
1033
|
+
"default": "\"md\""
|
|
1034
|
+
},
|
|
1017
1035
|
{
|
|
1018
1036
|
"name": "status",
|
|
1019
1037
|
"type": "\"succeeded\" | \"failed\" | \"cancelled\" | \"expired\" | \"processing\" | \"requires_customer_action\" | \"requires_payment_method\" | \"requires_merchant_action\" | \"requires_confirmation\" | \"requires_capture\" | \"partially_captured\" | \"partially_captured_and_capturable\" | \"active\" | \"pending\" | \"on_hold\" | \"paused\" | \"scheduled_for_cancellation\" | \"review\" | \"partial\" | \"full\" | \"pre_dispute\" | \"dispute\" | \"pre_arbitration\" | \"dispute_opened\" | \"dispute_expired\" | \"dispute_accepted\" | \"dispute_cancelled\" | \"dispute_challenged\" | \"dispute_won\" | \"dispute_lost\" | (string & Record<never, never>) | null",
|
|
@@ -1123,6 +1141,10 @@
|
|
|
1123
1141
|
}
|
|
1124
1142
|
],
|
|
1125
1143
|
"examples": [
|
|
1144
|
+
{
|
|
1145
|
+
"name": "badge/compact",
|
|
1146
|
+
"code": "\"use client\";\n\nimport { Badge } from \"@dodopayments/ui/badge\";\n\nexport default function BadgeCompact() {\n return (\n <>\n <Badge size=\"sm\" tone=\"success\">\n Active\n </Badge>\n <Badge size=\"sm\" tone=\"warning\" dot>\n Past due\n </Badge>\n <Badge size=\"sm\">Test mode</Badge>\n <Badge tone=\"success\">Active</Badge>\n </>\n );\n}"
|
|
1147
|
+
},
|
|
1126
1148
|
{
|
|
1127
1149
|
"name": "badge/icon",
|
|
1128
1150
|
"code": "\"use client\";\n\nimport { Badge } from \"@dodopayments/ui/badge\";\nimport { CircleCheckIcon } from \"@dodopayments/ui/icons\";\n\nexport default function BadgeIcon() {\n return (\n <Badge layout=\"icon\" tone=\"success\">\n <CircleCheckIcon aria-hidden />\n <span className=\"sr-only\">Paid</span>\n </Badge>\n );\n}"
|
|
@@ -1151,9 +1173,11 @@
|
|
|
1151
1173
|
"importPath": "@dodopayments/ui/featured-icon",
|
|
1152
1174
|
"exports": [
|
|
1153
1175
|
"DODO_FEATURED_ICON_DEFAULT_VARIANTS",
|
|
1176
|
+
"DODO_FEATURED_ICON_SPHERE_VARIANTS",
|
|
1154
1177
|
"DODO_FEATURED_ICON_VARIANTS",
|
|
1155
1178
|
"FeaturedIcon",
|
|
1156
1179
|
"FeaturedIconProps",
|
|
1180
|
+
"featuredIconSphereVariants",
|
|
1157
1181
|
"featuredIconVariants"
|
|
1158
1182
|
],
|
|
1159
1183
|
"parts": [
|
|
@@ -1168,6 +1192,13 @@
|
|
|
1168
1192
|
"description": "The icon in the tile, a Nucleo icon (16px at `md`, 12px at `sm`): `<FeaturedIcon icon={<KeyIcon />} />`.",
|
|
1169
1193
|
"source": "dodo"
|
|
1170
1194
|
},
|
|
1195
|
+
{
|
|
1196
|
+
"name": "look",
|
|
1197
|
+
"type": "\"tile\" | \"sphere\"",
|
|
1198
|
+
"required": false,
|
|
1199
|
+
"description": "`tile`: The rounded square with a soft fill and two borders (the default).\n`sphere`: The dashboard's glossy round badge in the tone, a white icon on it (44px at `md`, 28px at `sm`), as the\nverification checklist shows each step.",
|
|
1200
|
+
"source": "dodo"
|
|
1201
|
+
},
|
|
1171
1202
|
{
|
|
1172
1203
|
"name": "size",
|
|
1173
1204
|
"type": "\"md\" | \"sm\"",
|
|
@@ -1547,7 +1578,7 @@
|
|
|
1547
1578
|
"name": "fill",
|
|
1548
1579
|
"type": "string",
|
|
1549
1580
|
"required": false,
|
|
1550
|
-
"description": "Fill color for the bar. Can be a color, gradient url, or pattern url. Default: var(--chart-1)",
|
|
1581
|
+
"description": "Fill color for the bar. Can be a color, gradient url, or pattern url. Default: var(--chart-solid-1)",
|
|
1551
1582
|
"source": "dodo"
|
|
1552
1583
|
},
|
|
1553
1584
|
{
|
|
@@ -1603,7 +1634,7 @@
|
|
|
1603
1634
|
"name": "variant",
|
|
1604
1635
|
"type": "\"tint\" | \"solid\"",
|
|
1605
1636
|
"required": false,
|
|
1606
|
-
"description": "`\"tint\"`: the radar look, an opaque 20% wash of the colour (mixed into the card, so gridlines stay behind it) with\na solid 3px edge at the value end (35% while hovered)
|
|
1637
|
+
"description": "`\"solid\"`: the full colour, the default look of the bar charts.\n`\"tint\"`: the radar look, an opaque 20% wash of the colour (mixed into the card, so gridlines stay behind it) with\na solid 3px edge at the value end (35% while hovered). A gradient or pattern `fill` without `stroke`, and\n`perspective` bars, stay solid.\nDefault: \"solid\"",
|
|
1607
1638
|
"source": "dodo"
|
|
1608
1639
|
},
|
|
1609
1640
|
{
|
|
@@ -1780,7 +1811,7 @@
|
|
|
1780
1811
|
"name": "fill",
|
|
1781
1812
|
"type": "string",
|
|
1782
1813
|
"required": false,
|
|
1783
|
-
"description": "Fill color. Default: var(--chart-1)",
|
|
1814
|
+
"description": "Fill color. Default: var(--chart-solid-1)",
|
|
1784
1815
|
"source": "dodo"
|
|
1785
1816
|
},
|
|
1786
1817
|
{
|
|
@@ -1801,7 +1832,7 @@
|
|
|
1801
1832
|
"name": "variant",
|
|
1802
1833
|
"type": "\"tint\" | \"solid\"",
|
|
1803
1834
|
"required": false,
|
|
1804
|
-
"description": "`\"
|
|
1835
|
+
"description": "`\"solid\"`: the full colour, as `Bar`. `\"tint\"`: an opaque 20% wash of the colour (35% for the hovered point)\nwith a solid 3px edge along the top. A gradient or pattern `fill` without `stroke` stays solid.\nDefault: \"solid\"",
|
|
1805
1836
|
"source": "dodo"
|
|
1806
1837
|
}
|
|
1807
1838
|
]
|
|
@@ -1890,7 +1921,7 @@
|
|
|
1890
1921
|
"name": "fill",
|
|
1891
1922
|
"type": "string",
|
|
1892
1923
|
"required": false,
|
|
1893
|
-
"description": "Fill color, gradient url, or pattern url. Default: var(--chart-1)",
|
|
1924
|
+
"description": "Fill color, gradient url, or pattern url. Default: var(--chart-solid-1)",
|
|
1894
1925
|
"source": "dodo"
|
|
1895
1926
|
},
|
|
1896
1927
|
{
|
|
@@ -2076,11 +2107,11 @@
|
|
|
2076
2107
|
"examples": [
|
|
2077
2108
|
{
|
|
2078
2109
|
"name": "bar-chart/grouped",
|
|
2079
|
-
"code": "\"use client\";\n\nimport { Bar, BarChart, BarXAxis } from \"@dodopayments/ui/bar-chart\";\nimport { ChartGrid } from \"@dodopayments/ui/chart\";\nimport { Legend, LegendItem, LegendLabel, LegendMarker } from \"@dodopayments/ui/chart-legend\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\n\n// Monthly gross revenue and net revenue (after refunds and fees), first half of 2026.\nconst data = [\n { month: \"Jan\", gross: 42800, net: 37100 },\n { month: \"Feb\", gross: 46300, net: 40200 },\n { month: \"Mar\", gross: 44100, net: 38400 },\n { month: \"Apr\", gross: 51900, net: 45600 },\n { month: \"May\", gross: 55200, net: 48100 },\n { month: \"Jun\", gross: 61400, net: 53900 },\n];\n\nconst legendItems = [\n { label: \"Gross revenue\", value: 0, color: \"var(--chart-1)\" },\n { label: \"Net revenue\", value: 0, color: \"var(--chart-2)\" },\n];\n\nconst usd = new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n maximumFractionDigits: 0,\n});\n\nexport default function BarChartGrouped() {\n return (\n <div className=\"flex w-full flex-col gap-3\">\n <Legend items={legendItems} className=\"flex-row flex-wrap gap-1\">\n <LegendItem className=\"flex items-center gap-2\">\n <LegendMarker
|
|
2110
|
+
"code": "\"use client\";\n\nimport { Bar, BarChart, BarXAxis } from \"@dodopayments/ui/bar-chart\";\nimport { ChartGrid } from \"@dodopayments/ui/chart\";\nimport { Legend, LegendItem, LegendLabel, LegendMarker } from \"@dodopayments/ui/chart-legend\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\n\n// Monthly gross revenue and net revenue (after refunds and fees), first half of 2026.\nconst data = [\n { month: \"Jan\", gross: 42800, net: 37100 },\n { month: \"Feb\", gross: 46300, net: 40200 },\n { month: \"Mar\", gross: 44100, net: 38400 },\n { month: \"Apr\", gross: 51900, net: 45600 },\n { month: \"May\", gross: 55200, net: 48100 },\n { month: \"Jun\", gross: 61400, net: 53900 },\n];\n\nconst legendItems = [\n { label: \"Gross revenue\", value: 0, color: \"var(--chart-solid-1)\" },\n { label: \"Net revenue\", value: 0, color: \"var(--chart-solid-2)\" },\n];\n\nconst usd = new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n maximumFractionDigits: 0,\n});\n\nexport default function BarChartGrouped() {\n return (\n <div className=\"flex w-full flex-col gap-3\">\n <Legend items={legendItems} className=\"flex-row flex-wrap gap-1\">\n <LegendItem className=\"flex items-center gap-2\">\n <LegendMarker />\n <LegendLabel />\n </LegendItem>\n </Legend>\n <BarChart data={data} xDataKey=\"month\" label=\"Gross and net revenue by month, January to June 2026\">\n <ChartGrid horizontal />\n <Bar dataKey=\"gross\" fill=\"var(--chart-solid-1)\" />\n <Bar dataKey=\"net\" fill=\"var(--chart-solid-2)\" />\n <BarXAxis />\n <ChartTooltip\n rows={(point) => [\n { color: \"var(--chart-solid-1)\", label: \"Gross\", value: usd.format(point.gross as number) },\n { color: \"var(--chart-solid-2)\", label: \"Net\", value: usd.format(point.net as number) },\n ]}\n />\n </BarChart>\n </div>\n );\n}"
|
|
2080
2111
|
},
|
|
2081
2112
|
{
|
|
2082
2113
|
"name": "bar-chart/horizontal",
|
|
2083
|
-
"code": "\"use client\";\n\nimport { Bar, BarChart, BarYAxis } from \"@dodopayments/ui/bar-chart\";\nimport { ChartGrid } from \"@dodopayments/ui/chart\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\n\n// Top products by revenue, last 30 days.\nconst data = [\n { product: \"Pro plan\", revenue: 48200 },\n { product: \"Team plan\", revenue: 36900 },\n { product: \"API credits\", revenue: 21400 },\n { product: \"Starter plan\", revenue: 15800 },\n { product: \"Add-on seats\", revenue: 9300 },\n];\n\nconst usd = new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n maximumFractionDigits: 0,\n});\n\nexport default function BarChartHorizontal() {\n return (\n <BarChart\n data={data}\n xDataKey=\"product\"\n orientation=\"horizontal\"\n margin={{ left: 96 }}\n aspectRatio=\"5 / 2\"\n label=\"Top products by revenue, last 30 days\"\n >\n <ChartGrid horizontal={false} vertical />\n <Bar dataKey=\"revenue\" fill=\"var(--chart-1)\" />\n <BarYAxis />\n <ChartTooltip\n showCrosshair={false}\n rows={(point) => [\n { color: \"var(--chart-1)\", label: \"Revenue\", value: usd.format(point.revenue as number) },\n ]}\n />\n </BarChart>\n );\n}"
|
|
2114
|
+
"code": "\"use client\";\n\nimport { Bar, BarChart, BarYAxis } from \"@dodopayments/ui/bar-chart\";\nimport { ChartGrid } from \"@dodopayments/ui/chart\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\n\n// Top products by revenue, last 30 days.\nconst data = [\n { product: \"Pro plan\", revenue: 48200 },\n { product: \"Team plan\", revenue: 36900 },\n { product: \"API credits\", revenue: 21400 },\n { product: \"Starter plan\", revenue: 15800 },\n { product: \"Add-on seats\", revenue: 9300 },\n];\n\nconst usd = new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n maximumFractionDigits: 0,\n});\n\nexport default function BarChartHorizontal() {\n return (\n <BarChart\n data={data}\n xDataKey=\"product\"\n orientation=\"horizontal\"\n margin={{ left: 96 }}\n aspectRatio=\"5 / 2\"\n label=\"Top products by revenue, last 30 days\"\n >\n <ChartGrid horizontal={false} vertical />\n <Bar dataKey=\"revenue\" fill=\"var(--chart-solid-1)\" />\n <BarYAxis />\n <ChartTooltip\n showCrosshair={false}\n rows={(point) => [\n { color: \"var(--chart-solid-1)\", label: \"Revenue\", value: usd.format(point.revenue as number) },\n ]}\n />\n </BarChart>\n );\n}"
|
|
2084
2115
|
},
|
|
2085
2116
|
{
|
|
2086
2117
|
"name": "bar-chart/loading",
|
|
@@ -2088,7 +2119,7 @@
|
|
|
2088
2119
|
},
|
|
2089
2120
|
{
|
|
2090
2121
|
"name": "bar-chart/stacked",
|
|
2091
|
-
"code": "\"use client\";\n\nimport { Bar, BarChart, BarXAxis } from \"@dodopayments/ui/bar-chart\";\nimport { ChartGrid } from \"@dodopayments/ui/chart\";\nimport { Legend, LegendItem, LegendLabel, LegendMarker } from \"@dodopayments/ui/chart-legend\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\n\n// Weekly payouts, split by payout method.\nconst data = [\n { week: \"W1\", bank: 18200, card: 6400, wallet: 2100 },\n { week: \"W2\", bank: 21500, card: 7100, wallet: 2600 },\n { week: \"W3\", bank: 19800, card: 6900, wallet: 3200 },\n { week: \"W4\", bank: 24300, card: 8200, wallet: 3800 },\n { week: \"W5\", bank: 22700, card: 7600, wallet: 4100 },\n { week: \"W6\", bank: 26900, card: 9100, wallet: 4700 },\n];\n\nconst series = [\n { key: \"bank\", label: \"Bank transfer\", color: \"var(--chart-1)\" },\n { key: \"card\", label: \"Card\", color: \"var(--chart-2)\" },\n { key: \"wallet\", label: \"Wallet\", color: \"var(--chart-3)\" },\n] as const;\n\nconst legendItems = series.map(({ label, color }) => ({ label, value: 0, color }));\n\nconst usd = new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n maximumFractionDigits: 0,\n});\n\nexport default function BarChartStacked() {\n return (\n <div className=\"flex w-full flex-col gap-3\">\n <Legend items={legendItems} className=\"flex-row flex-wrap gap-1\">\n <LegendItem className=\"flex items-center gap-2\">\n <LegendMarker
|
|
2122
|
+
"code": "\"use client\";\n\nimport { Bar, BarChart, BarXAxis } from \"@dodopayments/ui/bar-chart\";\nimport { ChartGrid } from \"@dodopayments/ui/chart\";\nimport { Legend, LegendItem, LegendLabel, LegendMarker } from \"@dodopayments/ui/chart-legend\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\n\n// Weekly payouts, split by payout method.\nconst data = [\n { week: \"W1\", bank: 18200, card: 6400, wallet: 2100 },\n { week: \"W2\", bank: 21500, card: 7100, wallet: 2600 },\n { week: \"W3\", bank: 19800, card: 6900, wallet: 3200 },\n { week: \"W4\", bank: 24300, card: 8200, wallet: 3800 },\n { week: \"W5\", bank: 22700, card: 7600, wallet: 4100 },\n { week: \"W6\", bank: 26900, card: 9100, wallet: 4700 },\n];\n\nconst series = [\n { key: \"bank\", label: \"Bank transfer\", color: \"var(--chart-solid-1)\" },\n { key: \"card\", label: \"Card\", color: \"var(--chart-solid-2)\" },\n { key: \"wallet\", label: \"Wallet\", color: \"var(--chart-solid-3)\" },\n] as const;\n\nconst legendItems = series.map(({ label, color }) => ({ label, value: 0, color }));\n\nconst usd = new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n maximumFractionDigits: 0,\n});\n\nexport default function BarChartStacked() {\n return (\n <div className=\"flex w-full flex-col gap-3\">\n <Legend items={legendItems} className=\"flex-row flex-wrap gap-1\">\n <LegendItem className=\"flex items-center gap-2\">\n <LegendMarker />\n <LegendLabel />\n </LegendItem>\n </Legend>\n <BarChart data={data} xDataKey=\"week\" stacked stackGap={2} label=\"Payouts by method, last 6 weeks\">\n <ChartGrid horizontal />\n {series.map(({ key, color }) => (\n <Bar key={key} dataKey={key} fill={color} />\n ))}\n <BarXAxis />\n <ChartTooltip\n rows={(point) =>\n series.map(({ key, label, color }) => ({\n color,\n label,\n value: usd.format(point[key] as number),\n }))\n }\n />\n </BarChart>\n </div>\n );\n}"
|
|
2092
2123
|
}
|
|
2093
2124
|
],
|
|
2094
2125
|
"docsUrl": "/charts#bar-chart"
|
|
@@ -2388,7 +2419,7 @@
|
|
|
2388
2419
|
"name": "stroke",
|
|
2389
2420
|
"type": "string",
|
|
2390
2421
|
"required": false,
|
|
2391
|
-
"description": "Stroke color. Default: var(--chart-1), or var(--chart-comparison) for `variant=\"comparison\"`",
|
|
2422
|
+
"description": "Stroke color. Default: var(--chart-solid-1), or var(--chart-comparison) for `variant=\"comparison\"`",
|
|
2392
2423
|
"source": "dodo"
|
|
2393
2424
|
},
|
|
2394
2425
|
{
|
|
@@ -3168,7 +3199,7 @@
|
|
|
3168
3199
|
},
|
|
3169
3200
|
{
|
|
3170
3201
|
"name": "line-chart/default",
|
|
3171
|
-
"code": "\"use client\";\n\nimport { ChartGrid, ChartUpdated, XAxis, YAxis } from \"@dodopayments/ui/chart\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\nimport { Line, LineChart } from \"@dodopayments/ui/line-chart\";\nimport { StatCard } from \"@dodopayments/ui/stat-card\";\nimport { useState } from \"react\";\n\nconst DAY_MS = 24 * 60 * 60 * 1000;\nconst PERIOD_DAYS = 30;\n\n// Daily gross volume for Sep 26 to Oct 25, against the 30 days before it.\nconst data = Array.from({ length: PERIOD_DAYS }, (_, day) => ({\n date: new Date(2026, 8, 26 + day),\n current: Math.round(1180 + 420 * Math.sin(day / 3.1) + 38 * day),\n previous: Math.round(1320 + 360 * Math.cos(day / 2.6) + 12 * day),\n}));\n\nconst sum = (key: \"current\" | \"previous\") => data.reduce((total, row) => total + row[key], 0);\nconst current = sum(\"current\");\nconst previous = sum(\"previous\");\nconst change = Math.abs((current - previous) / previous);\n\nconst money = new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency: \"USD\" });\nconst axisMoney = new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n maximumFractionDigits: 0,\n});\nconst shortDate = new Intl.DateTimeFormat(\"en-US\", { month: \"short\", day: \"numeric\" });\nconst previousDate = (date: Date) => new Date(date.getTime() - PERIOD_DAYS * DAY_MS);\n\nexport default function LineChartDefault() {\n const [updatedAt, setUpdatedAt] = useState(() => Date.now() - 40 * 60_000);\n const [refreshing, setRefreshing] = useState(false);\n // Simulate reloading the widget's data.\n const refresh = () => {\n setRefreshing(true);\n setTimeout(() => {\n setUpdatedAt(Date.now());\n setRefreshing(false);\n }, 900);\n };\n\n return (\n <StatCard\n label=\"Gross volume\"\n help=\"Everything your customers paid, before refunds, fees and taxes.\"\n value={money.format(current)}\n trend={{\n value: `${(change * 100).toFixed(0)}%`,\n direction: current >= previous ? \"up\" : \"down\",\n }}\n comparison={`vs Aug 27 – Sep 25: ${money.format(previous)}`}\n className=\"w-full max-w-150\"\n footer={<ChartUpdated updatedAt={updatedAt} onRefresh={refresh} refreshing={refreshing} />}\n >\n <LineChart\n data={data}\n label=\"Gross volume, Sep 26 to Oct 25 2026, against the previous 30 days\"\n aspectRatio=\"5 / 2\"\n margin={{ top: 16, right: 8, bottom: 32, left: 48 }}\n >\n <ChartGrid horizontal numTicksRows={4} />\n <Line dataKey=\"previous\" variant=\"comparison\" />\n <Line dataKey=\"current\" />\n <XAxis numTicks={2} />\n <YAxis numTicks={4} formatValue={(value) => axisMoney.format(value)} />\n <ChartTooltip\n title=\"Gross volume\"\n rows={(point) => [\n {\n color: \"var(--chart-1)\",\n label: shortDate.format(point.date as Date),\n value: money.format(point.current as number),\n },\n {\n color: \"var(--chart-comparison)\",\n label: shortDate.format(previousDate(point.date as Date)),\n value: money.format(point.previous as number),\n },\n ]}\n />\n </LineChart>\n </StatCard>\n );\n}"
|
|
3202
|
+
"code": "\"use client\";\n\nimport { ChartGrid, ChartUpdated, XAxis, YAxis } from \"@dodopayments/ui/chart\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\nimport { Line, LineChart } from \"@dodopayments/ui/line-chart\";\nimport { StatCard } from \"@dodopayments/ui/stat-card\";\nimport { useState } from \"react\";\n\nconst DAY_MS = 24 * 60 * 60 * 1000;\nconst PERIOD_DAYS = 30;\n\n// Daily gross volume for Sep 26 to Oct 25, against the 30 days before it.\nconst data = Array.from({ length: PERIOD_DAYS }, (_, day) => ({\n date: new Date(2026, 8, 26 + day),\n current: Math.round(1180 + 420 * Math.sin(day / 3.1) + 38 * day),\n previous: Math.round(1320 + 360 * Math.cos(day / 2.6) + 12 * day),\n}));\n\nconst sum = (key: \"current\" | \"previous\") => data.reduce((total, row) => total + row[key], 0);\nconst current = sum(\"current\");\nconst previous = sum(\"previous\");\nconst change = Math.abs((current - previous) / previous);\n\nconst money = new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency: \"USD\" });\nconst axisMoney = new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n maximumFractionDigits: 0,\n});\nconst shortDate = new Intl.DateTimeFormat(\"en-US\", { month: \"short\", day: \"numeric\" });\nconst previousDate = (date: Date) => new Date(date.getTime() - PERIOD_DAYS * DAY_MS);\n\nexport default function LineChartDefault() {\n const [updatedAt, setUpdatedAt] = useState(() => Date.now() - 40 * 60_000);\n const [refreshing, setRefreshing] = useState(false);\n // Simulate reloading the widget's data.\n const refresh = () => {\n setRefreshing(true);\n setTimeout(() => {\n setUpdatedAt(Date.now());\n setRefreshing(false);\n }, 900);\n };\n\n return (\n <StatCard\n label=\"Gross volume\"\n help=\"Everything your customers paid, before refunds, fees and taxes.\"\n value={money.format(current)}\n trend={{\n value: `${(change * 100).toFixed(0)}%`,\n direction: current >= previous ? \"up\" : \"down\",\n }}\n comparison={`vs Aug 27 – Sep 25: ${money.format(previous)}`}\n className=\"w-full max-w-150\"\n footer={<ChartUpdated updatedAt={updatedAt} onRefresh={refresh} refreshing={refreshing} />}\n >\n <LineChart\n data={data}\n label=\"Gross volume, Sep 26 to Oct 25 2026, against the previous 30 days\"\n aspectRatio=\"5 / 2\"\n margin={{ top: 16, right: 8, bottom: 32, left: 48 }}\n >\n <ChartGrid horizontal numTicksRows={4} />\n <Line dataKey=\"previous\" variant=\"comparison\" />\n <Line dataKey=\"current\" />\n <XAxis numTicks={2} />\n <YAxis numTicks={4} formatValue={(value) => axisMoney.format(value)} />\n <ChartTooltip\n title=\"Gross volume\"\n rows={(point) => [\n {\n color: \"var(--chart-solid-1)\",\n label: shortDate.format(point.date as Date),\n value: money.format(point.current as number),\n },\n {\n color: \"var(--chart-comparison)\",\n label: shortDate.format(previousDate(point.date as Date)),\n value: money.format(point.previous as number),\n },\n ]}\n />\n </LineChart>\n </StatCard>\n );\n}"
|
|
3172
3203
|
},
|
|
3173
3204
|
{
|
|
3174
3205
|
"name": "line-chart/profit-loss",
|
|
@@ -3315,11 +3346,11 @@
|
|
|
3315
3346
|
"examples": [
|
|
3316
3347
|
{
|
|
3317
3348
|
"name": "composed-chart/default",
|
|
3318
|
-
"code": "\"use client\";\n\nimport { SeriesBar } from \"@dodopayments/ui/bar-chart\";\nimport { ChartGrid, XAxis } from \"@dodopayments/ui/chart\";\nimport { Legend, LegendItem, LegendLabel, LegendMarker } from \"@dodopayments/ui/chart-legend\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\nimport { ComposedChart } from \"@dodopayments/ui/composed-chart\";\nimport { Line } from \"@dodopayments/ui/line-chart\";\n\n// Daily orders (tinted columns), revenue in $K (line) and the 7-day revenue run rate in $K (dashed grey line).\nconst data = Array.from({ length: 30 }, (_, day) => {\n const revenue = 42 + 9 * Math.sin(day / 4) + 0.6 * day + 3 * Math.cos(day * 1.3);\n return {\n date: new Date(2026, 8, 1 + day),\n orders: Math.round(revenue * 0.9 + 4 * Math.sin(day * 2.1)),\n revenue: Number(revenue.toFixed(1)),\n runRate: Number((42 + 8 * Math.sin((day - 2) / 4) + 0.6 * day).toFixed(1)),\n };\n});\n\nconst legendItems = [\n { label: \"Orders\", value: 0, color: \"var(--chart-2)\" },\n { label: \"Revenue ($K)\", value: 0, color: \"var(--chart-1)\" },\n { label: \"7-day run rate ($K)\", value: 0, color: \"var(--chart-comparison)\" },\n];\n\nexport default function ComposedChartDefault() {\n return (\n <div className=\"flex w-full flex-col gap-3\">\n <Legend items={legendItems} className=\"flex-row flex-wrap gap-1\">\n <LegendItem className=\"flex items-center gap-2\">\n <LegendMarker />\n <LegendLabel />\n </LegendItem>\n </Legend>\n <ComposedChart\n data={data}\n label=\"Orders, revenue and 7-day run rate, September 2026\"\n barGap={0}\n maxBarSize={32}\n >\n <ChartGrid horizontal />\n <SeriesBar dataKey=\"orders\" fill=\"var(--chart-2)\" radius={4} />\n <Line dataKey=\"runRate\" variant=\"comparison\" />\n <Line dataKey=\"revenue\" stroke=\"var(--chart-1)\" />\n <XAxis numTicks={6} />\n <ChartTooltip showCrosshair={false} />\n </ComposedChart>\n </div>\n );\n}"
|
|
3349
|
+
"code": "\"use client\";\n\nimport { SeriesBar } from \"@dodopayments/ui/bar-chart\";\nimport { ChartGrid, XAxis } from \"@dodopayments/ui/chart\";\nimport { Legend, LegendItem, LegendLabel, LegendMarker } from \"@dodopayments/ui/chart-legend\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\nimport { ComposedChart } from \"@dodopayments/ui/composed-chart\";\nimport { Line } from \"@dodopayments/ui/line-chart\";\n\n// Daily orders (tinted columns), revenue in $K (line) and the 7-day revenue run rate in $K (dashed grey line).\nconst data = Array.from({ length: 30 }, (_, day) => {\n const revenue = 42 + 9 * Math.sin(day / 4) + 0.6 * day + 3 * Math.cos(day * 1.3);\n return {\n date: new Date(2026, 8, 1 + day),\n orders: Math.round(revenue * 0.9 + 4 * Math.sin(day * 2.1)),\n revenue: Number(revenue.toFixed(1)),\n runRate: Number((42 + 8 * Math.sin((day - 2) / 4) + 0.6 * day).toFixed(1)),\n };\n});\n\nconst legendItems = [\n { label: \"Orders\", value: 0, color: \"var(--chart-solid-2)\" },\n { label: \"Revenue ($K)\", value: 0, color: \"var(--chart-solid-1)\" },\n { label: \"7-day run rate ($K)\", value: 0, color: \"var(--chart-comparison)\" },\n];\n\nexport default function ComposedChartDefault() {\n return (\n <div className=\"flex w-full flex-col gap-3\">\n <Legend items={legendItems} className=\"flex-row flex-wrap gap-1\">\n <LegendItem className=\"flex items-center gap-2\">\n <LegendMarker />\n <LegendLabel />\n </LegendItem>\n </Legend>\n <ComposedChart\n data={data}\n label=\"Orders, revenue and 7-day run rate, September 2026\"\n barGap={0}\n maxBarSize={32}\n >\n <ChartGrid horizontal />\n <SeriesBar dataKey=\"orders\" fill=\"var(--chart-solid-2)\" radius={4} />\n <Line dataKey=\"runRate\" variant=\"comparison\" />\n <Line dataKey=\"revenue\" stroke=\"var(--chart-solid-1)\" />\n <XAxis numTicks={6} />\n <ChartTooltip showCrosshair={false} />\n </ComposedChart>\n </div>\n );\n}"
|
|
3319
3350
|
},
|
|
3320
3351
|
{
|
|
3321
3352
|
"name": "composed-chart/stacked",
|
|
3322
|
-
"code": "\"use client\";\n\nimport { SeriesBar } from \"@dodopayments/ui/bar-chart\";\nimport { ChartGrid, XAxis } from \"@dodopayments/ui/chart\";\nimport { Legend, LegendItem, LegendLabel, LegendMarker } from \"@dodopayments/ui/chart-legend\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\nimport { ComposedChart } from \"@dodopayments/ui/composed-chart\";\nimport { Line } from \"@dodopayments/ui/line-chart\";\n\n// Weekly payments by method (stacked columns) and the refund count (line), in thousands.\nconst data = Array.from({ length: 12 }, (_, week) => ({\n date: new Date(2026, 6, 6 + week * 7),\n card: Number((14 + 3 * Math.sin(week / 2) + 0.5 * week).toFixed(1)),\n bank: Number((8 + 2 * Math.cos(week / 3) + 0.3 * week).toFixed(1)),\n wallet: Number((3 + Math.sin(week / 1.5) + 0.2 * week).toFixed(1)),\n refunds: Number((4 + 1.5 * Math.sin(week / 2.4 + 1)).toFixed(1)),\n}));\n\nconst bars = [\n { key: \"card\", label: \"Card\", color: \"var(--chart-1)\" },\n { key: \"bank\", label: \"Bank transfer\", color: \"var(--chart-2)\" },\n { key: \"wallet\", label: \"Wallet\", color: \"var(--chart-3)\" },\n] as const;\n\nconst legendItems = [\n ...bars.map(({ label, color }) => ({ label, value: 0, color })),\n { label: \"Refunds\", value: 0, color: \"var(--chart-5)\" },\n];\n\nexport default function ComposedChartStacked() {\n return (\n <div className=\"flex w-full flex-col gap-3\">\n <Legend items={legendItems} className=\"flex-row flex-wrap gap-1\">\n <LegendItem className=\"flex items-center gap-2\">\n <LegendMarker />\n <LegendLabel />\n </LegendItem>\n </Legend>\n <ComposedChart\n data={data}\n label=\"Weekly payments by method and refunds, Q3 2026, in thousands\"\n stacked\n stackGap={2}\n >\n <ChartGrid horizontal />\n {bars.map(({ key, color }) => (\n <SeriesBar key={key} dataKey={key} fill={color} />\n ))}\n <Line dataKey=\"refunds\" stroke=\"var(--chart-5)\" />\n <XAxis />\n <ChartTooltip showCrosshair={false} />\n </ComposedChart>\n </div>\n );\n}"
|
|
3353
|
+
"code": "\"use client\";\n\nimport { SeriesBar } from \"@dodopayments/ui/bar-chart\";\nimport { ChartGrid, XAxis } from \"@dodopayments/ui/chart\";\nimport { Legend, LegendItem, LegendLabel, LegendMarker } from \"@dodopayments/ui/chart-legend\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\nimport { ComposedChart } from \"@dodopayments/ui/composed-chart\";\nimport { Line } from \"@dodopayments/ui/line-chart\";\n\n// Weekly payments by method (stacked columns) and the refund count (line), in thousands.\nconst data = Array.from({ length: 12 }, (_, week) => ({\n date: new Date(2026, 6, 6 + week * 7),\n card: Number((14 + 3 * Math.sin(week / 2) + 0.5 * week).toFixed(1)),\n bank: Number((8 + 2 * Math.cos(week / 3) + 0.3 * week).toFixed(1)),\n wallet: Number((3 + Math.sin(week / 1.5) + 0.2 * week).toFixed(1)),\n refunds: Number((4 + 1.5 * Math.sin(week / 2.4 + 1)).toFixed(1)),\n}));\n\nconst bars = [\n { key: \"card\", label: \"Card\", color: \"var(--chart-solid-1)\" },\n { key: \"bank\", label: \"Bank transfer\", color: \"var(--chart-solid-2)\" },\n { key: \"wallet\", label: \"Wallet\", color: \"var(--chart-solid-3)\" },\n] as const;\n\nconst legendItems = [\n ...bars.map(({ label, color }) => ({ label, value: 0, color })),\n { label: \"Refunds\", value: 0, color: \"var(--chart-5)\" },\n];\n\nexport default function ComposedChartStacked() {\n return (\n <div className=\"flex w-full flex-col gap-3\">\n <Legend items={legendItems} className=\"flex-row flex-wrap gap-1\">\n <LegendItem className=\"flex items-center gap-2\">\n <LegendMarker />\n <LegendLabel />\n </LegendItem>\n </Legend>\n <ComposedChart\n data={data}\n label=\"Weekly payments by method and refunds, Q3 2026, in thousands\"\n stacked\n stackGap={2}\n >\n <ChartGrid horizontal />\n {bars.map(({ key, color }) => (\n <SeriesBar key={key} dataKey={key} fill={color} />\n ))}\n <Line dataKey=\"refunds\" stroke=\"var(--chart-5)\" />\n <XAxis />\n <ChartTooltip showCrosshair={false} />\n </ComposedChart>\n </div>\n );\n}"
|
|
3323
3354
|
}
|
|
3324
3355
|
],
|
|
3325
3356
|
"docsUrl": "/charts#composed-chart"
|
|
@@ -3883,7 +3914,7 @@
|
|
|
3883
3914
|
"title": "Gauge Chart",
|
|
3884
3915
|
"category": "Charts",
|
|
3885
3916
|
"status": "stable",
|
|
3886
|
-
"description": "One value from 0 to 100 as a row of notches, around an arc (default) or along a horizontal track\n(`orientation=\"linear\"`), on the bklit `Gauge` primitive. `value` sets how many notches fill.\n`centerValue` adds an optional animated statistic with a `defaultLabel` caption: in the arc\ncentre, or above / below the linear track (`labelPlacement`, `labelAlign`). Filled notches
|
|
3917
|
+
"description": "One value from 0 to 100 as a row of notches, around an arc (default) or along a horizontal track\n(`orientation=\"linear\"`), on the bklit `Gauge` primitive. `value` sets how many notches fill.\n`centerValue` adds an optional animated statistic with a `defaultLabel` caption: in the arc\ncentre, or above / below the linear track (`labelPlacement`, `labelAlign`). Filled notches are the full\ncolour by default; `variant=\"tint\"` gives the tint look of the other charts (a 20% wash with a solid 3px outer\nedge). Set `useGradient` for a colour ramp across the notches (blue to violet unless `activeGradient` sets one), or pass `PatternLines` / `LinearGradient` children and point\n`activeFill` / `inactiveFill` at them with `url(#id)`. The plot is a `role=\"meter\"` with\n`aria-valuenow`. Notches pop in on mount (instant under reduced motion). It has no loading or\nempty state.",
|
|
3887
3918
|
"importPath": "@dodopayments/ui/gauge-chart",
|
|
3888
3919
|
"exports": [
|
|
3889
3920
|
"GaugeChart",
|
|
@@ -3895,7 +3926,7 @@
|
|
|
3895
3926
|
"parts": [
|
|
3896
3927
|
{
|
|
3897
3928
|
"name": "GaugeChart",
|
|
3898
|
-
"description": "One value from 0 to 100 as a row of notches, around an arc (default) or along a horizontal track\n(`orientation=\"linear\"`), on the bklit `Gauge` primitive. `value` sets how many notches fill.\n`centerValue` adds an optional animated statistic with a `defaultLabel` caption: in the arc\ncentre, or above / below the linear track (`labelPlacement`, `labelAlign`). Filled notches
|
|
3929
|
+
"description": "One value from 0 to 100 as a row of notches, around an arc (default) or along a horizontal track\n(`orientation=\"linear\"`), on the bklit `Gauge` primitive. `value` sets how many notches fill.\n`centerValue` adds an optional animated statistic with a `defaultLabel` caption: in the arc\ncentre, or above / below the linear track (`labelPlacement`, `labelAlign`). Filled notches are the full\ncolour by default; `variant=\"tint\"` gives the tint look of the other charts (a 20% wash with a solid 3px outer\nedge). Set `useGradient` for a colour ramp across the notches (blue to violet unless `activeGradient` sets one), or pass `PatternLines` / `LinearGradient` children and point\n`activeFill` / `inactiveFill` at them with `url(#id)`. The plot is a `role=\"meter\"` with\n`aria-valuenow`. Notches pop in on mount (instant under reduced motion). It has no loading or\nempty state.",
|
|
3899
3930
|
"props": [
|
|
3900
3931
|
{
|
|
3901
3932
|
"name": "label",
|
|
@@ -4132,7 +4163,7 @@
|
|
|
4132
4163
|
"name": "variant",
|
|
4133
4164
|
"type": "\"tint\" | \"solid\"",
|
|
4134
4165
|
"required": false,
|
|
4135
|
-
"description": "`\"
|
|
4166
|
+
"description": "`\"solid\"`: the full colour, as the bar, pie and ring charts.\n`\"tint\"`: each filled notch an opaque 20% wash of its colour (mixed into the card) with a solid 3px\nedge on its outer side. A gradient or pattern `activeFill` (`url(#id)`) and the theme palette\ngradient stay solid. Default: \"solid\"",
|
|
4136
4167
|
"source": "dodo"
|
|
4137
4168
|
},
|
|
4138
4169
|
{
|
|
@@ -4152,11 +4183,11 @@
|
|
|
4152
4183
|
},
|
|
4153
4184
|
{
|
|
4154
4185
|
"name": "gauge-chart/gradient",
|
|
4155
|
-
"code": "\"use client\";\n\nimport { GaugeChart } from \"@dodopayments/ui/gauge-chart\";\n\nexport default function GaugeChartGradient() {\n return (\n <div className=\"grid w-full gap-6 @xl:grid-cols-2\">\n <GaugeChart\n label=\"Authorization rate\"\n value={94}\n centerValue={0.94}\n defaultLabel=\"Auth rate\"\n formatOptions={{ style: \"percent\", maximumFractionDigits: 0 }}\n useGradient\n activeGradient={[\"var(--chart-2)\", \"var(--chart-3)\"]}\n inactiveFillOpacity={0.4}\n minWidth={240}\n />\n <GaugeChart\n label=\"Annual revenue goal reached\"\n value={58}\n centerValue={1_160_000}\n defaultLabel=\"of $2M goal\"\n formatOptions={{ style: \"currency\", currency: \"USD\", notation: \"compact\" }}\n totalNotches={24}\n notchCornerRadius={4}\n uniformWidth\n inactiveFillOpacity={0.4}\n minWidth={240}\n />\n </div>\n );\n}"
|
|
4186
|
+
"code": "\"use client\";\n\nimport { GaugeChart } from \"@dodopayments/ui/gauge-chart\";\n\nexport default function GaugeChartGradient() {\n return (\n <div className=\"grid w-full gap-6 @xl:grid-cols-2\">\n <GaugeChart\n label=\"Authorization rate\"\n value={94}\n centerValue={0.94}\n defaultLabel=\"Auth rate\"\n formatOptions={{ style: \"percent\", maximumFractionDigits: 0 }}\n useGradient\n activeGradient={[\"var(--chart-solid-2)\", \"var(--chart-solid-3)\"]}\n inactiveFillOpacity={0.4}\n minWidth={240}\n />\n <GaugeChart\n label=\"Annual revenue goal reached\"\n value={58}\n centerValue={1_160_000}\n defaultLabel=\"of $2M goal\"\n formatOptions={{ style: \"currency\", currency: \"USD\", notation: \"compact\" }}\n totalNotches={24}\n notchCornerRadius={4}\n uniformWidth\n inactiveFillOpacity={0.4}\n minWidth={240}\n />\n </div>\n );\n}"
|
|
4156
4187
|
},
|
|
4157
4188
|
{
|
|
4158
4189
|
"name": "gauge-chart/linear",
|
|
4159
|
-
"code": "\"use client\";\n\nimport { GaugeChart } from \"@dodopayments/ui/gauge-chart\";\n\nexport default function GaugeChartLinear() {\n return (\n <div className=\"flex w-full flex-col gap-8\">\n <GaugeChart\n label=\"Checkout conversion this week\"\n orientation=\"linear\"\n value={38}\n centerValue={0.38}\n defaultLabel=\"Checkout conversion\"\n formatOptions={{ style: \"percent\", maximumFractionDigits: 0 }}\n totalNotches={50}\n spacing={0}\n notchCornerRadius={3}\n inactiveFillOpacity={0.4}\n />\n <GaugeChart\n label=\"Refund rate against the 2% limit\"\n orientation=\"linear\"\n value={72}\n centerValue={1.44}\n defaultLabel=\"Refund rate, limit 2%\"\n suffix=\"%\"\n formatOptions={{ maximumFractionDigits: 2 }}\n labelPlacement=\"bottom\"\n labelAlign=\"end\"\n totalNotches={50}\n spacing={0}\n notchCornerRadius={3}\n activeFill=\"var(--chart-2)\"\n inactiveFillOpacity={0.4}\n />\n </div>\n );\n}"
|
|
4190
|
+
"code": "\"use client\";\n\nimport { GaugeChart } from \"@dodopayments/ui/gauge-chart\";\n\nexport default function GaugeChartLinear() {\n return (\n <div className=\"flex w-full flex-col gap-8\">\n <GaugeChart\n label=\"Checkout conversion this week\"\n orientation=\"linear\"\n value={38}\n centerValue={0.38}\n defaultLabel=\"Checkout conversion\"\n formatOptions={{ style: \"percent\", maximumFractionDigits: 0 }}\n totalNotches={50}\n spacing={0}\n notchCornerRadius={3}\n inactiveFillOpacity={0.4}\n />\n <GaugeChart\n label=\"Refund rate against the 2% limit\"\n orientation=\"linear\"\n value={72}\n centerValue={1.44}\n defaultLabel=\"Refund rate, limit 2%\"\n suffix=\"%\"\n formatOptions={{ maximumFractionDigits: 2 }}\n labelPlacement=\"bottom\"\n labelAlign=\"end\"\n totalNotches={50}\n spacing={0}\n notchCornerRadius={3}\n activeFill=\"var(--chart-solid-2)\"\n inactiveFillOpacity={0.4}\n />\n </div>\n );\n}"
|
|
4160
4191
|
}
|
|
4161
4192
|
],
|
|
4162
4193
|
"docsUrl": "/charts#gauge-chart"
|
|
@@ -4166,7 +4197,7 @@
|
|
|
4166
4197
|
"title": "Funnel Chart",
|
|
4167
4198
|
"category": "Charts",
|
|
4168
4199
|
"status": "stable",
|
|
4169
|
-
"description": "Drop-off through the stages of a flow (visited, started checkout, paid), on the bklit\n`FunnelChart` primitive. `data` is a list of `{ label, value, displayValue?, color?, gradient? }`,\nfirst stage first; each segment is sized as a share of the first stage and shows its value, a\npercentage chip and the stage label, and each boundary shows the step conversion (\"→ 54%\") from the\nstage before. Segments
|
|
4200
|
+
"description": "Drop-off through the stages of a flow (visited, started checkout, paid), on the bklit\n`FunnelChart` primitive. `data` is a list of `{ label, value, displayValue?, color?, gradient? }`,\nfirst stage first; each segment is sized as a share of the first stage and shows its value, a\npercentage chip and the stage label, and each boundary shows the step conversion (\"→ 54%\") from the\nstage before. Segments are solid by default: a full-colour core inside faint halo bands (`layers` rings);\n`variant=\"tint\"` gives the wash of the tint look (20% with a solid 2px edge on the outer sides). Each stage takes the\nnext palette colour unless `color` sets one. Segments grow in with a stagger on mount; hovering one dims\nthe others. `orientation=\"vertical\"` stacks the stages top to bottom; `grid` adds background bands\nand divider lines. Height comes from the aspect ratio unless a class sets it. It has no loading\nstate and renders an empty frame when `data` is empty.",
|
|
4170
4201
|
"importPath": "@dodopayments/ui/funnel-chart",
|
|
4171
4202
|
"exports": [
|
|
4172
4203
|
"FunnelChart",
|
|
@@ -4177,7 +4208,7 @@
|
|
|
4177
4208
|
"parts": [
|
|
4178
4209
|
{
|
|
4179
4210
|
"name": "FunnelChart",
|
|
4180
|
-
"description": "Drop-off through the stages of a flow (visited, started checkout, paid), on the bklit\n`FunnelChart` primitive. `data` is a list of `{ label, value, displayValue?, color?, gradient? }`,\nfirst stage first; each segment is sized as a share of the first stage and shows its value, a\npercentage chip and the stage label, and each boundary shows the step conversion (\"→ 54%\") from the\nstage before. Segments
|
|
4211
|
+
"description": "Drop-off through the stages of a flow (visited, started checkout, paid), on the bklit\n`FunnelChart` primitive. `data` is a list of `{ label, value, displayValue?, color?, gradient? }`,\nfirst stage first; each segment is sized as a share of the first stage and shows its value, a\npercentage chip and the stage label, and each boundary shows the step conversion (\"→ 54%\") from the\nstage before. Segments are solid by default: a full-colour core inside faint halo bands (`layers` rings);\n`variant=\"tint\"` gives the wash of the tint look (20% with a solid 2px edge on the outer sides). Each stage takes the\nnext palette colour unless `color` sets one. Segments grow in with a stagger on mount; hovering one dims\nthe others. `orientation=\"vertical\"` stacks the stages top to bottom; `grid` adds background bands\nand divider lines. Height comes from the aspect ratio unless a class sets it. It has no loading\nstate and renders an empty frame when `data` is empty.",
|
|
4181
4212
|
"props": [
|
|
4182
4213
|
{
|
|
4183
4214
|
"name": "data",
|
|
@@ -4204,7 +4235,7 @@
|
|
|
4204
4235
|
"name": "color",
|
|
4205
4236
|
"type": "string",
|
|
4206
4237
|
"required": false,
|
|
4207
|
-
"description": "",
|
|
4238
|
+
"description": "One colour for every stage. Without it, each stage takes the next palette colour: `--chart-solid-1` to\n`--chart-solid-3` (the bar colours), then `--chart-4` and `--chart-5`, repeated.",
|
|
4208
4239
|
"source": "dodo"
|
|
4209
4240
|
},
|
|
4210
4241
|
{
|
|
@@ -4295,7 +4326,7 @@
|
|
|
4295
4326
|
"name": "layers",
|
|
4296
4327
|
"type": "number",
|
|
4297
4328
|
"required": false,
|
|
4298
|
-
"description": "
|
|
4329
|
+
"description": "Rings of the `\"solid\"` look: the core plus `layers - 1` halo bands. Default 3",
|
|
4299
4330
|
"source": "dodo"
|
|
4300
4331
|
},
|
|
4301
4332
|
{
|
|
@@ -4358,7 +4389,7 @@
|
|
|
4358
4389
|
"name": "variant",
|
|
4359
4390
|
"type": "\"tint\" | \"solid\"",
|
|
4360
4391
|
"required": false,
|
|
4361
|
-
"description": "`\"
|
|
4392
|
+
"description": "`\"solid\"`: a full-colour core inside `layers - 1` faint halo bands, as the bar, pie and ring\ncharts. `\"tint\"`: each segment an opaque 20% wash of its colour (mixed into the card) with a solid\n2px edge along its outer sides. A `renderPattern` fill stays solid. Default: \"solid\"",
|
|
4362
4393
|
"source": "dodo"
|
|
4363
4394
|
}
|
|
4364
4395
|
]
|
|
@@ -4371,11 +4402,11 @@
|
|
|
4371
4402
|
},
|
|
4372
4403
|
{
|
|
4373
4404
|
"name": "funnel-chart/colors",
|
|
4374
|
-
"code": "\"use client\";\n\nimport { FunnelChart, type FunnelStage } from \"@dodopayments/ui/funnel-chart\";\n\nconst compact = new Intl.NumberFormat(\"en-US\", { notation: \"compact\" });\n\n// Payouts through review: each stage has its own colour, the last one a gradient.\nconst payouts: FunnelStage[] = [\n { label: \"Requested\", value: 1_240, color: \"var(--chart-
|
|
4405
|
+
"code": "\"use client\";\n\nimport { FunnelChart, type FunnelStage } from \"@dodopayments/ui/funnel-chart\";\n\nconst compact = new Intl.NumberFormat(\"en-US\", { notation: \"compact\" });\n\n// Payouts through review: each stage has its own colour, the last one a gradient.\nconst payouts: FunnelStage[] = [\n { label: \"Requested\", value: 1_240, color: \"var(--chart-solid-2)\" },\n { label: \"Verified\", value: 1_090, color: \"var(--chart-solid-3)\" },\n { label: \"Approved\", value: 1_010, color: \"var(--chart-5)\" },\n {\n label: \"Paid out\",\n value: 980,\n gradient: [\n { offset: 0, color: \"var(--chart-solid-3)\" },\n { offset: 1, color: \"var(--chart-5)\" },\n ],\n },\n];\n\nexport default function FunnelChartColors() {\n return (\n <FunnelChart\n data={payouts}\n label=\"Payouts through review, this month\"\n formatValue={(value) => compact.format(value)}\n formatPercentage={(pct) => `${pct.toFixed(1)}%`}\n />\n );\n}"
|
|
4375
4406
|
},
|
|
4376
4407
|
{
|
|
4377
4408
|
"name": "funnel-chart/vertical",
|
|
4378
|
-
"code": "\"use client\";\n\nimport { FunnelChart, type FunnelStage } from \"@dodopayments/ui/funnel-chart\";\n\n// Subscription trial funnel for September.\nconst trials: FunnelStage[] = [\n { label: \"Trials started\", value: 3_200 },\n { label: \"Added a card\", value: 2_150 },\n { label: \"First invoice\", value: 1_480 },\n { label: \"Renewed\", value: 1_120 },\n { label: \"Upgraded\", value: 310 },\n];\n\nexport default function FunnelChartVertical() {\n return (\n <div className=\"mx-auto w-full max-w-md\">\n <FunnelChart\n data={trials}\n label=\"Trial to paid funnel, September\"\n orientation=\"vertical\"\n color=\"var(--chart-2)\"\n edges=\"straight\"\n grid\n />\n </div>\n );\n}"
|
|
4409
|
+
"code": "\"use client\";\n\nimport { FunnelChart, type FunnelStage } from \"@dodopayments/ui/funnel-chart\";\n\n// Subscription trial funnel for September.\nconst trials: FunnelStage[] = [\n { label: \"Trials started\", value: 3_200 },\n { label: \"Added a card\", value: 2_150 },\n { label: \"First invoice\", value: 1_480 },\n { label: \"Renewed\", value: 1_120 },\n { label: \"Upgraded\", value: 310 },\n];\n\nexport default function FunnelChartVertical() {\n return (\n <div className=\"mx-auto w-full max-w-md\">\n <FunnelChart\n data={trials}\n label=\"Trial to paid funnel, September\"\n orientation=\"vertical\"\n color=\"var(--chart-solid-2)\"\n edges=\"straight\"\n grid\n />\n </div>\n );\n}"
|
|
4379
4410
|
}
|
|
4380
4411
|
],
|
|
4381
4412
|
"docsUrl": "/charts#funnel-chart"
|
|
@@ -4577,7 +4608,7 @@
|
|
|
4577
4608
|
"name": "variant",
|
|
4578
4609
|
"type": "\"tint\" | \"solid\"",
|
|
4579
4610
|
"required": false,
|
|
4580
|
-
"description": "`\"
|
|
4611
|
+
"description": "`\"solid\"`: the full colour, as the bars. `\"tint\"`: an opaque 20% wash of the colour (mixed into the card) with a\nsolid 3px arc on the outer rim. A gradient or pattern `fill` stays solid. Default: \"solid\"",
|
|
4581
4612
|
"source": "dodo"
|
|
4582
4613
|
}
|
|
4583
4614
|
]
|
|
@@ -4662,7 +4693,7 @@
|
|
|
4662
4693
|
},
|
|
4663
4694
|
{
|
|
4664
4695
|
"name": "pie-chart/donut",
|
|
4665
|
-
"code": "\"use client\";\n\nimport {\n Legend,\n type LegendItemData,\n LegendItem,\n LegendLabel,\n LegendMarker,\n LegendValue,\n} from \"@dodopayments/ui/chart-legend\";\nimport { PieCenter, PieChart, type PieData, PieSlice } from \"@dodopayments/ui/pie-chart\";\nimport { useState } from \"react\";\n\n// Gross revenue by payment method, September 2026, in USD.\nconst revenue: PieData[] = [\n { label: \"Cards\", value: 62400 },\n { label: \"UPI\", value: 24100 },\n { label: \"Wallets\", value: 13800 },\n { label: \"Bank transfer\", value: 8600 },\n { label: \"BNPL\", value: 4100 },\n];\n\nconst total = revenue.reduce((sum, row) => sum + row.value, 0);\nconst usd = new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency: \"USD\", maximumFractionDigits: 0 });\n\nconst legendItems: LegendItemData[] = revenue.map((row, index) => ({\n label: row.label,\n value: row.value,\n maxValue: total,\n color:
|
|
4696
|
+
"code": "\"use client\";\n\nimport {\n Legend,\n type LegendItemData,\n LegendItem,\n LegendLabel,\n LegendMarker,\n LegendValue,\n} from \"@dodopayments/ui/chart-legend\";\nimport { PieCenter, PieChart, type PieData, PieSlice } from \"@dodopayments/ui/pie-chart\";\nimport { useState } from \"react\";\n\n// Gross revenue by payment method, September 2026, in USD.\nconst revenue: PieData[] = [\n { label: \"Cards\", value: 62400 },\n { label: \"UPI\", value: 24100 },\n { label: \"Wallets\", value: 13800 },\n { label: \"Bank transfer\", value: 8600 },\n { label: \"BNPL\", value: 4100 },\n];\n\nconst total = revenue.reduce((sum, row) => sum + row.value, 0);\nconst usd = new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency: \"USD\", maximumFractionDigits: 0 });\n\n// The pie's default slice colours, in order: the bars' solid series, then the chart palette.\nconst sliceColors = [\n \"var(--chart-solid-1)\",\n \"var(--chart-solid-2)\",\n \"var(--chart-solid-3)\",\n \"var(--chart-4)\",\n \"var(--chart-5)\",\n];\n\nconst legendItems: LegendItemData[] = revenue.map((row, index) => ({\n label: row.label,\n value: row.value,\n maxValue: total,\n color: sliceColors[index % sliceColors.length] ?? \"var(--chart-solid-1)\",\n}));\n\nexport default function PieChartDonut() {\n const [hoveredIndex, setHoveredIndex] = useState<number | null>(null);\n\n return (\n <div className=\"flex w-full flex-col items-center gap-6 @xl:flex-row @xl:gap-10\">\n <div className=\"w-full max-w-72 flex-1\">\n <PieChart\n data={revenue}\n label=\"Gross revenue by payment method, September 2026\"\n innerRadius={80}\n padAngle={0.02}\n cornerRadius={4}\n hoveredIndex={hoveredIndex}\n onHoverChange={setHoveredIndex}\n >\n {revenue.map((row, index) => (\n <PieSlice key={row.label} index={index} />\n ))}\n <PieCenter defaultLabel=\"Gross revenue\" prefix=\"$\" formatOptions={{ notation: \"compact\" }} />\n </PieChart>\n </div>\n <Legend\n items={legendItems}\n hoveredIndex={hoveredIndex}\n onHoverChange={setHoveredIndex}\n title=\"Payment method\"\n className=\"w-full max-w-64\"\n >\n <LegendItem className=\"flex items-center gap-3\">\n <LegendMarker />\n <LegendLabel className=\"flex-1\" />\n <LegendValue formatValue={(value) => usd.format(value)} showPercentage />\n </LegendItem>\n </Legend>\n </div>\n );\n}"
|
|
4666
4697
|
},
|
|
4667
4698
|
{
|
|
4668
4699
|
"name": "pie-chart/grow",
|
|
@@ -4804,7 +4835,7 @@
|
|
|
4804
4835
|
},
|
|
4805
4836
|
{
|
|
4806
4837
|
"name": "Ring",
|
|
4807
|
-
"description": "One ring of a `RingChart`: a grey track and a progress arc for the data row at `index` (by default a
|
|
4838
|
+
"description": "One ring of a `RingChart`: a grey track and a progress arc for the data row at `index` (by default a `--border`\ntrack and a solid arc, as the bars; `variant=\"tint\"` for a light `--muted` track and a 25% wash of the ring's colour\nwith a solid end cap). The\ntrack scales in, then the arc fills. On hover the ring grows a little, the outer rings move out and\nthe other rings fade; the hover index drives `RingCenter` and a linked `Legend`.",
|
|
4808
4839
|
"props": [
|
|
4809
4840
|
{
|
|
4810
4841
|
"name": "index",
|
|
@@ -4824,7 +4855,7 @@
|
|
|
4824
4855
|
"name": "color",
|
|
4825
4856
|
"type": "string",
|
|
4826
4857
|
"required": false,
|
|
4827
|
-
"description": "Color override. Falls back to the row's `color`, then to `--chart-1..5`.",
|
|
4858
|
+
"description": "Color override. Falls back to the row's `color`, then to `--chart-solid-1..3` and `--chart-4..5`.",
|
|
4828
4859
|
"source": "dodo"
|
|
4829
4860
|
},
|
|
4830
4861
|
{
|
|
@@ -4845,7 +4876,7 @@
|
|
|
4845
4876
|
"name": "variant",
|
|
4846
4877
|
"type": "\"tint\" | \"solid\"",
|
|
4847
4878
|
"required": false,
|
|
4848
|
-
"description": "`\"
|
|
4879
|
+
"description": "`\"solid\"`: a `--border` track and a solid arc, as the bars. `\"tint\"`: a light grey `--muted` track for what is not\ncovered yet, the progress as a 25% wash of the ring's colour (mixed into the card) and a solid 3px cap where it\nends.\nDefault: \"solid\"",
|
|
4849
4880
|
"source": "dodo"
|
|
4850
4881
|
}
|
|
4851
4882
|
]
|
|
@@ -4930,7 +4961,7 @@
|
|
|
4930
4961
|
},
|
|
4931
4962
|
{
|
|
4932
4963
|
"name": "ring-chart/legend",
|
|
4933
|
-
"code": "\"use client\";\n\nimport {\n Legend,\n type LegendItemData,\n LegendItem,\n LegendLabel,\n LegendMarker,\n LegendProgress,\n LegendValue,\n} from \"@dodopayments/ui/chart-legend\";\nimport { Ring, RingCenter, RingChart, type RingData } from \"@dodopayments/ui/ring-chart\";\nimport { useState } from \"react\";\n\n// Revenue by customer country against each country's Q3 2026 target, in USD.\nconst countries: RingData[] = [\n { label: \"United States\", value: 84200, maxValue: 100000 },\n { label: \"India\", value: 51600, maxValue: 60000 },\n { label: \"Germany\", value: 23900, maxValue: 40000 },\n { label: \"Brazil\", value: 11300, maxValue: 25000 },\n];\n\nconst usd = new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency: \"USD\", notation: \"compact\" });\n\nconst legendItems: LegendItemData[] = countries.map((row, index) => ({\n label: row.label,\n value: row.value,\n maxValue: row.maxValue,\n color:
|
|
4964
|
+
"code": "\"use client\";\n\nimport {\n Legend,\n type LegendItemData,\n LegendItem,\n LegendLabel,\n LegendMarker,\n LegendProgress,\n LegendValue,\n} from \"@dodopayments/ui/chart-legend\";\nimport { Ring, RingCenter, RingChart, type RingData } from \"@dodopayments/ui/ring-chart\";\nimport { useState } from \"react\";\n\n// Revenue by customer country against each country's Q3 2026 target, in USD.\nconst countries: RingData[] = [\n { label: \"United States\", value: 84200, maxValue: 100000 },\n { label: \"India\", value: 51600, maxValue: 60000 },\n { label: \"Germany\", value: 23900, maxValue: 40000 },\n { label: \"Brazil\", value: 11300, maxValue: 25000 },\n];\n\nconst usd = new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency: \"USD\", notation: \"compact\" });\n\n// The ring's default colours, in order: the bars' solid series, then the chart palette.\nconst ringColors = [\n \"var(--chart-solid-1)\",\n \"var(--chart-solid-2)\",\n \"var(--chart-solid-3)\",\n \"var(--chart-4)\",\n \"var(--chart-5)\",\n];\n\nconst legendItems: LegendItemData[] = countries.map((row, index) => ({\n label: row.label,\n value: row.value,\n maxValue: row.maxValue,\n color: ringColors[index % ringColors.length] ?? \"var(--chart-solid-1)\",\n}));\n\nexport default function RingChartLegend() {\n const [hoveredIndex, setHoveredIndex] = useState<number | null>(null);\n\n return (\n <div className=\"flex w-full flex-col items-center gap-6 @xl:flex-row @xl:gap-10\">\n <div className=\"w-full max-w-72 flex-1\">\n <RingChart\n data={countries}\n label=\"Revenue against target by country, Q3 2026\"\n hoveredIndex={hoveredIndex}\n onHoverChange={setHoveredIndex}\n >\n {countries.map((row, index) => (\n <Ring key={row.label} index={index} />\n ))}\n <RingCenter defaultLabel=\"Q3 revenue\" prefix=\"$\" formatOptions={{ notation: \"compact\" }} />\n </RingChart>\n </div>\n <Legend\n items={legendItems}\n hoveredIndex={hoveredIndex}\n onHoverChange={setHoveredIndex}\n title=\"Against target\"\n className=\"w-full max-w-64\"\n >\n <LegendItem className=\"grid grid-cols-[auto_1fr_auto] items-center gap-x-3 gap-y-1\">\n <LegendMarker />\n <LegendLabel />\n <LegendValue formatValue={(value) => usd.format(value)} showPercentage />\n <div className=\"col-span-full\">\n <LegendProgress />\n </div>\n </LegendItem>\n </Legend>\n </div>\n );\n}"
|
|
4934
4965
|
}
|
|
4935
4966
|
],
|
|
4936
4967
|
"docsUrl": "/charts#ring-chart"
|
|
@@ -4940,7 +4971,7 @@
|
|
|
4940
4971
|
"title": "Sunburst Chart",
|
|
4941
4972
|
"category": "Charts",
|
|
4942
4973
|
"status": "stable",
|
|
4943
|
-
"description": "A hierarchy as rings around a center, on the bklit `SunburstChart` primitive. Compose it from\nchildren: one `SunburstSegment` per arc of `buildArcs(data).arcs`, plus `SunburstCenter` (the hub:\nthe focused total with `formatValue`, and a click zooms out), `SunburstLabels`, `SunburstBreadcrumb`\n(drill-down path, above), `SunburstLegend` (branches with value and share, beside the rings) and\n`SunburstHint` (live hint, below). `data` is a `SunburstNode` tree; leaves carry `value`. Segments are\
|
|
4974
|
+
"description": "A hierarchy as rings around a center, on the bklit `SunburstChart` primitive. Compose it from\nchildren: one `SunburstSegment` per arc of `buildArcs(data).arcs`, plus `SunburstCenter` (the hub:\nthe focused total with `formatValue`, and a click zooms out), `SunburstLabels`, `SunburstBreadcrumb`\n(drill-down path, above), `SunburstLegend` (branches with value and share, beside the rings) and\n`SunburstHint` (live hint, below). `data` is a `SunburstNode` tree; leaves carry `value`. Segments are\nsolid by default (full colour, fading by ring), like the bar and pie charts; `variant=\"tint\"` on\n`SunburstSegment` gives the wash with a solid rim. Click a segment with children to zoom in.\nThe SVG is decorative and pointer-only: `SunburstLegend` rows zoom in and `SunburstBreadcrumb` buttons\nzoom out by keyboard, so keep both in the chart when focus can change. Rings reveal on mount;\nthere is no loading or empty state. `size` (default 520) is the largest diameter; the chart never\ngets wider than its container.",
|
|
4944
4975
|
"importPath": "@dodopayments/ui/sunburst-chart",
|
|
4945
4976
|
"exports": [
|
|
4946
4977
|
"SunburstArc",
|
|
@@ -4968,7 +4999,7 @@
|
|
|
4968
4999
|
"parts": [
|
|
4969
5000
|
{
|
|
4970
5001
|
"name": "SunburstChart",
|
|
4971
|
-
"description": "A hierarchy as rings around a center, on the bklit `SunburstChart` primitive. Compose it from\nchildren: one `SunburstSegment` per arc of `buildArcs(data).arcs`, plus `SunburstCenter` (the hub:\nthe focused total with `formatValue`, and a click zooms out), `SunburstLabels`, `SunburstBreadcrumb`\n(drill-down path, above), `SunburstLegend` (branches with value and share, beside the rings) and\n`SunburstHint` (live hint, below). `data` is a `SunburstNode` tree; leaves carry `value`. Segments are\
|
|
5002
|
+
"description": "A hierarchy as rings around a center, on the bklit `SunburstChart` primitive. Compose it from\nchildren: one `SunburstSegment` per arc of `buildArcs(data).arcs`, plus `SunburstCenter` (the hub:\nthe focused total with `formatValue`, and a click zooms out), `SunburstLabels`, `SunburstBreadcrumb`\n(drill-down path, above), `SunburstLegend` (branches with value and share, beside the rings) and\n`SunburstHint` (live hint, below). `data` is a `SunburstNode` tree; leaves carry `value`. Segments are\nsolid by default (full colour, fading by ring), like the bar and pie charts; `variant=\"tint\"` on\n`SunburstSegment` gives the wash with a solid rim. Click a segment with children to zoom in.\nThe SVG is decorative and pointer-only: `SunburstLegend` rows zoom in and `SunburstBreadcrumb` buttons\nzoom out by keyboard, so keep both in the chart when focus can change. Rings reveal on mount;\nthere is no loading or empty state. `size` (default 520) is the largest diameter; the chart never\ngets wider than its container.",
|
|
4972
5003
|
"props": [
|
|
4973
5004
|
{
|
|
4974
5005
|
"name": "data",
|
|
@@ -5099,7 +5130,7 @@
|
|
|
5099
5130
|
"name": "variant",
|
|
5100
5131
|
"type": "\"tint\" | \"solid\"",
|
|
5101
5132
|
"required": false,
|
|
5102
|
-
"description": "`\"
|
|
5133
|
+
"description": "`\"solid\"`: the full colour, fading by ring, as the bar, pie and ring charts. `\"tint\"`: the branch colour washed 20%\ninto the card on every ring (35% while hovered) with a solid 3px rim on the outer edge. A gradient or pattern\n`fill` stays solid. Default: \"solid\"",
|
|
5103
5134
|
"source": "dodo"
|
|
5104
5135
|
}
|
|
5105
5136
|
]
|
|
@@ -5174,7 +5205,7 @@
|
|
|
5174
5205
|
},
|
|
5175
5206
|
{
|
|
5176
5207
|
"name": "SunburstLegend",
|
|
5177
|
-
"description": "The branches of a `SunburstChart` as a list beside it: a marker in the
|
|
5208
|
+
"description": "The branches of a `SunburstChart` as a list beside it: a marker in the branch colour, the name, the value and its share.\nIt follows the drill-down (the focused node's children) and the hover, both ways. A row with children is a button\nthat zooms in, so it is also the keyboard way into the hierarchy. Put it inside `SunburstChart`; the chart places it\nbeside the rings, or under them when there is no room.",
|
|
5178
5209
|
"props": [
|
|
5179
5210
|
{
|
|
5180
5211
|
"name": "className",
|
|
@@ -5197,6 +5228,13 @@
|
|
|
5197
5228
|
"description": "Show each row's share of the focused node. Default: true",
|
|
5198
5229
|
"source": "dodo"
|
|
5199
5230
|
},
|
|
5231
|
+
{
|
|
5232
|
+
"name": "variant",
|
|
5233
|
+
"type": "\"tint\" | \"solid\"",
|
|
5234
|
+
"required": false,
|
|
5235
|
+
"description": "The marker, to match the segments: `\"solid\"` fills it with the branch colour; `\"tint\"` is a 20% wash with a solid\n2px top edge. Default: \"solid\"",
|
|
5236
|
+
"source": "dodo"
|
|
5237
|
+
},
|
|
5200
5238
|
{
|
|
5201
5239
|
"name": "zoomInLabel",
|
|
5202
5240
|
"type": "string",
|
|
@@ -6086,7 +6124,7 @@
|
|
|
6086
6124
|
"title": "Sankey Chart",
|
|
6087
6125
|
"category": "Charts",
|
|
6088
6126
|
"status": "stable",
|
|
6089
|
-
"description": "A Sankey diagram on the bklit `SankeyChart` primitive (visx, d3-sankey): flows between nodes, each\nband as wide as its value. Use it to show where an amount goes, e.g. gross volume into fees,\nrefunds and payouts. Compose it from children: `SankeyLink` (the bands), `SankeyNode` (the bars\nand their labels) and `SankeyTooltip`. `data` is `{ nodes, links }`: each node has a `name`, each\nlink a `source` and `target` node index and a `value`. Nodes and bands grow in on mount over\n`animationDuration`. Nodes and bands
|
|
6127
|
+
"description": "A Sankey diagram on the bklit `SankeyChart` primitive (visx, d3-sankey): flows between nodes, each\nband as wide as its value. Use it to show where an amount goes, e.g. gross volume into fees,\nrefunds and payouts. Compose it from children: `SankeyLink` (the bands), `SankeyNode` (the bars\nand their labels) and `SankeyTooltip`. `data` is `{ nodes, links }`: each node has a `name`, each\nlink a `source` and `target` node index and a `value`. Nodes and bands grow in on mount over\n`animationDuration`. Nodes and bands are solid by default: nodes in full colour, each band its source node's\ncolour at 35% opacity, so crossing bands blend; set `useGradient` on `SankeyLink` for a source-to-target gradient.\n`variant=\"tint\"` on `SankeyLink` / `SankeyNode` gives the tint look of the other charts (nodes a 20% wash with a\nsolid edge on their label side, bands a 12% wash, 24% while highlighted). The chart is as wide as its container; height comes from `aspectRatio`\n(default `\"2 / 1\"`). The default `margin` keeps 180px on each side for node labels.",
|
|
6090
6128
|
"importPath": "@dodopayments/ui/sankey-chart",
|
|
6091
6129
|
"exports": [
|
|
6092
6130
|
"SankeyChart",
|
|
@@ -6108,7 +6146,7 @@
|
|
|
6108
6146
|
"parts": [
|
|
6109
6147
|
{
|
|
6110
6148
|
"name": "SankeyChart",
|
|
6111
|
-
"description": "A Sankey diagram on the bklit `SankeyChart` primitive (visx, d3-sankey): flows between nodes, each\nband as wide as its value. Use it to show where an amount goes, e.g. gross volume into fees,\nrefunds and payouts. Compose it from children: `SankeyLink` (the bands), `SankeyNode` (the bars\nand their labels) and `SankeyTooltip`. `data` is `{ nodes, links }`: each node has a `name`, each\nlink a `source` and `target` node index and a `value`. Nodes and bands grow in on mount over\n`animationDuration`. Nodes and bands
|
|
6149
|
+
"description": "A Sankey diagram on the bklit `SankeyChart` primitive (visx, d3-sankey): flows between nodes, each\nband as wide as its value. Use it to show where an amount goes, e.g. gross volume into fees,\nrefunds and payouts. Compose it from children: `SankeyLink` (the bands), `SankeyNode` (the bars\nand their labels) and `SankeyTooltip`. `data` is `{ nodes, links }`: each node has a `name`, each\nlink a `source` and `target` node index and a `value`. Nodes and bands grow in on mount over\n`animationDuration`. Nodes and bands are solid by default: nodes in full colour, each band its source node's\ncolour at 35% opacity, so crossing bands blend; set `useGradient` on `SankeyLink` for a source-to-target gradient.\n`variant=\"tint\"` on `SankeyLink` / `SankeyNode` gives the tint look of the other charts (nodes a 20% wash with a\nsolid edge on their label side, bands a 12% wash, 24% while highlighted). The chart is as wide as its container; height comes from `aspectRatio`\n(default `\"2 / 1\"`). The default `margin` keeps 180px on each side for node labels.",
|
|
6112
6150
|
"props": [
|
|
6113
6151
|
{
|
|
6114
6152
|
"name": "data",
|
|
@@ -6198,7 +6236,7 @@
|
|
|
6198
6236
|
},
|
|
6199
6237
|
{
|
|
6200
6238
|
"name": "SankeyLink",
|
|
6201
|
-
"description": "The flow bands of a Sankey diagram, one per link, drawn from left to right on mount. By default\n(`variant=\"
|
|
6239
|
+
"description": "The flow bands of a Sankey diagram, one per link, drawn from left to right on mount. By default\n(`variant=\"solid\"`) each band is its source node's colour at 35% opacity; `useGradient` runs it\nfrom the source colour to the target colour, and `variant=\"tint\"` draws an opaque soft wash. Hovering a band highlights it and feeds\n`SankeyTooltip`.",
|
|
6202
6240
|
"props": [
|
|
6203
6241
|
{
|
|
6204
6242
|
"name": "fadedOpacity",
|
|
@@ -6239,35 +6277,35 @@
|
|
|
6239
6277
|
"name": "stroke",
|
|
6240
6278
|
"type": "string",
|
|
6241
6279
|
"required": false,
|
|
6242
|
-
"description": "Stroke color for
|
|
6280
|
+
"description": "Stroke color for every link (overrides the source colour and the gradient).",
|
|
6243
6281
|
"source": "dodo"
|
|
6244
6282
|
},
|
|
6245
6283
|
{
|
|
6246
6284
|
"name": "strokeOpacity",
|
|
6247
6285
|
"type": "number",
|
|
6248
6286
|
"required": false,
|
|
6249
|
-
"description": "Stroke opacity of the `\"solid\"` look. Default: 0.
|
|
6287
|
+
"description": "Stroke opacity of the `\"solid\"` look. Default: 0.35",
|
|
6250
6288
|
"source": "dodo"
|
|
6251
6289
|
},
|
|
6252
6290
|
{
|
|
6253
6291
|
"name": "useGradient",
|
|
6254
6292
|
"type": "boolean",
|
|
6255
6293
|
"required": false,
|
|
6256
|
-
"description": "
|
|
6294
|
+
"description": "`\"solid\"` only: a gradient from the source to the target colour instead of the source colour. Default: false",
|
|
6257
6295
|
"source": "dodo"
|
|
6258
6296
|
},
|
|
6259
6297
|
{
|
|
6260
6298
|
"name": "variant",
|
|
6261
6299
|
"type": "\"tint\" | \"solid\"",
|
|
6262
6300
|
"required": false,
|
|
6263
|
-
"description": "`\"
|
|
6301
|
+
"description": "`\"solid\"`: each band its source node's colour (or `stroke` / `getLinkColor`) at `strokeOpacity`,\ntranslucent so crossing bands blend, as the bar, pie and ring charts' solid look.\n`\"tint\"`: each band an opaque 12% wash of that colour, 24% while highlighted.\nA pattern from `getLinkPattern` stays as it is. Default: \"solid\"",
|
|
6264
6302
|
"source": "dodo"
|
|
6265
6303
|
}
|
|
6266
6304
|
]
|
|
6267
6305
|
},
|
|
6268
6306
|
{
|
|
6269
6307
|
"name": "SankeyNode",
|
|
6270
|
-
"description": "The node bars of a Sankey diagram, with a name and a value label beside each. Nodes on the left\nhalf label to their left, the others to their right. By default (`variant=\"
|
|
6308
|
+
"description": "The node bars of a Sankey diagram, with a name and a value label beside each. Nodes on the left\nhalf label to their left, the others to their right. By default (`variant=\"solid\"`) each node is\nits full colour; `variant=\"tint\"` draws a soft wash with a solid edge on its label side. Hovering a node highlights its links and\nfeeds `SankeyTooltip`.",
|
|
6271
6309
|
"props": [
|
|
6272
6310
|
{
|
|
6273
6311
|
"name": "fadedOpacity",
|
|
@@ -6280,7 +6318,7 @@
|
|
|
6280
6318
|
"name": "fill",
|
|
6281
6319
|
"type": "string",
|
|
6282
6320
|
"required": false,
|
|
6283
|
-
"description": "Fill color for
|
|
6321
|
+
"description": "Fill color for every node. Default: `--chart-solid-1` to `--chart-solid-3`, then `--chart-4` and `--chart-5`, by node",
|
|
6284
6322
|
"source": "dodo"
|
|
6285
6323
|
},
|
|
6286
6324
|
{
|
|
@@ -6329,7 +6367,7 @@
|
|
|
6329
6367
|
"name": "variant",
|
|
6330
6368
|
"type": "\"tint\" | \"solid\"",
|
|
6331
6369
|
"required": false,
|
|
6332
|
-
"description": "`\"
|
|
6370
|
+
"description": "`\"solid\"`: the full colour, as the bar, pie and ring charts. `\"tint\"`: an opaque 20% wash of the\ncolour with a solid 3px edge on its label side. Default: \"solid\"",
|
|
6333
6371
|
"source": "dodo"
|
|
6334
6372
|
}
|
|
6335
6373
|
]
|
|
@@ -6399,11 +6437,11 @@
|
|
|
6399
6437
|
"examples": [
|
|
6400
6438
|
{
|
|
6401
6439
|
"name": "sankey-chart/checkout",
|
|
6402
|
-
"code": "\"use client\";\n\nimport {\n type SankeyData,\n SankeyChart,\n SankeyLink,\n SankeyNode,\n SankeyTooltip,\n} from \"@dodopayments/ui/sankey-chart\";\n\n// Checkout sessions this week: how many paid, and with which method.\nconst data: SankeyData = {\n nodes: [\n { name: \"Checkouts\", category: \"source\" },\n { name: \"Paid\" },\n { name: \"Abandoned\" },\n { name: \"Failed\" },\n { name: \"Card\" },\n { name: \"UPI\" },\n { name: \"Wallet\" },\n ],\n links: [\n { source: 0, target: 1, value: 6_420 },\n { source: 0, target: 2, value: 2_310 },\n { source: 0, target: 3, value: 540 },\n { source: 1, target: 4, value: 3_880 },\n { source: 1, target: 5, value: 1_910 },\n { source: 1, target: 6, value: 630 },\n ],\n};\n\nexport default function SankeyChartCheckout() {\n return (\n <SankeyChart\n data={data}\n label=\"Checkout sessions by outcome and payment method, this week\"\n aspectRatio=\"16 / 9\"\n margin={{ top: 16, right: 96, bottom: 16, left: 96 }}\n >\n <SankeyLink stroke=\"var(--chart-1)\" />\n <SankeyNode fill=\"var(--chart-1)\" />\n <SankeyTooltip nodeValueLabel=\"Sessions\" linkValueLabel=\"Sessions\" />\n </SankeyChart>\n );\n}"
|
|
6440
|
+
"code": "\"use client\";\n\nimport {\n type SankeyData,\n SankeyChart,\n SankeyLink,\n SankeyNode,\n SankeyTooltip,\n} from \"@dodopayments/ui/sankey-chart\";\n\n// Checkout sessions this week: how many paid, and with which method.\nconst data: SankeyData = {\n nodes: [\n { name: \"Checkouts\", category: \"source\" },\n { name: \"Paid\" },\n { name: \"Abandoned\" },\n { name: \"Failed\" },\n { name: \"Card\" },\n { name: \"UPI\" },\n { name: \"Wallet\" },\n ],\n links: [\n { source: 0, target: 1, value: 6_420 },\n { source: 0, target: 2, value: 2_310 },\n { source: 0, target: 3, value: 540 },\n { source: 1, target: 4, value: 3_880 },\n { source: 1, target: 5, value: 1_910 },\n { source: 1, target: 6, value: 630 },\n ],\n};\n\nexport default function SankeyChartCheckout() {\n return (\n <SankeyChart\n data={data}\n label=\"Checkout sessions by outcome and payment method, this week\"\n aspectRatio=\"16 / 9\"\n margin={{ top: 16, right: 96, bottom: 16, left: 96 }}\n >\n <SankeyLink stroke=\"var(--chart-solid-1)\" />\n <SankeyNode fill=\"var(--chart-solid-1)\" />\n <SankeyTooltip nodeValueLabel=\"Sessions\" linkValueLabel=\"Sessions\" />\n </SankeyChart>\n );\n}"
|
|
6403
6441
|
},
|
|
6404
6442
|
{
|
|
6405
6443
|
"name": "sankey-chart/payment-flow",
|
|
6406
|
-
"code": "\"use client\";\n\nimport {\n type SankeyData,\n SankeyChart,\n SankeyLink,\n SankeyNode,\n SankeyTooltip,\n} from \"@dodopayments/ui/sankey-chart\";\n\n// Where September's gross volume went: fees and refunds out, then net payouts by currency.\nconst data: SankeyData = {\n nodes: [\n { name: \"Gross volume\", category: \"source\" },\n { name: \"Processing fees\" },\n { name: \"Refunds\" },\n { name: \"Net volume\" },\n { name: \"USD payouts\" },\n { name: \"EUR payouts\" },\n { name: \"GBP payouts\" },\n { name: \"INR payouts\" },\n ],\n links: [\n { source: 0, target: 1, value: 14_600 },\n { source: 0, target: 2, value: 9_800 },\n { source: 0, target: 3, value: 386_200 },\n { source: 3, target: 4, value: 211_400 },\n { source: 3, target: 5, value: 88_300 },\n { source: 3, target: 6, value: 51_900 },\n { source: 3, target: 7, value: 34_600 },\n ],\n};\n\nconst COLORS: Record<string, string> = {\n \"Gross volume\": \"var(--chart-1)\",\n \"Processing fees\": \"var(--muted-foreground)\",\n Refunds: \"var(--chart-negative)\",\n \"Net volume\": \"var(--chart-2)\",\n};\n\nconst nodeColor = (node: { name: string }) => COLORS[node.name] ?? \"var(--chart-3)\";\n\nconst usdCompact = new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n notation: \"compact\",\n maximumFractionDigits: 1,\n});\n\nexport default function SankeyChartPaymentFlow() {\n return (\n <SankeyChart\n data={data}\n label=\"Gross volume to net payouts by currency, September 2026\"\n aspectRatio=\"16 / 9\"\n margin={{ top: 16, right: 112, bottom: 16, left: 112 }}\n >\n <SankeyLink getNodeColor={nodeColor} />\n <SankeyNode getNodeColor={nodeColor} formatValue={(value) => usdCompact.format(value)} />\n <SankeyTooltip\n nodeValueLabel=\"Amount\"\n linkValueLabel=\"Amount\"\n formatValue={(value) => usdCompact.format(value)}\n />\n </SankeyChart>\n );\n}"
|
|
6444
|
+
"code": "\"use client\";\n\nimport {\n type SankeyData,\n SankeyChart,\n SankeyLink,\n SankeyNode,\n SankeyTooltip,\n} from \"@dodopayments/ui/sankey-chart\";\n\n// Where September's gross volume went: fees and refunds out, then net payouts by currency.\nconst data: SankeyData = {\n nodes: [\n { name: \"Gross volume\", category: \"source\" },\n { name: \"Processing fees\" },\n { name: \"Refunds\" },\n { name: \"Net volume\" },\n { name: \"USD payouts\" },\n { name: \"EUR payouts\" },\n { name: \"GBP payouts\" },\n { name: \"INR payouts\" },\n ],\n links: [\n { source: 0, target: 1, value: 14_600 },\n { source: 0, target: 2, value: 9_800 },\n { source: 0, target: 3, value: 386_200 },\n { source: 3, target: 4, value: 211_400 },\n { source: 3, target: 5, value: 88_300 },\n { source: 3, target: 6, value: 51_900 },\n { source: 3, target: 7, value: 34_600 },\n ],\n};\n\nconst COLORS: Record<string, string> = {\n \"Gross volume\": \"var(--chart-solid-1)\",\n \"Processing fees\": \"var(--muted-foreground)\",\n Refunds: \"var(--chart-negative)\",\n \"Net volume\": \"var(--chart-solid-2)\",\n};\n\nconst nodeColor = (node: { name: string }) => COLORS[node.name] ?? \"var(--chart-solid-3)\";\n\nconst usdCompact = new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n notation: \"compact\",\n maximumFractionDigits: 1,\n});\n\nexport default function SankeyChartPaymentFlow() {\n return (\n <SankeyChart\n data={data}\n label=\"Gross volume to net payouts by currency, September 2026\"\n aspectRatio=\"16 / 9\"\n margin={{ top: 16, right: 112, bottom: 16, left: 112 }}\n >\n <SankeyLink getNodeColor={nodeColor} />\n <SankeyNode getNodeColor={nodeColor} formatValue={(value) => usdCompact.format(value)} />\n <SankeyTooltip\n nodeValueLabel=\"Amount\"\n linkValueLabel=\"Amount\"\n formatValue={(value) => usdCompact.format(value)}\n />\n </SankeyChart>\n );\n}"
|
|
6407
6445
|
}
|
|
6408
6446
|
],
|
|
6409
6447
|
"docsUrl": "/charts#sankey-chart"
|
|
@@ -7204,7 +7242,7 @@
|
|
|
7204
7242
|
},
|
|
7205
7243
|
{
|
|
7206
7244
|
"name": "size",
|
|
7207
|
-
"type": "\"xs\" | \"default\" | \"lg\" | \"icon\" | \"icon-xs\" | \"icon-lg\"",
|
|
7245
|
+
"type": "\"xs\" | \"sm\" | \"default\" | \"lg\" | \"icon\" | \"icon-sm\" | \"icon-xs\" | \"icon-lg\"",
|
|
7208
7246
|
"required": false,
|
|
7209
7247
|
"description": "",
|
|
7210
7248
|
"source": "dodo",
|
|
@@ -7213,6 +7251,10 @@
|
|
|
7213
7251
|
"value": "xs",
|
|
7214
7252
|
"description": "28px tall (24px from `sm`), Figma `sm`: dense toolbars, strip actions and inline actions."
|
|
7215
7253
|
},
|
|
7254
|
+
{
|
|
7255
|
+
"value": "sm",
|
|
7256
|
+
"description": "32px tall (28px from `sm`): a compact action in a dense toolbar, a table filter row or next to an `sm` Input. Not a Figma size."
|
|
7257
|
+
},
|
|
7216
7258
|
{
|
|
7217
7259
|
"value": "default",
|
|
7218
7260
|
"description": "36px tall (32px from `sm`): a compact control when a design asks for one. Not a Figma size; prefer `lg`."
|
|
@@ -7225,6 +7267,10 @@
|
|
|
7225
7267
|
"value": "icon",
|
|
7226
7268
|
"description": "Square icon-only button at the default height. Requires `aria-label`."
|
|
7227
7269
|
},
|
|
7270
|
+
{
|
|
7271
|
+
"value": "icon-sm",
|
|
7272
|
+
"description": "Square icon-only button at `sm` height. Requires `aria-label`."
|
|
7273
|
+
},
|
|
7228
7274
|
{
|
|
7229
7275
|
"value": "icon-xs",
|
|
7230
7276
|
"description": "Square icon-only button at `xs` height. Requires `aria-label`."
|
|
@@ -7317,6 +7363,10 @@
|
|
|
7317
7363
|
"name": "button/as-link",
|
|
7318
7364
|
"code": "\"use client\";\n\nimport { buttonVariants } from \"@dodopayments/ui/button\";\nimport Link from \"next/link\";\n\nexport default function ButtonAsLink() {\n return (\n <Link href=\"#as-link\" className={buttonVariants({ variant: \"secondary\" })}>\n Styled Next.js link\n </Link>\n );\n}"
|
|
7319
7365
|
},
|
|
7366
|
+
{
|
|
7367
|
+
"name": "button/compact",
|
|
7368
|
+
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport { FilterIcon, PlusIcon } from \"@dodopayments/ui/icons\";\n\nexport default function ButtonCompact() {\n return (\n <div className=\"flex flex-wrap items-center gap-2\">\n <Button size=\"sm\" variant=\"secondary\" icon={<FilterIcon aria-hidden />} iconPlacement=\"left\">\n Filter\n </Button>\n <Button size=\"sm\">Export</Button>\n <Button size=\"icon-sm\" variant=\"secondary\" aria-label=\"Add a column\">\n <PlusIcon />\n </Button>\n </div>\n );\n}"
|
|
7369
|
+
},
|
|
7320
7370
|
{
|
|
7321
7371
|
"name": "button/copy-with-text",
|
|
7322
7372
|
"code": "\"use client\";\n\nimport { CopyButton } from \"@dodopayments/ui/copy-button\";\n\nexport default function CopyButtonWithText() {\n return (\n <>\n <CopyButton variant=\"secondary\" content=\"https://checkout.dodopayments.com/buy/pdt_2ZsQh0r6\">\n Copy link\n </CopyButton>\n <CopyButton variant=\"secondary\" size=\"sm\" content=\"sk_live_2ZsQh0r6UVSjAhEGg4Wq3\">\n Copy key\n </CopyButton>\n </>\n );\n}"
|
|
@@ -8458,19 +8508,19 @@
|
|
|
8458
8508
|
"examples": [
|
|
8459
8509
|
{
|
|
8460
8510
|
"name": "chart/brush",
|
|
8461
|
-
"code": "\"use client\";\n\nimport { Area, AreaChart } from \"@dodopayments/ui/area-chart\";\nimport { ChartBrush, ChartBrushLayout, ChartGrid, XAxis } from \"@dodopayments/ui/chart\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\n\n// Daily payout volume over 90 days. Drag the handles in the strip to zoom the main chart.\nconst data = Array.from({ length: 90 }, (_, day) => ({\n date: new Date(2026, 6, 1 + day),\n payouts: Math.round(12400 + 60 * day + 2100 * Math.sin(day / 6)),\n}));\n\nconst stripMargin = { top: 4, right: 16, bottom: 4, left: 16 };\n\nexport default function ChartBrushDemo() {\n return (\n <div className=\"h-96 w-full\">\n <ChartBrushLayout\n data={data}\n enabled\n height={72}\n brushStrip={(layout) => (\n <AreaChart\n data={data}\n label=\"Payout volume, July to September 2026, overview\"\n className=\"h-full\"\n margin={stripMargin}\n animationDuration={0}\n style={{ aspectRatio: \"unset\" }}\n >\n <Area dataKey=\"payouts\" fill=\"var(--chart-1)\" fillOpacity={0.15} animate={false} showHighlight={false} />\n <ChartBrush\n fadeOuterEdges\n initialSelection={layout.brushSelection ?? undefined}\n onSelectionChange={layout.onBrushSelectionChange}\n />\n </AreaChart>\n )}\n >\n {(layout) => (\n <AreaChart\n data={data}\n label=\"Payout volume, selected range\"\n className=\"h-full\"\n style={{ aspectRatio: \"unset\" }}\n xDomain={layout.xDomain}\n xDomainSlotCount={layout.xDomainSlotCount}\n tweenYDomainOnXDomainChange\n yDomainTween\n >\n <ChartGrid horizontal />\n <Area dataKey=\"payouts\" fill=\"var(--chart-1)\" />\n <XAxis />\n <ChartTooltip />\n </AreaChart>\n )}\n </ChartBrushLayout>\n </div>\n );\n}"
|
|
8511
|
+
"code": "\"use client\";\n\nimport { Area, AreaChart } from \"@dodopayments/ui/area-chart\";\nimport { ChartBrush, ChartBrushLayout, ChartGrid, XAxis } from \"@dodopayments/ui/chart\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\n\n// Daily payout volume over 90 days. Drag the handles in the strip to zoom the main chart.\nconst data = Array.from({ length: 90 }, (_, day) => ({\n date: new Date(2026, 6, 1 + day),\n payouts: Math.round(12400 + 60 * day + 2100 * Math.sin(day / 6)),\n}));\n\nconst stripMargin = { top: 4, right: 16, bottom: 4, left: 16 };\n\nexport default function ChartBrushDemo() {\n return (\n <div className=\"h-96 w-full\">\n <ChartBrushLayout\n data={data}\n enabled\n height={72}\n brushStrip={(layout) => (\n <AreaChart\n data={data}\n label=\"Payout volume, July to September 2026, overview\"\n className=\"h-full\"\n margin={stripMargin}\n animationDuration={0}\n style={{ aspectRatio: \"unset\" }}\n >\n <Area dataKey=\"payouts\" fill=\"var(--chart-solid-1)\" fillOpacity={0.15} animate={false} showHighlight={false} />\n <ChartBrush\n fadeOuterEdges\n initialSelection={layout.brushSelection ?? undefined}\n onSelectionChange={layout.onBrushSelectionChange}\n />\n </AreaChart>\n )}\n >\n {(layout) => (\n <AreaChart\n data={data}\n label=\"Payout volume, selected range\"\n className=\"h-full\"\n style={{ aspectRatio: \"unset\" }}\n xDomain={layout.xDomain}\n xDomainSlotCount={layout.xDomainSlotCount}\n tweenYDomainOnXDomainChange\n yDomainTween\n >\n <ChartGrid horizontal />\n <Area dataKey=\"payouts\" fill=\"var(--chart-solid-1)\" />\n <XAxis />\n <ChartTooltip />\n </AreaChart>\n )}\n </ChartBrushLayout>\n </div>\n );\n}"
|
|
8462
8512
|
},
|
|
8463
8513
|
{
|
|
8464
8514
|
"name": "chart/grid-axes",
|
|
8465
|
-
"code": "\"use client\";\n\nimport { Area, AreaChart } from \"@dodopayments/ui/area-chart\";\nimport { ChartGrid, XAxis, YAxis } from \"@dodopayments/ui/chart\";\n\n// Daily monthly recurring revenue (MRR) over 30 days of September 2026.\nconst data = Array.from({ length: 30 }, (_, day) => ({\n date: new Date(2026, 8, 1 + day),\n mrr: Math.round(48200 + 220 * day + 900 * Math.sin(day / 3)),\n}));\n\nconst usdCompact = new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n notation: \"compact\",\n maximumFractionDigits: 1,\n});\n\nexport default function ChartGridAxes() {\n return (\n <AreaChart data={data} label=\"Monthly recurring revenue, September 2026\" margin={{ left: 56 }}>\n <ChartGrid horizontal vertical />\n <Area dataKey=\"mrr\" fill=\"var(--chart-1)\" />\n <XAxis />\n <YAxis formatValue={(value) => usdCompact.format(value)} />\n </AreaChart>\n );\n}"
|
|
8515
|
+
"code": "\"use client\";\n\nimport { Area, AreaChart } from \"@dodopayments/ui/area-chart\";\nimport { ChartGrid, XAxis, YAxis } from \"@dodopayments/ui/chart\";\n\n// Daily monthly recurring revenue (MRR) over 30 days of September 2026.\nconst data = Array.from({ length: 30 }, (_, day) => ({\n date: new Date(2026, 8, 1 + day),\n mrr: Math.round(48200 + 220 * day + 900 * Math.sin(day / 3)),\n}));\n\nconst usdCompact = new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n notation: \"compact\",\n maximumFractionDigits: 1,\n});\n\nexport default function ChartGridAxes() {\n return (\n <AreaChart data={data} label=\"Monthly recurring revenue, September 2026\" margin={{ left: 56 }}>\n <ChartGrid horizontal vertical />\n <Area dataKey=\"mrr\" fill=\"var(--chart-solid-1)\" />\n <XAxis />\n <YAxis formatValue={(value) => usdCompact.format(value)} />\n </AreaChart>\n );\n}"
|
|
8466
8516
|
},
|
|
8467
8517
|
{
|
|
8468
8518
|
"name": "chart/markers",
|
|
8469
|
-
"code": "\"use client\";\n\nimport { Area, AreaChart } from \"@dodopayments/ui/area-chart\";\nimport {\n type ChartMarker,\n ChartGrid,\n ChartMarkers,\n MarkerTooltipContent,\n useActiveMarkers,\n XAxis,\n} from \"@dodopayments/ui/chart\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\nimport { BoltIcon, StarIcon, TriangleWarningIcon } from \"@dodopayments/ui/icons\";\n\n// Daily gross revenue, with the events that moved it.\nconst data = Array.from({ length: 30 }, (_, day) => ({\n date: new Date(2026, 8, 1 + day),\n revenue: Math.round(1800 + 45 * day + 380 * Math.sin(day / 4) + (day >= 18 ? 420 : 0)),\n}));\n\nconst markers: ChartMarker[] = [\n {\n date: new Date(2026, 8, 6),\n icon: <TriangleWarningIcon className=\"size-3.5\" />,\n title: \"Card network outage\",\n description: \"Visa payments failed for 40 minutes\",\n },\n {\n date: new Date(2026, 8, 12),\n icon: <StarIcon className=\"size-3.5\" />,\n title: \"Annual plan discount\",\n description: \"20% off annual plans for a week\",\n },\n {\n date: new Date(2026, 8, 19),\n icon: <BoltIcon className=\"size-3.5\" />,\n title: \"Pro plan launch\",\n description: \"New tier at $49 per month\",\n },\n];\n\nfunction MarkerRows() {\n const active = useActiveMarkers(markers);\n return active.length > 0 ? <MarkerTooltipContent markers={active} /> : null;\n}\n\nexport default function ChartMarkersDemo() {\n return (\n <AreaChart data={data} label=\"Gross revenue with product and incident events, September 2026\" margin={{ top: 40 }}>\n <ChartGrid horizontal />\n <Area dataKey=\"revenue\" fill=\"var(--chart-1)\" />\n <XAxis />\n <ChartMarkers items={markers} />\n <ChartTooltip>\n <MarkerRows />\n </ChartTooltip>\n </AreaChart>\n );\n}"
|
|
8519
|
+
"code": "\"use client\";\n\nimport { Area, AreaChart } from \"@dodopayments/ui/area-chart\";\nimport {\n type ChartMarker,\n ChartGrid,\n ChartMarkers,\n MarkerTooltipContent,\n useActiveMarkers,\n XAxis,\n} from \"@dodopayments/ui/chart\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\nimport { BoltIcon, StarIcon, TriangleWarningIcon } from \"@dodopayments/ui/icons\";\n\n// Daily gross revenue, with the events that moved it.\nconst data = Array.from({ length: 30 }, (_, day) => ({\n date: new Date(2026, 8, 1 + day),\n revenue: Math.round(1800 + 45 * day + 380 * Math.sin(day / 4) + (day >= 18 ? 420 : 0)),\n}));\n\nconst markers: ChartMarker[] = [\n {\n date: new Date(2026, 8, 6),\n icon: <TriangleWarningIcon className=\"size-3.5\" />,\n title: \"Card network outage\",\n description: \"Visa payments failed for 40 minutes\",\n },\n {\n date: new Date(2026, 8, 12),\n icon: <StarIcon className=\"size-3.5\" />,\n title: \"Annual plan discount\",\n description: \"20% off annual plans for a week\",\n },\n {\n date: new Date(2026, 8, 19),\n icon: <BoltIcon className=\"size-3.5\" />,\n title: \"Pro plan launch\",\n description: \"New tier at $49 per month\",\n },\n];\n\nfunction MarkerRows() {\n const active = useActiveMarkers(markers);\n return active.length > 0 ? <MarkerTooltipContent markers={active} /> : null;\n}\n\nexport default function ChartMarkersDemo() {\n return (\n <AreaChart data={data} label=\"Gross revenue with product and incident events, September 2026\" margin={{ top: 40 }}>\n <ChartGrid horizontal />\n <Area dataKey=\"revenue\" fill=\"var(--chart-solid-1)\" />\n <XAxis />\n <ChartMarkers items={markers} />\n <ChartTooltip>\n <MarkerRows />\n </ChartTooltip>\n </AreaChart>\n );\n}"
|
|
8470
8520
|
},
|
|
8471
8521
|
{
|
|
8472
8522
|
"name": "chart/reference-area",
|
|
8473
|
-
"code": "\"use client\";\n\nimport { Area, AreaChart } from \"@dodopayments/ui/area-chart\";\nimport { ChartGrid, ReferenceArea, XAxis, YAxis } from \"@dodopayments/ui/chart\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\n\n// Checkout conversion rate (%) per day. The band marks the 3.0% to 3.6% target range.\nconst data = Array.from({ length: 30 }, (_, day) => ({\n date: new Date(2026, 8, 1 + day),\n conversion: Math.round((3.1 + 0.5 * Math.sin(day / 2.5) + day * 0.012) * 100) / 100,\n}));\n\nexport default function ChartReferenceArea() {\n return (\n <AreaChart data={data} label=\"Checkout conversion rate against the target range, September 2026\">\n <ChartGrid horizontal />\n <ReferenceArea\n y1={3}\n y2={3.6}\n strokeStyle=\"dashed\"\n showMarkers\n stroke=\"var(--chart-2)\"\n markerColor=\"var(--chart-2)\"\n axisLabelColor=\"var(--chart-2)\"\n />\n <Area dataKey=\"conversion\" fill=\"var(--chart-1)\" />\n <XAxis />\n <YAxis formatLargeNumbers={false} formatValue={(value) => `${value.toFixed(1)}%`} />\n <ChartTooltip\n rows={(point) => [\n { color: \"var(--chart-1)\", label: \"Conversion\", value: `${(point.conversion as number).toFixed(2)}%` },\n ]}\n />\n </AreaChart>\n );\n}"
|
|
8523
|
+
"code": "\"use client\";\n\nimport { Area, AreaChart } from \"@dodopayments/ui/area-chart\";\nimport { ChartGrid, ReferenceArea, XAxis, YAxis } from \"@dodopayments/ui/chart\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\n\n// Checkout conversion rate (%) per day. The band marks the 3.0% to 3.6% target range.\nconst data = Array.from({ length: 30 }, (_, day) => ({\n date: new Date(2026, 8, 1 + day),\n conversion: Math.round((3.1 + 0.5 * Math.sin(day / 2.5) + day * 0.012) * 100) / 100,\n}));\n\nexport default function ChartReferenceArea() {\n return (\n <AreaChart data={data} label=\"Checkout conversion rate against the target range, September 2026\">\n <ChartGrid horizontal />\n <ReferenceArea\n y1={3}\n y2={3.6}\n strokeStyle=\"dashed\"\n showMarkers\n stroke=\"var(--chart-2)\"\n markerColor=\"var(--chart-2)\"\n axisLabelColor=\"var(--chart-2)\"\n />\n <Area dataKey=\"conversion\" fill=\"var(--chart-solid-1)\" />\n <XAxis />\n <YAxis formatLargeNumbers={false} formatValue={(value) => `${value.toFixed(1)}%`} />\n <ChartTooltip\n rows={(point) => [\n { color: \"var(--chart-solid-1)\", label: \"Conversion\", value: `${(point.conversion as number).toFixed(2)}%` },\n ]}\n />\n </AreaChart>\n );\n}"
|
|
8474
8524
|
}
|
|
8475
8525
|
],
|
|
8476
8526
|
"docsUrl": "/charts"
|
|
@@ -9371,11 +9421,11 @@
|
|
|
9371
9421
|
"examples": [
|
|
9372
9422
|
{
|
|
9373
9423
|
"name": "chart-tooltip/custom-rows",
|
|
9374
|
-
"code": "\"use client\";\n\nimport { Area, AreaChart } from \"@dodopayments/ui/area-chart\";\nimport { ChartGrid, XAxis } from \"@dodopayments/ui/chart\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\n\n// Daily gross revenue and refunds over two weeks.\nconst data = Array.from({ length: 14 }, (_, day) => ({\n date: new Date(2026, 8, 1 + day),\n revenue: Math.round(2400 + 60 * day + 300 * Math.sin(day / 2)),\n refunds: Math.round(180 + 40 * Math.cos(day / 3)),\n}));\n\nconst usd = new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency: \"USD\" });\n\nexport default function ChartTooltipCustomRows() {\n return (\n <AreaChart data={data} label=\"Gross revenue, refunds and net revenue, first two weeks of September 2026\">\n <ChartGrid horizontal />\n <Area dataKey=\"revenue\" fill=\"var(--chart-1)\" />\n <Area dataKey=\"refunds\" fill=\"var(--chart-2)\" />\n <XAxis />\n <ChartTooltip\n rows={(point) => {\n const revenue = point.revenue as number;\n const refunds = point.refunds as number;\n return [\n { color: \"var(--chart-1)\", label: \"Gross revenue\", value: usd.format(revenue) },\n { color: \"var(--chart-2)\", label: \"Refunds\", value: usd.format(refunds) },\n { color: \"var(--muted-foreground)\", label: \"Net revenue\", value: usd.format(revenue - refunds) },\n ];\n }}\n />\n </AreaChart>\n );\n}"
|
|
9424
|
+
"code": "\"use client\";\n\nimport { Area, AreaChart } from \"@dodopayments/ui/area-chart\";\nimport { ChartGrid, XAxis } from \"@dodopayments/ui/chart\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\n\n// Daily gross revenue and refunds over two weeks.\nconst data = Array.from({ length: 14 }, (_, day) => ({\n date: new Date(2026, 8, 1 + day),\n revenue: Math.round(2400 + 60 * day + 300 * Math.sin(day / 2)),\n refunds: Math.round(180 + 40 * Math.cos(day / 3)),\n}));\n\nconst usd = new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency: \"USD\" });\n\nexport default function ChartTooltipCustomRows() {\n return (\n <AreaChart data={data} label=\"Gross revenue, refunds and net revenue, first two weeks of September 2026\">\n <ChartGrid horizontal />\n <Area dataKey=\"revenue\" fill=\"var(--chart-solid-1)\" />\n <Area dataKey=\"refunds\" fill=\"var(--chart-2)\" />\n <XAxis />\n <ChartTooltip\n rows={(point) => {\n const revenue = point.revenue as number;\n const refunds = point.refunds as number;\n return [\n { color: \"var(--chart-solid-1)\", label: \"Gross revenue\", value: usd.format(revenue) },\n { color: \"var(--chart-2)\", label: \"Refunds\", value: usd.format(refunds) },\n { color: \"var(--muted-foreground)\", label: \"Net revenue\", value: usd.format(revenue - refunds) },\n ];\n }}\n />\n </AreaChart>\n );\n}"
|
|
9375
9425
|
},
|
|
9376
9426
|
{
|
|
9377
9427
|
"name": "chart-tooltip/default",
|
|
9378
|
-
"code": "\"use client\";\n\nimport { Area, AreaChart } from \"@dodopayments/ui/area-chart\";\nimport { ChartGrid, XAxis } from \"@dodopayments/ui/chart\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\n\n// Daily gross revenue and refunds over two weeks.\nconst data = Array.from({ length: 14 }, (_, day) => ({\n date: new Date(2026, 8, 1 + day),\n revenue: Math.round(2400 + 60 * day + 300 * Math.sin(day / 2)),\n refunds: Math.round(180 + 40 * Math.cos(day / 3)),\n}));\n\nexport default function ChartTooltipDefault() {\n return (\n <AreaChart data={data} label=\"Gross revenue and refunds, first two weeks of September 2026\">\n <ChartGrid horizontal />\n <Area dataKey=\"revenue\" fill=\"var(--chart-1)\" />\n <Area dataKey=\"refunds\" fill=\"var(--chart-2)\" />\n <XAxis />\n <ChartTooltip />\n </AreaChart>\n );\n}"
|
|
9428
|
+
"code": "\"use client\";\n\nimport { Area, AreaChart } from \"@dodopayments/ui/area-chart\";\nimport { ChartGrid, XAxis } from \"@dodopayments/ui/chart\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\n\n// Daily gross revenue and refunds over two weeks.\nconst data = Array.from({ length: 14 }, (_, day) => ({\n date: new Date(2026, 8, 1 + day),\n revenue: Math.round(2400 + 60 * day + 300 * Math.sin(day / 2)),\n refunds: Math.round(180 + 40 * Math.cos(day / 3)),\n}));\n\nexport default function ChartTooltipDefault() {\n return (\n <AreaChart data={data} label=\"Gross revenue and refunds, first two weeks of September 2026\">\n <ChartGrid horizontal />\n <Area dataKey=\"revenue\" fill=\"var(--chart-solid-1)\" />\n <Area dataKey=\"refunds\" fill=\"var(--chart-2)\" />\n <XAxis />\n <ChartTooltip />\n </AreaChart>\n );\n}"
|
|
9379
9429
|
}
|
|
9380
9430
|
],
|
|
9381
9431
|
"docsUrl": "/charts"
|
|
@@ -9810,7 +9860,7 @@
|
|
|
9810
9860
|
},
|
|
9811
9861
|
{
|
|
9812
9862
|
"name": "messageKey",
|
|
9813
|
-
"type": "\"search\" | \"clear\" | \"loading\" | \"next\" | \"cardFieldLabel\" | \"cardFieldNumber\" | \"cardFieldExpiry\" | \"cardFieldCvc\" | \"cardFieldName\" | \"cardFieldNumberError\" | \"cardFieldExpiryError\" | \"cardFieldCvcError\" | \"cardFieldNameError\" | \"billingActionFailed\" | \"close\" | \"dismiss\" | \"spinnerLabel\" | \"remove\" | \"removeItem\" | \"confirm\" | \"cancel\" | \"retry\" | \"tryAgain\" | \"back\" | \"more\" | \"showMore\" | \"showLess\" | \"selectEmpty\" | \"copied\" | \"copyFailed\" | \"copyToClipboard\" | \"loadMoreError\" | \"activityTimelineLoading\" | \"activityTimelineEmptyTitle\" | \"activityTimelineEmptyDescription\" | \"activityTimelineErrorTitle\" | \"activityTimelineErrorDescription\" | \"activityTimelineEnd\" | \"autocompleteShowSuggestions\" | \"comboboxShowOptions\" | \"breadcrumbLabel\" | \"codeBlockCopy\" | \"codeBlockLabel\" | \"dataGridSelectRow\" | \"dataGridSelectAll\" | \"dataGridSortBy\" | \"dataGridSortAscending\" | \"dataGridSortDescending\" | \"dataGridTime\" | \"datePresetToday\" | \"datePresetYesterday\" | \"datePresetLast7Days\" | \"datePresetLast30Days\" | \"datePresetThisWeek\" | \"datePresetThisMonth\" | \"datePresetLastMonth\" | \"datePresetMonthToDate\" | \"datePresetYearToDate\" | \"datePresetLastYear\" | \"dateRangeTitle\" | \"dateRangePresets\" | \"datePickerTitle\" | \"datePickerReset\" | \"datePickerApply\" | \"datePickerStartDate\" | \"datePickerEndDate\" | \"dateFilterPlaceholder\" | \"dateFilterClear\" | \"loadMore\" | \"loadMoreEnd\" | \"paginationLabel\" | \"paginationPrevious\" | \"paginationNext\" | \"paginationFirst\" | \"paginationLast\" | \"paginationPage\" | \"tablePaginationRowsPerPage\" | \"tablePaginationViewing\" | \"secretFieldReveal\" | \"secretFieldCopy\" | \"secretFieldRemasked\" | \"showMoreLabel\" | \"sidebarTitle\" | \"sidebarToggle\" | \"sidebarCollapse\" | \"sidebarExpand\" | \"sidebarMode\" | \"sidebarModeTest\" | \"sidebarModeLive\" | \"sidebarSwitchToLive\" | \"sidebarSwitchToTest\" | \"inputCopy\" | \"sheetProgress\" | \"statCardIncreased\" | \"statCardDecreased\" | \"statCardInfo\" | \"statCardError\" | \"statCardEmpty\" | \"statCardNoChange\" | \"timestampUtc\" | \"timestampRelative\" | \"timestampTimestamp\" | \"wizardStepsLabel\" | \"wizardStepsPosition\" | \"progressStep\" | \"wizardStepsFinish\" | \"wizardStepsComplete\" | \"wizardStepsCompleteHint\" | \"prorationPreviewLabel\" | \"prorationPreviewCurrentPlan\" | \"prorationPreviewNewPlan\" | \"prorationPreviewCredit\" | \"prorationPreviewCharge\" | \"prorationPreviewDueToday\" | \"prorationPreviewNextInvoice\" | \"prorationPreviewEffectiveNow\" | \"prorationPreviewEffectivePeriodEnd\" | \"codeTabsLabel\" | \"walletButtonsPayWith\" | \"walletButtonsDivider\"",
|
|
9863
|
+
"type": "\"search\" | \"clear\" | \"loading\" | \"next\" | \"cardFieldLabel\" | \"cardFieldNumber\" | \"cardFieldExpiry\" | \"cardFieldCvc\" | \"cardFieldName\" | \"cardFieldNumberError\" | \"cardFieldExpiryError\" | \"cardFieldCvcError\" | \"cardFieldNameError\" | \"billingActionFailed\" | \"close\" | \"dismiss\" | \"spinnerLabel\" | \"remove\" | \"removeItem\" | \"confirm\" | \"cancel\" | \"retry\" | \"tryAgain\" | \"back\" | \"more\" | \"showMore\" | \"showLess\" | \"selectEmpty\" | \"copied\" | \"copyFailed\" | \"copyToClipboard\" | \"loadMoreError\" | \"activityTimelineLoading\" | \"activityTimelineEmptyTitle\" | \"activityTimelineEmptyDescription\" | \"activityTimelineErrorTitle\" | \"activityTimelineErrorDescription\" | \"activityTimelineEnd\" | \"autocompleteShowSuggestions\" | \"comboboxShowOptions\" | \"breadcrumbLabel\" | \"codeBlockCopy\" | \"codeBlockLabel\" | \"dataGridSelectRow\" | \"dataGridSelectAll\" | \"dataGridSortBy\" | \"dataGridSortAscending\" | \"dataGridSortDescending\" | \"dataGridTime\" | \"datePresetToday\" | \"datePresetYesterday\" | \"datePresetLast7Days\" | \"datePresetLast30Days\" | \"datePresetThisWeek\" | \"datePresetThisMonth\" | \"datePresetLastMonth\" | \"datePresetMonthToDate\" | \"datePresetYearToDate\" | \"datePresetLastYear\" | \"dateRangeTitle\" | \"dateRangePresets\" | \"datePickerTitle\" | \"datePickerReset\" | \"datePickerApply\" | \"datePickerStartDate\" | \"datePickerEndDate\" | \"dateFilterPlaceholder\" | \"dateFilterClear\" | \"loadMore\" | \"loadMoreEnd\" | \"paginationLabel\" | \"paginationPrevious\" | \"paginationNext\" | \"paginationFirst\" | \"paginationLast\" | \"paginationPage\" | \"tablePaginationRowsPerPage\" | \"tablePaginationViewing\" | \"secretFieldReveal\" | \"secretFieldCopy\" | \"secretFieldRemasked\" | \"showMoreLabel\" | \"sidebarTitle\" | \"sidebarToggle\" | \"sidebarCollapse\" | \"sidebarExpand\" | \"sidebarMode\" | \"sidebarModeTest\" | \"sidebarModeLive\" | \"sidebarSwitchToLive\" | \"sidebarSwitchToTest\" | \"imageCropTitle\" | \"imageCropArea\" | \"imageCropApply\" | \"imageCropKeyboardHint\" | \"imageCropFailed\" | \"imageCropUnreadable\" | \"inputCopy\" | \"sheetProgress\" | \"statCardIncreased\" | \"statCardDecreased\" | \"statCardInfo\" | \"statCardError\" | \"statCardEmpty\" | \"statCardNoChange\" | \"timestampUtc\" | \"timestampRelative\" | \"timestampTimestamp\" | \"wizardStepsLabel\" | \"wizardStepsPosition\" | \"progressStep\" | \"wizardStepsFinish\" | \"wizardStepsComplete\" | \"wizardStepsCompleteHint\" | \"prorationPreviewLabel\" | \"prorationPreviewCurrentPlan\" | \"prorationPreviewNewPlan\" | \"prorationPreviewCredit\" | \"prorationPreviewCharge\" | \"prorationPreviewDueToday\" | \"prorationPreviewNextInvoice\" | \"prorationPreviewEffectiveNow\" | \"prorationPreviewEffectivePeriodEnd\" | \"codeTabsLabel\" | \"walletButtonsPayWith\" | \"walletButtonsDivider\"",
|
|
9814
9864
|
"required": false,
|
|
9815
9865
|
"description": "Built-in message that translates `label` under a `LocaleProvider` while `label` is still that\nmessage's English default. Custom presets leave it out and show `label` as given; a built-in\npreset you relabel (`{ ...preset, label: \"Past week\" }`) shows its new `label` too.",
|
|
9816
9866
|
"source": "dodo"
|
|
@@ -10200,7 +10250,7 @@
|
|
|
10200
10250
|
"title": "Data table",
|
|
10201
10251
|
"category": "Data display",
|
|
10202
10252
|
"status": "stable",
|
|
10203
|
-
"description": "The Dodo Nest Data table, driven by a TanStack Table v8 instance: the column headers on a grey tray,\nthe rows (`size` md 48 / lg 64) on the white panel inside it, skeleton rows while `isLoading`, and\n`emptyMessage` centred in the panel when there are no rows. It keeps the table layout at every width:\na table wider than its container scrolls sideways (the container is then a tab stop). It sets\n`aria-sort` on sortable headers and marks selected rows `data-state=\"selected\"`, tinted\nSurface/Secondary as on hover. Sorting, selection and pagination stay in the table\ninstance; pair it with `DataGridColumnHeader`, `DataGridRowSelect(All)` and `DataGridPagination`\n(16 below). After a sort change, the rows glide to their new positions (`animateSort`) and a polite\nlive region announces the new sort. `bulkActions` adds a sticky \"N selected\" bar with actions for\nthe selected rows.",
|
|
10253
|
+
"description": "The Dodo Nest Data table, driven by a TanStack Table v8 instance: the column headers on a grey tray,\nthe rows (`size` md 48 / lg 64) on the white panel inside it, skeleton rows while `isLoading`, and\n`emptyMessage` centred in the panel when there are no rows. It keeps the table layout at every width:\na table wider than its container scrolls sideways (the container is then a tab stop). For a phone, give the\nless important columns `meta.priority` 2 or 3 so they hide while the table is narrow, and set `pinFirstColumn`\nto keep the first column in view. It sets\n`aria-sort` on sortable headers and marks selected rows `data-state=\"selected\"`, tinted\nSurface/Secondary as on hover. Sorting, selection and pagination stay in the table\ninstance; pair it with `DataGridColumnHeader`, `DataGridRowSelect(All)` and `DataGridPagination`\n(16 below). After a sort change, the rows glide to their new positions (`animateSort`) and a polite\nlive region announces the new sort. `bulkActions` adds a sticky \"N selected\" bar with actions for\nthe selected rows.",
|
|
10204
10254
|
"importPath": "@dodopayments/ui/data-grid",
|
|
10205
10255
|
"exports": [
|
|
10206
10256
|
"DEFAULT_DATA_GRID_BULK_ACTION_LABELS",
|
|
@@ -10234,7 +10284,7 @@
|
|
|
10234
10284
|
"parts": [
|
|
10235
10285
|
{
|
|
10236
10286
|
"name": "DataGrid",
|
|
10237
|
-
"description": "The Dodo Nest Data table, driven by a TanStack Table v8 instance: the column headers on a grey tray,\nthe rows (`size` md 48 / lg 64) on the white panel inside it, skeleton rows while `isLoading`, and\n`emptyMessage` centred in the panel when there are no rows. It keeps the table layout at every width:\na table wider than its container scrolls sideways (the container is then a tab stop). It sets\n`aria-sort` on sortable headers and marks selected rows `data-state=\"selected\"`, tinted\nSurface/Secondary as on hover. Sorting, selection and pagination stay in the table\ninstance; pair it with `DataGridColumnHeader`, `DataGridRowSelect(All)` and `DataGridPagination`\n(16 below). After a sort change, the rows glide to their new positions (`animateSort`) and a polite\nlive region announces the new sort. `bulkActions` adds a sticky \"N selected\" bar with actions for\nthe selected rows.",
|
|
10287
|
+
"description": "The Dodo Nest Data table, driven by a TanStack Table v8 instance: the column headers on a grey tray,\nthe rows (`size` md 48 / lg 64) on the white panel inside it, skeleton rows while `isLoading`, and\n`emptyMessage` centred in the panel when there are no rows. It keeps the table layout at every width:\na table wider than its container scrolls sideways (the container is then a tab stop). For a phone, give the\nless important columns `meta.priority` 2 or 3 so they hide while the table is narrow, and set `pinFirstColumn`\nto keep the first column in view. It sets\n`aria-sort` on sortable headers and marks selected rows `data-state=\"selected\"`, tinted\nSurface/Secondary as on hover. Sorting, selection and pagination stay in the table\ninstance; pair it with `DataGridColumnHeader`, `DataGridRowSelect(All)` and `DataGridPagination`\n(16 below). After a sort change, the rows glide to their new positions (`animateSort`) and a polite\nlive region announces the new sort. `bulkActions` adds a sticky \"N selected\" bar with actions for\nthe selected rows.",
|
|
10238
10288
|
"props": [
|
|
10239
10289
|
{
|
|
10240
10290
|
"name": "table",
|
|
@@ -10340,6 +10390,14 @@
|
|
|
10340
10390
|
"description": "Follows a row's link in the same tab, e.g. `(href) => router.push(href)` for client-side routing.",
|
|
10341
10391
|
"source": "dodo"
|
|
10342
10392
|
},
|
|
10393
|
+
{
|
|
10394
|
+
"name": "pinFirstColumn",
|
|
10395
|
+
"type": "boolean",
|
|
10396
|
+
"required": false,
|
|
10397
|
+
"default": "false",
|
|
10398
|
+
"description": "Keep the first data column in view while a wide table scrolls sideways, next to the checkboxes if there are\nany, so each row stays identifiable on a phone. The columns passing under it fade.",
|
|
10399
|
+
"source": "dodo"
|
|
10400
|
+
},
|
|
10343
10401
|
{
|
|
10344
10402
|
"name": "size",
|
|
10345
10403
|
"type": "\"md\" | \"lg\"",
|
|
@@ -10622,6 +10680,10 @@
|
|
|
10622
10680
|
"name": "data-grid/loading-empty",
|
|
10623
10681
|
"code": "\"use client\";\n\nimport { DataGrid, DataGridColumnHeader } from \"@dodopayments/ui/data-grid\";\nimport { Empty } from \"@dodopayments/ui/empty\";\nimport { ReceiptIcon } from \"@dodopayments/ui/icons\";\nimport { SegmentedControl } from \"@dodopayments/ui/segmented-control\";\nimport { type ColumnDef, getCoreRowModel, useReactTable } from \"@tanstack/react-table\";\nimport { useState } from \"react\";\n\ninterface Payout {\n id: string;\n date: string;\n amount: string;\n}\n\nconst columns: ColumnDef<Payout>[] = [\n {\n accessorKey: \"id\",\n header: ({ column }) => <DataGridColumnHeader column={column} title=\"Payout ID\" />,\n enableSorting: false,\n meta: { cellClassName: \"font-mono\" },\n },\n { accessorKey: \"date\", header: \"Date\" },\n { accessorKey: \"amount\", header: \"Amount\", meta: { cellClassName: \"tabular-nums\" } },\n];\n\ntype Mode = \"loading\" | \"empty\";\n\n// One array for every render: a new `[]` each time would make TanStack reset the page on every render.\nconst NO_PAYOUTS: Payout[] = [];\n\nexport default function DataGridLoadingEmpty() {\n const [mode, setMode] = useState<Mode>(\"loading\");\n // eslint-disable-next-line react-hooks/incompatible-library -- TanStack Table returns a mutable instance by design.\n const table = useReactTable({\n data: NO_PAYOUTS,\n columns,\n getCoreRowModel: getCoreRowModel(),\n initialState: { pagination: { pageIndex: 0, pageSize: 4 } },\n });\n\n return (\n <div className=\"flex w-full min-w-0 flex-col gap-2.5\">\n <SegmentedControl\n aria-label=\"Table state\"\n className=\"self-start\"\n value={mode}\n onValueChange={(value) => setMode(value as Mode)}\n items={[\n { value: \"loading\", label: \"Loading\" },\n { value: \"empty\", label: \"Empty\" },\n ]}\n />\n <DataGrid\n table={table}\n aria-label=\"Payouts\"\n isLoading={mode === \"loading\"}\n emptyMessage={\n <Empty\n className=\"py-10\"\n icon={<ReceiptIcon />}\n title=\"No payouts yet\"\n description=\"Payouts appear here once your balance is settled.\"\n />\n }\n />\n </div>\n );\n}"
|
|
10624
10682
|
},
|
|
10683
|
+
{
|
|
10684
|
+
"name": "data-grid/phone",
|
|
10685
|
+
"code": "\"use client\";\n\nimport { Badge } from \"@dodopayments/ui/badge\";\nimport { DataGrid } from \"@dodopayments/ui/data-grid\";\nimport { type ColumnDef, getCoreRowModel, useReactTable } from \"@tanstack/react-table\";\n\ninterface Payment {\n id: string;\n customer: string;\n method: string;\n created: string;\n status: \"succeeded\" | \"failed\" | \"processing\";\n amount: string;\n}\n\nconst payments: Payment[] = [\n {\n id: \"pay_8Hq2Xa\",\n customer: \"ada@lovelace.dev\",\n method: \"Visa •••• 4242\",\n created: \"Nov 26, 09:14\",\n status: \"succeeded\",\n amount: \"$49.00\",\n },\n {\n id: \"pay_3Kd9Pm\",\n customer: \"grace@hopper.io\",\n method: \"UPI\",\n created: \"Nov 26, 08:51\",\n status: \"processing\",\n amount: \"$120.00\",\n },\n {\n id: \"pay_7Tn4Ws\",\n customer: \"alan@turing.org\",\n method: \"Mastercard •••• 4444\",\n created: \"Nov 25, 22:07\",\n status: \"failed\",\n amount: \"$19.00\",\n },\n {\n id: \"pay_1Bz6Lc\",\n customer: \"katherine@johnson.space\",\n method: \"Apple Pay\",\n created: \"Nov 25, 18:30\",\n status: \"succeeded\",\n amount: \"$240.00\",\n },\n];\n\nconst columns: ColumnDef<Payment>[] = [\n { accessorKey: \"id\", header: \"Payment\", meta: { cellClassName: \"font-mono\" } },\n {\n accessorKey: \"status\",\n header: \"Status\",\n cell: ({ row }) => <Badge status={row.original.status} kind=\"payment\" />,\n },\n { accessorKey: \"amount\", header: \"Amount\", meta: { cellClassName: \"tabular-nums\" } },\n // Hidden while the table is under 448px wide: a phone.\n { accessorKey: \"customer\", header: \"Customer\", meta: { priority: 2 } },\n // Hidden while it is under 672px wide: a phone or a narrow panel.\n { accessorKey: \"method\", header: \"Method\", meta: { priority: 3 } },\n { accessorKey: \"created\", header: \"Created\", meta: { priority: 3 } },\n];\n\nexport default function DataGridPhone() {\n // eslint-disable-next-line react-hooks/incompatible-library -- TanStack Table returns a mutable instance by design.\n const table = useReactTable({\n data: payments,\n columns,\n getRowId: (row) => row.id,\n getCoreRowModel: getCoreRowModel(),\n });\n\n return (\n <div className=\"w-full min-w-0\">\n <DataGrid table={table} aria-label=\"Payments\" pinFirstColumn />\n </div>\n );\n}"
|
|
10686
|
+
},
|
|
10625
10687
|
{
|
|
10626
10688
|
"name": "data-grid/row-hover",
|
|
10627
10689
|
"code": "\"use client\";\n\nimport { DataGrid, DataGridPagination } from \"@dodopayments/ui/data-grid\";\nimport {\n type ColumnDef,\n getCoreRowModel,\n getPaginationRowModel,\n useReactTable,\n} from \"@tanstack/react-table\";\n\ninterface Customer {\n id: string;\n name: string;\n email: string;\n}\n\nconst customers: Customer[] = Array.from({ length: 14 }, (_, i) => ({\n id: `cus_${(9100 + i * 13).toString(36)}`,\n name: `Customer ${i + 1}`,\n email: `customer${i + 1}@example.com`,\n}));\n\nconst columns: ColumnDef<Customer>[] = [\n { accessorKey: \"name\", header: \"Name\" },\n { accessorKey: \"email\", header: \"Email\" },\n { accessorKey: \"id\", header: \"Customer ID\", meta: { cellClassName: \"font-mono\" } },\n];\n\nexport default function DataGridRowHover() {\n // eslint-disable-next-line react-hooks/incompatible-library -- TanStack Table returns a mutable instance by design.\n const table = useReactTable({\n data: customers,\n columns,\n getRowId: (row) => row.id,\n getCoreRowModel: getCoreRowModel(),\n getPaginationRowModel: getPaginationRowModel(),\n initialState: { pagination: { pageIndex: 0, pageSize: 5 } },\n });\n\n return (\n <div className=\"flex w-full min-w-0 flex-col gap-2.5\">\n <DataGrid table={table} aria-label=\"Customers\" />\n <DataGridPagination table={table} showRowsPerPage={false} />\n </div>\n );\n}"
|
|
@@ -11065,6 +11127,14 @@
|
|
|
11065
11127
|
"description": "Placeholder and accessible name of the search input in the popup.",
|
|
11066
11128
|
"source": "dodo"
|
|
11067
11129
|
},
|
|
11130
|
+
{
|
|
11131
|
+
"name": "size",
|
|
11132
|
+
"type": "\"default\" | \"sm\"",
|
|
11133
|
+
"required": false,
|
|
11134
|
+
"default": "\"default\"",
|
|
11135
|
+
"description": "Trigger height: 36, or the compact 28 of `SelectTrigger` `size=\"sm\"`.",
|
|
11136
|
+
"source": "dodo"
|
|
11137
|
+
},
|
|
11068
11138
|
{
|
|
11069
11139
|
"name": "value",
|
|
11070
11140
|
"type": "string | null",
|
|
@@ -11241,6 +11311,14 @@
|
|
|
11241
11311
|
"description": "Placeholder and accessible name of the search input in the popup.",
|
|
11242
11312
|
"source": "dodo"
|
|
11243
11313
|
},
|
|
11314
|
+
{
|
|
11315
|
+
"name": "size",
|
|
11316
|
+
"type": "\"default\" | \"sm\"",
|
|
11317
|
+
"required": false,
|
|
11318
|
+
"default": "\"default\"",
|
|
11319
|
+
"description": "Trigger height: 36, or the compact 28 of `SelectTrigger` `size=\"sm\"`.",
|
|
11320
|
+
"source": "dodo"
|
|
11321
|
+
},
|
|
11244
11322
|
{
|
|
11245
11323
|
"name": "value",
|
|
11246
11324
|
"type": "string | null",
|
|
@@ -11314,10 +11392,10 @@
|
|
|
11314
11392
|
},
|
|
11315
11393
|
{
|
|
11316
11394
|
"name": "size",
|
|
11317
|
-
"type": "\"lg\"",
|
|
11395
|
+
"type": "\"sm\" | \"lg\"",
|
|
11318
11396
|
"required": false,
|
|
11319
11397
|
"default": "\"lg\"",
|
|
11320
|
-
"description": "Input height, as `Input` (`DODO_INPUT_VARIANTS`):
|
|
11398
|
+
"description": "Input height, as `Input` (`DODO_INPUT_VARIANTS`): `lg` 36 or the compact `sm` 28.",
|
|
11321
11399
|
"source": "dodo"
|
|
11322
11400
|
},
|
|
11323
11401
|
{
|
|
@@ -11470,6 +11548,14 @@
|
|
|
11470
11548
|
"description": "Placeholder and accessible name of the search input in the popup.",
|
|
11471
11549
|
"source": "dodo"
|
|
11472
11550
|
},
|
|
11551
|
+
{
|
|
11552
|
+
"name": "size",
|
|
11553
|
+
"type": "\"default\" | \"sm\"",
|
|
11554
|
+
"required": false,
|
|
11555
|
+
"default": "\"default\"",
|
|
11556
|
+
"description": "Trigger height: 36, or the compact 28 of `SelectTrigger` `size=\"sm\"`.",
|
|
11557
|
+
"source": "dodo"
|
|
11558
|
+
},
|
|
11473
11559
|
{
|
|
11474
11560
|
"name": "timeZones",
|
|
11475
11561
|
"type": "readonly string[]",
|
|
@@ -11751,7 +11837,7 @@
|
|
|
11751
11837
|
},
|
|
11752
11838
|
{
|
|
11753
11839
|
"name": "size",
|
|
11754
|
-
"type": "\"default\" | \"icon\" | \"xs\" | \"lg\" | \"icon-xs\" | \"icon-lg\" | null",
|
|
11840
|
+
"type": "\"default\" | \"sm\" | \"icon\" | \"xs\" | \"lg\" | \"icon-sm\" | \"icon-xs\" | \"icon-lg\" | null",
|
|
11755
11841
|
"required": false,
|
|
11756
11842
|
"description": "",
|
|
11757
11843
|
"source": "dodo"
|
|
@@ -11865,17 +11951,17 @@
|
|
|
11865
11951
|
"description": "Shows content laid out at a fixed size, scaled down to the width the frame has, e.g. a live checkout\npage in an `iframe` beside its settings. The frame keeps the content's aspect ratio and never scales\nit up. The content stays a live page; put a cover over it when it should not take clicks.",
|
|
11866
11952
|
"props": [
|
|
11867
11953
|
{
|
|
11868
|
-
"name": "
|
|
11954
|
+
"name": "width",
|
|
11869
11955
|
"type": "number",
|
|
11870
11956
|
"required": true,
|
|
11871
|
-
"description": "The
|
|
11957
|
+
"description": "The width the content is laid out at, in px, e.g. 1280 for a desktop page.",
|
|
11872
11958
|
"source": "dodo"
|
|
11873
11959
|
},
|
|
11874
11960
|
{
|
|
11875
|
-
"name": "
|
|
11961
|
+
"name": "height",
|
|
11876
11962
|
"type": "number",
|
|
11877
|
-
"required":
|
|
11878
|
-
"description": "The
|
|
11963
|
+
"required": false,
|
|
11964
|
+
"description": "The height the content is laid out at, in px. Leave it out for content that sets its own height,\nsuch as a document page that grows with its lines: the frame then follows it, scaled. The height\nis measured in the browser, so server-rendered HTML has a 0 tall frame until it hydrates.",
|
|
11879
11965
|
"source": "dodo"
|
|
11880
11966
|
}
|
|
11881
11967
|
]
|
|
@@ -11988,7 +12074,7 @@
|
|
|
11988
12074
|
},
|
|
11989
12075
|
{
|
|
11990
12076
|
"name": "Dialog",
|
|
11991
|
-
"description": "Root of a modal dialog, centred on the screen. Controls open
|
|
12077
|
+
"description": "Root of a modal dialog, centred on the screen; with `mobileSheet` it is a bottom drawer on a phone. Controls open\nstate (`open`/`onOpenChange` or `defaultOpen`). `alert` makes it an alert dialog for confirmations.",
|
|
11992
12078
|
"props": [
|
|
11993
12079
|
{
|
|
11994
12080
|
"name": "alert",
|
|
@@ -11998,6 +12084,14 @@
|
|
|
11998
12084
|
"description": "An alert dialog: it interrupts to confirm or acknowledge something (`role=\"alertdialog\"`). Clicking the backdrop\ndoes not close it and `DialogContent` has no close button, so always offer an explicit Cancel in the footer.\nEscape still closes it. `ConfirmDialog` is a ready-made one.",
|
|
11999
12085
|
"source": "dodo"
|
|
12000
12086
|
},
|
|
12087
|
+
{
|
|
12088
|
+
"name": "mobileSheet",
|
|
12089
|
+
"type": "boolean",
|
|
12090
|
+
"required": false,
|
|
12091
|
+
"default": "false",
|
|
12092
|
+
"description": "Below 640px, show the dialog as a bottom drawer: docked to the bottom edge at full width, closed with a swipe\ndown as well as the scrim, Escape and the close button, with the actions sharing the footer row. Off by default:\nthe dialog stays centred at every width. Do not set it when the body has its own drag gesture. An alert dialog\nis always centred.",
|
|
12093
|
+
"source": "dodo"
|
|
12094
|
+
},
|
|
12001
12095
|
{
|
|
12002
12096
|
"name": "actionsRef",
|
|
12003
12097
|
"type": "RefObject<DialogRootActions | null>",
|
|
@@ -12158,6 +12252,13 @@
|
|
|
12158
12252
|
"description": "The icon in the tile, a Nucleo icon (16px at `md`, 12px at `sm`): `<FeaturedIcon icon={<KeyIcon />} />`.",
|
|
12159
12253
|
"source": "dodo"
|
|
12160
12254
|
},
|
|
12255
|
+
{
|
|
12256
|
+
"name": "look",
|
|
12257
|
+
"type": "\"tile\" | \"sphere\"",
|
|
12258
|
+
"required": false,
|
|
12259
|
+
"description": "`tile`: The rounded square with a soft fill and two borders (the default).\n`sphere`: The dashboard's glossy round badge in the tone, a white icon on it (44px at `md`, 28px at `sm`), as the\nverification checklist shows each step.",
|
|
12260
|
+
"source": "dodo"
|
|
12261
|
+
},
|
|
12161
12262
|
{
|
|
12162
12263
|
"name": "size",
|
|
12163
12264
|
"type": "\"sm\" | \"md\" | null",
|
|
@@ -12483,204 +12584,574 @@
|
|
|
12483
12584
|
"docsUrl": "/components/dialog"
|
|
12484
12585
|
},
|
|
12485
12586
|
{
|
|
12486
|
-
"slug": "
|
|
12487
|
-
"title": "
|
|
12488
|
-
"category": "
|
|
12587
|
+
"slug": "drawer",
|
|
12588
|
+
"title": "Drawer",
|
|
12589
|
+
"category": "Overlays",
|
|
12489
12590
|
"status": "stable",
|
|
12490
|
-
"description": "
|
|
12491
|
-
"importPath": "@dodopayments/ui/
|
|
12591
|
+
"description": "The drawer: portal + scrim + popup, docked to the bottom edge with a drag handle and a close button. A grey tray\nwith rounded top corners, like Dialog: the title and body in a white panel, the actions on the grey strip. It is\nas tall as its content, up to the screen minus 48, and pads the bottom safe area; a focused field stays above the\nsoftware keyboard. Always include a `DrawerTitle`; lay it out as `DrawerHeader`, `DrawerPanel` and `DrawerFooter`.",
|
|
12592
|
+
"importPath": "@dodopayments/ui/drawer",
|
|
12492
12593
|
"exports": [
|
|
12493
|
-
"
|
|
12494
|
-
"
|
|
12495
|
-
"
|
|
12496
|
-
"
|
|
12594
|
+
"Drawer",
|
|
12595
|
+
"DrawerClose",
|
|
12596
|
+
"DrawerCloseProps",
|
|
12597
|
+
"DrawerContent",
|
|
12598
|
+
"DrawerContentProps",
|
|
12599
|
+
"DrawerDescription",
|
|
12600
|
+
"DrawerDescriptionProps",
|
|
12601
|
+
"DrawerFooter",
|
|
12602
|
+
"DrawerFooterProps",
|
|
12603
|
+
"DrawerHeader",
|
|
12604
|
+
"DrawerHeaderProps",
|
|
12605
|
+
"DrawerPanel",
|
|
12606
|
+
"DrawerPanelProps",
|
|
12607
|
+
"DrawerProps",
|
|
12608
|
+
"DrawerTitle",
|
|
12609
|
+
"DrawerTitleProps",
|
|
12610
|
+
"DrawerTrigger",
|
|
12611
|
+
"DrawerTriggerProps"
|
|
12497
12612
|
],
|
|
12498
12613
|
"parts": [
|
|
12499
12614
|
{
|
|
12500
|
-
"name": "
|
|
12501
|
-
"description": "
|
|
12615
|
+
"name": "DrawerContent",
|
|
12616
|
+
"description": "The drawer: portal + scrim + popup, docked to the bottom edge with a drag handle and a close button. A grey tray\nwith rounded top corners, like Dialog: the title and body in a white panel, the actions on the grey strip. It is\nas tall as its content, up to the screen minus 48, and pads the bottom safe area; a focused field stays above the\nsoftware keyboard. Always include a `DrawerTitle`; lay it out as `DrawerHeader`, `DrawerPanel` and `DrawerFooter`.",
|
|
12502
12617
|
"props": [
|
|
12503
|
-
{
|
|
12504
|
-
"name": "asWrapper",
|
|
12505
|
-
"type": "boolean",
|
|
12506
|
-
"required": false,
|
|
12507
|
-
"default": "false",
|
|
12508
|
-
"description": "Also render a `<div dir>` around the children, for a right-to-left region inside a left-to-right\npage (a preview, an Arabic address card). For a whole app, leave it off and set `<html dir>`.",
|
|
12509
|
-
"source": "dodo"
|
|
12510
|
-
},
|
|
12511
12618
|
{
|
|
12512
12619
|
"name": "className",
|
|
12513
12620
|
"type": "string",
|
|
12514
12621
|
"required": false,
|
|
12515
|
-
"description": "
|
|
12622
|
+
"description": "Additional Tailwind classes, merged last.",
|
|
12516
12623
|
"source": "dodo"
|
|
12517
12624
|
},
|
|
12518
12625
|
{
|
|
12519
|
-
"name": "
|
|
12520
|
-
"type": "
|
|
12626
|
+
"name": "closeLabel",
|
|
12627
|
+
"type": "string",
|
|
12521
12628
|
"required": false,
|
|
12522
|
-
"default": "\"
|
|
12523
|
-
"description": "
|
|
12524
|
-
"source": "dodo"
|
|
12525
|
-
}
|
|
12526
|
-
]
|
|
12527
|
-
}
|
|
12528
|
-
],
|
|
12529
|
-
"api": [
|
|
12530
|
-
{
|
|
12531
|
-
"name": "useDirection",
|
|
12532
|
-
"kind": "function",
|
|
12533
|
-
"description": "The reading direction of the closest `DirectionProvider` (`\"ltr\"` outside one).",
|
|
12534
|
-
"members": [
|
|
12535
|
-
{
|
|
12536
|
-
"signature": "useDirection(): TextDirection",
|
|
12537
|
-
"description": "The reading direction of the closest `DirectionProvider` (`\"ltr\"` outside one)."
|
|
12538
|
-
}
|
|
12539
|
-
]
|
|
12540
|
-
}
|
|
12541
|
-
],
|
|
12542
|
-
"examples": [
|
|
12543
|
-
{
|
|
12544
|
-
"name": "direction-provider/basic",
|
|
12545
|
-
"code": "\"use client\";\n\nimport {\n Breadcrumb,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbList,\n BreadcrumbPage,\n BreadcrumbSeparator,\n} from \"@dodopayments/ui/breadcrumb\";\nimport { Button } from \"@dodopayments/ui/button\";\nimport { DirectionProvider, type TextDirection } from \"@dodopayments/ui/direction-provider\";\nimport { InputGroup, InputGroupAddon, InputGroupInput } from \"@dodopayments/ui/input-group\";\nimport { Tabs, TabsList, TabsTrigger } from \"@dodopayments/ui/tabs\";\nimport { useState } from \"react\";\n\nexport default function DirectionProviderBasic() {\n const [direction, setDirection] = useState<TextDirection>(\"rtl\");\n const next = direction === \"rtl\" ? \"ltr\" : \"rtl\";\n\n return (\n <div className=\"flex w-full max-w-md flex-col items-center gap-6\">\n <Button variant=\"secondary\" onClick={() => setDirection(next)}>\n Switch to {next.toUpperCase()}\n </Button>\n <DirectionProvider direction={direction} asWrapper className=\"flex w-full flex-col gap-4\">\n <Breadcrumb>\n <BreadcrumbList>\n <BreadcrumbItem>\n <BreadcrumbLink href=\"#home\">Home</BreadcrumbLink>\n </BreadcrumbItem>\n <BreadcrumbSeparator />\n <BreadcrumbItem>\n <BreadcrumbLink href=\"#products\">Products</BreadcrumbLink>\n </BreadcrumbItem>\n <BreadcrumbSeparator />\n <BreadcrumbItem>\n <BreadcrumbPage>Pro plan</BreadcrumbPage>\n </BreadcrumbItem>\n </BreadcrumbList>\n </Breadcrumb>\n <Tabs defaultValue=\"overview\">\n <TabsList aria-label=\"Customer sections\">\n <TabsTrigger value=\"overview\">Overview</TabsTrigger>\n <TabsTrigger value=\"payments\">Payments</TabsTrigger>\n <TabsTrigger value=\"refunds\">Refunds</TabsTrigger>\n </TabsList>\n </Tabs>\n <InputGroup>\n <InputGroupAddon>$</InputGroupAddon>\n <InputGroupInput aria-label=\"Price in USD\" inputMode=\"decimal\" placeholder=\"0.00\" />\n <InputGroupAddon>USD</InputGroupAddon>\n </InputGroup>\n </DirectionProvider>\n </div>\n );\n}"
|
|
12546
|
-
}
|
|
12547
|
-
],
|
|
12548
|
-
"docsUrl": "/components/direction-provider"
|
|
12549
|
-
},
|
|
12550
|
-
{
|
|
12551
|
-
"slug": "empty",
|
|
12552
|
-
"title": "Empty",
|
|
12553
|
-
"category": "Feedback",
|
|
12554
|
-
"status": "stable",
|
|
12555
|
-
"description": "What a page, card or table shows when there is nothing yet (Dodo Nest Empty state): an optional Featured icon\n(neutral, or `iconTone=\"error\"` when loading failed), a title (Label/Primary), an optional description (Body/Primary, Content/Secondary) and an optional action,\nin a centred column up to 360 wide. It has no container or padding of its own: put it where the content would be.\nThe title, description and action rise in one after the other.",
|
|
12556
|
-
"importPath": "@dodopayments/ui/empty",
|
|
12557
|
-
"exports": [
|
|
12558
|
-
"Empty",
|
|
12559
|
-
"EmptyProps"
|
|
12560
|
-
],
|
|
12561
|
-
"parts": [
|
|
12562
|
-
{
|
|
12563
|
-
"name": "Empty",
|
|
12564
|
-
"description": "What a page, card or table shows when there is nothing yet (Dodo Nest Empty state): an optional Featured icon\n(neutral, or `iconTone=\"error\"` when loading failed), a title (Label/Primary), an optional description (Body/Primary, Content/Secondary) and an optional action,\nin a centred column up to 360 wide. It has no container or padding of its own: put it where the content would be.\nThe title, description and action rise in one after the other.",
|
|
12565
|
-
"props": [
|
|
12566
|
-
{
|
|
12567
|
-
"name": "title",
|
|
12568
|
-
"type": "ReactNode",
|
|
12569
|
-
"required": true,
|
|
12570
|
-
"description": "What is empty, e.g. \"No payouts yet\".",
|
|
12629
|
+
"default": "\"Close\"",
|
|
12630
|
+
"description": "Accessible label for the close button.",
|
|
12571
12631
|
"source": "dodo"
|
|
12572
12632
|
},
|
|
12573
12633
|
{
|
|
12574
|
-
"name": "
|
|
12575
|
-
"type": "
|
|
12634
|
+
"name": "hideCloseButton",
|
|
12635
|
+
"type": "boolean",
|
|
12576
12636
|
"required": false,
|
|
12577
|
-
"
|
|
12637
|
+
"default": "false",
|
|
12638
|
+
"description": "Hide the close button. The scrim, Escape and a swipe down still close the drawer.",
|
|
12578
12639
|
"source": "dodo"
|
|
12579
12640
|
},
|
|
12580
12641
|
{
|
|
12581
|
-
"name": "
|
|
12582
|
-
"type": "
|
|
12642
|
+
"name": "hideHandle",
|
|
12643
|
+
"type": "boolean",
|
|
12583
12644
|
"required": false,
|
|
12584
|
-
"
|
|
12645
|
+
"default": "false",
|
|
12646
|
+
"description": "Hide the drag handle on top. The drawer still closes with a swipe down.",
|
|
12585
12647
|
"source": "dodo"
|
|
12586
12648
|
},
|
|
12587
12649
|
{
|
|
12588
|
-
"name": "
|
|
12589
|
-
"type": "
|
|
12650
|
+
"name": "portalProps",
|
|
12651
|
+
"type": "DrawerPortalProps",
|
|
12590
12652
|
"required": false,
|
|
12591
|
-
"description": "
|
|
12653
|
+
"description": "Props for the portal, e.g. a `container` to render the drawer into instead of `document.body`.",
|
|
12592
12654
|
"source": "dodo"
|
|
12593
12655
|
},
|
|
12594
12656
|
{
|
|
12595
|
-
"name": "
|
|
12596
|
-
"type": "
|
|
12657
|
+
"name": "finalFocus",
|
|
12658
|
+
"type": "boolean | RefObject<HTMLElement | null> | ((closeType: InteractionType) => boolean | void | HTMLElement | null)",
|
|
12597
12659
|
"required": false,
|
|
12598
|
-
"
|
|
12599
|
-
"
|
|
12600
|
-
"source": "dodo"
|
|
12660
|
+
"description": "Determines the element to focus when the drawer is closed.\n\n- `false`: Do not move focus.\n- `true`: Move focus based on the default behavior (trigger or previously focused element).\n- `RefObject`: Move focus to the ref element.\n- `function`: Called with the interaction type (`mouse`, `touch`, `pen`, or `keyboard`).\n Return an element to focus, `true` to use the default behavior, or `false`/`undefined` to do nothing.",
|
|
12661
|
+
"source": "base-ui"
|
|
12601
12662
|
},
|
|
12602
12663
|
{
|
|
12603
|
-
"name": "
|
|
12604
|
-
"type": "
|
|
12664
|
+
"name": "initialFocus",
|
|
12665
|
+
"type": "boolean | RefObject<HTMLElement | null> | ((openType: InteractionType) => boolean | void | HTMLElement | null)",
|
|
12605
12666
|
"required": false,
|
|
12606
|
-
"
|
|
12607
|
-
"
|
|
12608
|
-
"source": "dodo"
|
|
12667
|
+
"description": "Determines the element to focus when the drawer is opened.\n\n- `false`: Do not move focus.\n- `true`: Move focus based on the default behavior (first tabbable element or popup).\n- `RefObject`: Move focus to the ref element.\n- `function`: Called with the interaction type (`mouse`, `touch`, `pen`, or `keyboard`).\n Return an element to focus, `true` to use the default behavior, or `false`/`undefined` to do nothing.",
|
|
12668
|
+
"source": "base-ui"
|
|
12609
12669
|
},
|
|
12610
12670
|
{
|
|
12611
12671
|
"name": "render",
|
|
12612
|
-
"type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps,
|
|
12672
|
+
"type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, DrawerPopupState>",
|
|
12613
12673
|
"required": false,
|
|
12614
12674
|
"description": "Allows you to replace the component's HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render.",
|
|
12615
12675
|
"source": "base-ui"
|
|
12616
12676
|
}
|
|
12617
12677
|
]
|
|
12618
|
-
}
|
|
12619
|
-
],
|
|
12620
|
-
"examples": [
|
|
12621
|
-
{
|
|
12622
|
-
"name": "empty/create-first",
|
|
12623
|
-
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport { Empty } from \"@dodopayments/ui/empty\";\nimport { BoxPlusIcon } from \"@dodopayments/ui/icons\";\nimport { useEffect, useState } from \"react\";\n\nconst SAMPLES = [\n { name: \"Pro plan\", price: \"$29.00 / month\" },\n { name: \"Framer template\", price: \"$49.00 one time\" },\n { name: \"API credits\", price: \"$0.002 per request\" },\n];\n\nexport default function EmptyCreateFirst() {\n const [count, setCount] = useState(0);\n const [creating, setCreating] = useState(false);\n\n useEffect(() => {\n if (!creating) return;\n const timer = setTimeout(() => {\n setCreating(false);\n setCount((value) => Math.min(value + 1, SAMPLES.length));\n }, 800);\n return () => clearTimeout(timer);\n }, [creating]);\n\n const products = SAMPLES.slice(0, count);\n\n return (\n <div className=\"flex min-h-70 w-full max-w-md flex-col rounded-2xl border border-border bg-background p-5\">\n {products.length === 0 ? (\n <Empty\n className=\"flex-1 justify-center\"\n titleAs=\"h3\"\n icon={<BoxPlusIcon />}\n title=\"No products yet\"\n description=\"Create a product to start accepting one-time payments and subscriptions.\"\n action={\n <Button loading={creating} loadingText=\"Creating…\" onClick={() => setCreating(true)}>\n Create product\n </Button>\n }\n />\n ) : (\n <div className=\"flex flex-col gap-4\">\n <div className=\"flex items-center justify-between gap-3\">\n <h3 className=\"font-heading text-heading-quaternary text-foreground\">Products</h3>\n <Button variant=\"ghost\" size=\"xs\" onClick={() => setCount(0)}>\n Clear\n </Button>\n </div>\n <ul className=\"flex flex-col divide-y divide-border\">\n {products.map((product) => (\n <li key={product.name} className=\"flex items-center justify-between gap-4 py-3\">\n <span className=\"text-label-primary text-foreground\">{product.name}</span>\n <span className=\"text-body-primary text-muted-foreground\">{product.price}</span>\n </li>\n ))}\n </ul>\n {count < SAMPLES.length ? (\n <Button\n variant=\"secondary\"\n className=\"self-start\"\n loading={creating}\n loadingText=\"Creating…\"\n onClick={() => setCreating(true)}\n >\n Create product\n </Button>\n ) : null}\n </div>\n )}\n </div>\n );\n}"
|
|
12624
|
-
},
|
|
12625
|
-
{
|
|
12626
|
-
"name": "empty/master",
|
|
12627
|
-
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport { Empty } from \"@dodopayments/ui/empty\";\nimport { ClockIcon } from \"@dodopayments/ui/icons\";\n\nexport default function EmptyMaster() {\n return (\n <Empty\n icon={<ClockIcon />}\n title=\"No disputes yet\"\n description=\"Records will show up here after your first dispute is opened.\"\n action={<Button variant=\"secondary\">Learn about disputes</Button>}\n />\n );\n}"
|
|
12628
|
-
},
|
|
12629
|
-
{
|
|
12630
|
-
"name": "empty/no-results",
|
|
12631
|
-
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport { Empty } from \"@dodopayments/ui/empty\";\nimport { MagnifierIcon } from \"@dodopayments/ui/icons\";\nimport { Input } from \"@dodopayments/ui/input\";\nimport { useState } from \"react\";\n\nconst CUSTOMERS = [\n { name: \"Priya Shah\", email: \"priya@lumen.studio\" },\n { name: \"Lucas Meyer\", email: \"lucas@northwind.de\" },\n { name: \"Ana Souza\", email: \"ana@pixelfarm.io\" },\n { name: \"Kenji Ito\", email: \"kenji@tsuki.app\" },\n];\n\nexport default function EmptyNoResults() {\n const [query, setQuery] = useState(\"zebra\");\n const q = query.trim().toLowerCase();\n const matches = CUSTOMERS.filter(\n (customer) => customer.name.toLowerCase().includes(q) || customer.email.includes(q),\n );\n\n return (\n <div className=\"flex min-h-70 w-full max-w-md flex-col gap-4 rounded-2xl border border-border bg-background p-5\">\n <Input\n type=\"search\"\n aria-label=\"Search customers\"\n placeholder=\"Search by name or email\"\n leadingIcon={<MagnifierIcon />}\n value={query}\n onChange={(event) => setQuery(event.target.value)}\n />\n {matches.length === 0 ? (\n <Empty\n className=\"flex-1 justify-center\"\n titleAs=\"h3\"\n icon={<MagnifierIcon />}\n title=\"No customers found\"\n description={`Nothing matches “${query.trim()}”. Check the spelling or search by email.`}\n action={\n <Button variant=\"secondary\" onClick={() => setQuery(\"\")}>\n Clear search\n </Button>\n }\n />\n ) : (\n <ul className=\"flex flex-col divide-y divide-border\">\n {matches.map((customer) => (\n <li key={customer.email} className=\"flex items-center justify-between gap-4 py-3\">\n <span className=\"text-label-primary text-foreground\">{customer.name}</span>\n <span className=\"truncate text-body-primary text-muted-foreground\">\n {customer.email}\n </span>\n </li>\n ))}\n </ul>\n )}\n </div>\n );\n}"
|
|
12632
12678
|
},
|
|
12633
12679
|
{
|
|
12634
|
-
"name": "
|
|
12635
|
-
"
|
|
12636
|
-
}
|
|
12637
|
-
],
|
|
12638
|
-
"docsUrl": "/components/empty"
|
|
12639
|
-
},
|
|
12640
|
-
{
|
|
12641
|
-
"slug": "field",
|
|
12642
|
-
"title": "Field",
|
|
12643
|
-
"category": "Forms",
|
|
12644
|
-
"status": "stable",
|
|
12645
|
-
"description": "Groups a label, description, control and error message and wires them together: the label and\nmessages are linked to the control (`htmlFor`, `aria-describedby`) and the control gets\n`aria-invalid` + `data-invalid` when validation fails, which switches `Input` to its destructive\nborder. When a submit of the surrounding `Form` (or `FormField`) fails while the field is invalid,\nits control shakes once (`animate-shake`); typing never shakes it. Renders the `Field` primitive\non Base UI `Field.Root`.\n\nPass `label` (and `description`, `required`, `help`, `action`, `error`) to get the Dodo Nest\nField: `layout=\"vertical\"` (default) for forms, `layout=\"horizontal\"` for settings rows with the\ncontrol (a Switch, a 160px Select, a Button) on the trailing side and optional `expanded` content.\n`children` is then the control. Without `label`, compose the parts as children.",
|
|
12646
|
-
"importPath": "@dodopayments/ui/field",
|
|
12647
|
-
"exports": [
|
|
12648
|
-
"DODO_FIELD_DEFAULT_VARIANTS",
|
|
12649
|
-
"DODO_FIELD_VARIANTS",
|
|
12650
|
-
"Field",
|
|
12651
|
-
"FieldControl",
|
|
12652
|
-
"FieldControlProps",
|
|
12653
|
-
"FieldDescription",
|
|
12654
|
-
"FieldDescriptionProps",
|
|
12655
|
-
"FieldError",
|
|
12656
|
-
"FieldErrorProps",
|
|
12657
|
-
"FieldLabel",
|
|
12658
|
-
"FieldLabelProps",
|
|
12659
|
-
"FieldProps",
|
|
12660
|
-
"fieldVariants"
|
|
12661
|
-
],
|
|
12662
|
-
"parts": [
|
|
12663
|
-
{
|
|
12664
|
-
"name": "Field",
|
|
12665
|
-
"description": "Groups a label, description, control and error message and wires them together: the label and\nmessages are linked to the control (`htmlFor`, `aria-describedby`) and the control gets\n`aria-invalid` + `data-invalid` when validation fails, which switches `Input` to its destructive\nborder. When a submit of the surrounding `Form` (or `FormField`) fails while the field is invalid,\nits control shakes once (`animate-shake`); typing never shakes it. Renders the `Field` primitive\non Base UI `Field.Root`.\n\nPass `label` (and `description`, `required`, `help`, `action`, `error`) to get the Dodo Nest\nField: `layout=\"vertical\"` (default) for forms, `layout=\"horizontal\"` for settings rows with the\ncontrol (a Switch, a 160px Select, a Button) on the trailing side and optional `expanded` content.\n`children` is then the control. Without `label`, compose the parts as children.",
|
|
12680
|
+
"name": "Drawer",
|
|
12681
|
+
"description": "Root of a drawer: a modal panel that slides up from the bottom edge and closes with a swipe down, a tap on the\nscrim or Escape (the `Drawer` primitive on Base UI Drawer). Controls open state (`open` / `onOpenChange` or\n`defaultOpen`). `snapPoints` (fractions of the viewport, or px / rem lengths) let it rest at several heights.\nBuilt for phones: on wide screens use a `Dialog` or a `Sheet`.",
|
|
12666
12682
|
"props": [
|
|
12667
12683
|
{
|
|
12668
|
-
"name": "
|
|
12669
|
-
"type": "
|
|
12684
|
+
"name": "actionsRef",
|
|
12685
|
+
"type": "RefObject<DrawerRootActions | null>",
|
|
12670
12686
|
"required": false,
|
|
12671
|
-
"description": "A
|
|
12672
|
-
"source": "
|
|
12687
|
+
"description": "A ref to imperative actions.\n- `unmount`: Manually unmounts the drawer.\nCall this after any externally controlled closing animation finishes.\n- `close`: Closes the drawer imperatively when called.",
|
|
12688
|
+
"source": "base-ui"
|
|
12673
12689
|
},
|
|
12674
12690
|
{
|
|
12675
|
-
"name": "
|
|
12676
|
-
"type": "
|
|
12691
|
+
"name": "defaultOpen",
|
|
12692
|
+
"type": "boolean",
|
|
12677
12693
|
"required": false,
|
|
12678
|
-
"
|
|
12679
|
-
"
|
|
12694
|
+
"default": "false",
|
|
12695
|
+
"description": "Whether the drawer is initially open.\n\nTo render a controlled drawer, use the `open` prop instead.",
|
|
12696
|
+
"source": "base-ui"
|
|
12680
12697
|
},
|
|
12681
12698
|
{
|
|
12682
|
-
"name": "
|
|
12683
|
-
"type": "
|
|
12699
|
+
"name": "defaultSnapPoint",
|
|
12700
|
+
"type": "DrawerSnapPoint | null",
|
|
12701
|
+
"required": false,
|
|
12702
|
+
"description": "The initial snap point value when uncontrolled.",
|
|
12703
|
+
"source": "base-ui"
|
|
12704
|
+
},
|
|
12705
|
+
{
|
|
12706
|
+
"name": "defaultTriggerId",
|
|
12707
|
+
"type": "string | null",
|
|
12708
|
+
"required": false,
|
|
12709
|
+
"description": "ID of the trigger that the drawer is associated with.\nThis is useful in conjunction with the `defaultOpen` prop to create an initially open drawer.",
|
|
12710
|
+
"source": "base-ui"
|
|
12711
|
+
},
|
|
12712
|
+
{
|
|
12713
|
+
"name": "disablePointerDismissal",
|
|
12714
|
+
"type": "boolean",
|
|
12715
|
+
"required": false,
|
|
12716
|
+
"default": "false",
|
|
12717
|
+
"description": "Whether to prevent the drawer from closing on outside presses.\nFor non-modal drawers, this also prevents the drawer from closing when focus moves outside of it.",
|
|
12718
|
+
"source": "base-ui"
|
|
12719
|
+
},
|
|
12720
|
+
{
|
|
12721
|
+
"name": "handle",
|
|
12722
|
+
"type": "DrawerHandle<unknown>",
|
|
12723
|
+
"required": false,
|
|
12724
|
+
"description": "A handle to associate the drawer with a trigger.\nIf specified, allows detached triggers to control the drawer's open state.\nCan be created with the Drawer.createHandle() method.",
|
|
12725
|
+
"source": "base-ui"
|
|
12726
|
+
},
|
|
12727
|
+
{
|
|
12728
|
+
"name": "modal",
|
|
12729
|
+
"type": "boolean | \"trap-focus\"",
|
|
12730
|
+
"required": false,
|
|
12731
|
+
"default": "true",
|
|
12732
|
+
"description": "Determines if the drawer enters a modal state when open.\n- `true`: user interaction is limited to just the drawer: focus is trapped, document page scroll is locked, and pointer interactions on outside elements are disabled.\n- `false`: user interaction with the rest of the document is allowed.\n- `'trap-focus'`: focus is trapped inside the drawer, but document page scroll is not locked and pointer interactions outside of it remain enabled.",
|
|
12733
|
+
"source": "base-ui"
|
|
12734
|
+
},
|
|
12735
|
+
{
|
|
12736
|
+
"name": "onOpenChange",
|
|
12737
|
+
"type": "((open: boolean, eventDetails: DrawerRootChangeEventDetails) => void)",
|
|
12738
|
+
"required": false,
|
|
12739
|
+
"description": "Event handler called when the drawer is opened or closed.",
|
|
12740
|
+
"source": "base-ui"
|
|
12741
|
+
},
|
|
12742
|
+
{
|
|
12743
|
+
"name": "onOpenChangeComplete",
|
|
12744
|
+
"type": "((open: boolean) => void)",
|
|
12745
|
+
"required": false,
|
|
12746
|
+
"description": "Event handler called after any animations complete when the drawer is opened or closed.",
|
|
12747
|
+
"source": "base-ui"
|
|
12748
|
+
},
|
|
12749
|
+
{
|
|
12750
|
+
"name": "onSnapPointChange",
|
|
12751
|
+
"type": "((snapPoint: DrawerSnapPoint | null, eventDetails: DrawerRootSnapPointChangeEventDetails) => void)",
|
|
12752
|
+
"required": false,
|
|
12753
|
+
"description": "Callback fired when the snap point changes.",
|
|
12754
|
+
"source": "base-ui"
|
|
12755
|
+
},
|
|
12756
|
+
{
|
|
12757
|
+
"name": "open",
|
|
12758
|
+
"type": "boolean",
|
|
12759
|
+
"required": false,
|
|
12760
|
+
"description": "Whether the drawer is currently open.",
|
|
12761
|
+
"source": "base-ui"
|
|
12762
|
+
},
|
|
12763
|
+
{
|
|
12764
|
+
"name": "snapPoint",
|
|
12765
|
+
"type": "DrawerSnapPoint | null",
|
|
12766
|
+
"required": false,
|
|
12767
|
+
"description": "The currently active snap point. Use with `onSnapPointChange` to control the snap point.",
|
|
12768
|
+
"source": "base-ui"
|
|
12769
|
+
},
|
|
12770
|
+
{
|
|
12771
|
+
"name": "snapPoints",
|
|
12772
|
+
"type": "DrawerSnapPoint[]",
|
|
12773
|
+
"required": false,
|
|
12774
|
+
"description": "Snap points used to position the drawer.\nUse numbers between 0 and 1 to represent fractions of the viewport height,\nnumbers greater than 1 as pixel values, or strings in `px`/`rem` units\n(for example, `'148px'` or `'30rem'`).",
|
|
12775
|
+
"source": "base-ui"
|
|
12776
|
+
},
|
|
12777
|
+
{
|
|
12778
|
+
"name": "snapToSequentialPoints",
|
|
12779
|
+
"type": "boolean",
|
|
12780
|
+
"required": false,
|
|
12781
|
+
"default": "false",
|
|
12782
|
+
"description": "Disables velocity-based snap skipping so drag distance determines the next snap point.",
|
|
12783
|
+
"source": "base-ui"
|
|
12784
|
+
},
|
|
12785
|
+
{
|
|
12786
|
+
"name": "triggerId",
|
|
12787
|
+
"type": "string | null",
|
|
12788
|
+
"required": false,
|
|
12789
|
+
"description": "ID of the trigger that the drawer is associated with.\nThis is useful in conjunction with the `open` prop to create a controlled drawer.\nThere's no need to specify this prop when the drawer is uncontrolled (that is, when the `open` prop is not set).",
|
|
12790
|
+
"source": "base-ui"
|
|
12791
|
+
}
|
|
12792
|
+
]
|
|
12793
|
+
},
|
|
12794
|
+
{
|
|
12795
|
+
"name": "DrawerClose",
|
|
12796
|
+
"description": "Closes the drawer. Use `render={<Button variant=\"secondary\" />}` for a footer action.",
|
|
12797
|
+
"props": [
|
|
12798
|
+
{
|
|
12799
|
+
"name": "className",
|
|
12800
|
+
"type": "string",
|
|
12801
|
+
"required": false,
|
|
12802
|
+
"description": "Additional Tailwind classes, merged last.",
|
|
12803
|
+
"source": "dodo"
|
|
12804
|
+
},
|
|
12805
|
+
{
|
|
12806
|
+
"name": "nativeButton",
|
|
12807
|
+
"type": "boolean",
|
|
12808
|
+
"required": false,
|
|
12809
|
+
"default": "true",
|
|
12810
|
+
"description": "Whether the component renders a native `<button>` element when replacing it\nvia the `render` prop.\nSet to `false` if the rendered element is not a button (for example, `<div>`).",
|
|
12811
|
+
"source": "base-ui"
|
|
12812
|
+
},
|
|
12813
|
+
{
|
|
12814
|
+
"name": "render",
|
|
12815
|
+
"type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, DrawerCloseState>",
|
|
12816
|
+
"required": false,
|
|
12817
|
+
"description": "Allows you to replace the component's HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render.",
|
|
12818
|
+
"source": "base-ui"
|
|
12819
|
+
}
|
|
12820
|
+
]
|
|
12821
|
+
},
|
|
12822
|
+
{
|
|
12823
|
+
"name": "DrawerDescription",
|
|
12824
|
+
"description": "One or two lines under the title; becomes the drawer's accessible description.",
|
|
12825
|
+
"props": [
|
|
12826
|
+
{
|
|
12827
|
+
"name": "className",
|
|
12828
|
+
"type": "string",
|
|
12829
|
+
"required": false,
|
|
12830
|
+
"description": "Additional Tailwind classes, merged last.",
|
|
12831
|
+
"source": "dodo"
|
|
12832
|
+
},
|
|
12833
|
+
{
|
|
12834
|
+
"name": "render",
|
|
12835
|
+
"type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, DrawerDescriptionState>",
|
|
12836
|
+
"required": false,
|
|
12837
|
+
"description": "Allows you to replace the component's HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render.",
|
|
12838
|
+
"source": "base-ui"
|
|
12839
|
+
}
|
|
12840
|
+
]
|
|
12841
|
+
},
|
|
12842
|
+
{
|
|
12843
|
+
"name": "DrawerFooter",
|
|
12844
|
+
"description": "The actions, on the grey strip under the panel. They share the row: cancel first, the primary action last.",
|
|
12845
|
+
"props": []
|
|
12846
|
+
},
|
|
12847
|
+
{
|
|
12848
|
+
"name": "DrawerHeader",
|
|
12849
|
+
"description": "The top of the white panel: `DrawerTitle` and an optional `DrawerDescription`.",
|
|
12850
|
+
"props": []
|
|
12851
|
+
},
|
|
12852
|
+
{
|
|
12853
|
+
"name": "DrawerPanel",
|
|
12854
|
+
"description": "The body of the white panel. It scrolls inside the drawer, under the header and above the footer.",
|
|
12855
|
+
"props": [
|
|
12856
|
+
{
|
|
12857
|
+
"name": "scrollFade",
|
|
12858
|
+
"type": "boolean",
|
|
12859
|
+
"required": false,
|
|
12860
|
+
"default": "true",
|
|
12861
|
+
"description": "Fade the content at the edges it scrolls under.",
|
|
12862
|
+
"source": "dodo"
|
|
12863
|
+
}
|
|
12864
|
+
]
|
|
12865
|
+
},
|
|
12866
|
+
{
|
|
12867
|
+
"name": "DrawerTitle",
|
|
12868
|
+
"description": "The drawer's accessible name. Required.",
|
|
12869
|
+
"props": [
|
|
12870
|
+
{
|
|
12871
|
+
"name": "className",
|
|
12872
|
+
"type": "string",
|
|
12873
|
+
"required": false,
|
|
12874
|
+
"description": "Additional Tailwind classes, merged last.",
|
|
12875
|
+
"source": "dodo"
|
|
12876
|
+
},
|
|
12877
|
+
{
|
|
12878
|
+
"name": "render",
|
|
12879
|
+
"type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, DrawerTitleState>",
|
|
12880
|
+
"required": false,
|
|
12881
|
+
"description": "Allows you to replace the component's HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render.",
|
|
12882
|
+
"source": "base-ui"
|
|
12883
|
+
}
|
|
12884
|
+
]
|
|
12885
|
+
},
|
|
12886
|
+
{
|
|
12887
|
+
"name": "DrawerTrigger",
|
|
12888
|
+
"description": "Opens the drawer. Use `render={<Button />}` to style it as a Dodo button.",
|
|
12889
|
+
"props": [
|
|
12890
|
+
{
|
|
12891
|
+
"name": "className",
|
|
12892
|
+
"type": "string",
|
|
12893
|
+
"required": false,
|
|
12894
|
+
"description": "Additional Tailwind classes, merged last.",
|
|
12895
|
+
"source": "dodo"
|
|
12896
|
+
},
|
|
12897
|
+
{
|
|
12898
|
+
"name": "handle",
|
|
12899
|
+
"type": "DrawerHandle<unknown>",
|
|
12900
|
+
"required": false,
|
|
12901
|
+
"description": "A handle to associate the trigger with a drawer.\nCan be created with the Drawer.createHandle() method.",
|
|
12902
|
+
"source": "base-ui"
|
|
12903
|
+
},
|
|
12904
|
+
{
|
|
12905
|
+
"name": "id",
|
|
12906
|
+
"type": "string",
|
|
12907
|
+
"required": false,
|
|
12908
|
+
"description": "ID of the trigger. In addition to being forwarded to the rendered element,\nit is also used to specify the active trigger for drawers in controlled mode (with the Drawer.Root `triggerId` prop).",
|
|
12909
|
+
"source": "base-ui"
|
|
12910
|
+
},
|
|
12911
|
+
{
|
|
12912
|
+
"name": "nativeButton",
|
|
12913
|
+
"type": "boolean",
|
|
12914
|
+
"required": false,
|
|
12915
|
+
"default": "true",
|
|
12916
|
+
"description": "Whether the component renders a native `<button>` element when replacing it\nvia the `render` prop.\nSet to `false` if the rendered element is not a button (for example, `<div>`).",
|
|
12917
|
+
"source": "base-ui"
|
|
12918
|
+
},
|
|
12919
|
+
{
|
|
12920
|
+
"name": "payload",
|
|
12921
|
+
"type": "unknown",
|
|
12922
|
+
"required": false,
|
|
12923
|
+
"description": "A payload to pass to the drawer when it is opened.",
|
|
12924
|
+
"source": "base-ui"
|
|
12925
|
+
},
|
|
12926
|
+
{
|
|
12927
|
+
"name": "render",
|
|
12928
|
+
"type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, DrawerTriggerState>",
|
|
12929
|
+
"required": false,
|
|
12930
|
+
"description": "Allows you to replace the component's HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render.",
|
|
12931
|
+
"source": "base-ui"
|
|
12932
|
+
}
|
|
12933
|
+
]
|
|
12934
|
+
}
|
|
12935
|
+
],
|
|
12936
|
+
"examples": [
|
|
12937
|
+
{
|
|
12938
|
+
"name": "drawer/basic",
|
|
12939
|
+
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport {\n Drawer,\n DrawerClose,\n DrawerContent,\n DrawerDescription,\n DrawerFooter,\n DrawerHeader,\n DrawerPanel,\n DrawerTitle,\n DrawerTrigger,\n} from \"@dodopayments/ui/drawer\";\nimport { Field, FieldDescription, FieldLabel } from \"@dodopayments/ui/field\";\nimport { Input } from \"@dodopayments/ui/input\";\n\nexport default function DrawerBasic() {\n return (\n <Drawer>\n <DrawerTrigger render={<Button variant=\"secondary\" />}>Initiate refund</DrawerTrigger>\n <DrawerContent>\n <DrawerHeader>\n <DrawerTitle>Initiate refund</DrawerTitle>\n <DrawerDescription>Payment pay_7Hq2Xa…Lm3d · $49.00 · Visa •••• 4242</DrawerDescription>\n </DrawerHeader>\n <DrawerPanel>\n <div className=\"flex flex-col gap-4\">\n <Field>\n <FieldLabel>Amount</FieldLabel>\n <Input type=\"money\" currency=\"USD\" defaultValue={4900} />\n </Field>\n <Field>\n <FieldLabel>Reason</FieldLabel>\n <FieldDescription>Shown to the customer on the refund receipt.</FieldDescription>\n <Input placeholder=\"Duplicate charge\" />\n </Field>\n </div>\n </DrawerPanel>\n <DrawerFooter>\n <DrawerClose render={<Button variant=\"secondary\" />}>Cancel</DrawerClose>\n <DrawerClose render={<Button />}>Refund $49.00</DrawerClose>\n </DrawerFooter>\n </DrawerContent>\n </Drawer>\n );\n}"
|
|
12940
|
+
},
|
|
12941
|
+
{
|
|
12942
|
+
"name": "drawer/master",
|
|
12943
|
+
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport {\n Drawer,\n DrawerClose,\n DrawerContent,\n DrawerDescription,\n DrawerFooter,\n DrawerHeader,\n DrawerTitle,\n DrawerTrigger,\n} from \"@dodopayments/ui/drawer\";\n\nexport default function DrawerMaster() {\n return (\n <Drawer>\n <DrawerTrigger render={<Button variant=\"secondary\" />}>Open drawer</DrawerTrigger>\n <DrawerContent>\n <DrawerHeader>\n <DrawerTitle>Pause subscription?</DrawerTitle>\n <DrawerDescription>\n Billing stops today. The customer keeps access until 14 December.\n </DrawerDescription>\n </DrawerHeader>\n <DrawerFooter>\n <DrawerClose render={<Button variant=\"secondary\" />}>Cancel</DrawerClose>\n <DrawerClose render={<Button variant=\"warning\" />}>Pause</DrawerClose>\n </DrawerFooter>\n </DrawerContent>\n </Drawer>\n );\n}"
|
|
12944
|
+
},
|
|
12945
|
+
{
|
|
12946
|
+
"name": "drawer/nested",
|
|
12947
|
+
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport {\n Drawer,\n DrawerClose,\n DrawerContent,\n DrawerDescription,\n DrawerFooter,\n DrawerHeader,\n DrawerTitle,\n DrawerTrigger,\n} from \"@dodopayments/ui/drawer\";\n\nexport default function DrawerNested() {\n return (\n <Drawer>\n <DrawerTrigger render={<Button variant=\"secondary\" />}>Cancel subscription</DrawerTrigger>\n <DrawerContent>\n <DrawerHeader>\n <DrawerTitle>Cancel subscription</DrawerTitle>\n <DrawerDescription>\n Pro plan · $49.00 a month. The customer keeps access until 14 December.\n </DrawerDescription>\n </DrawerHeader>\n <DrawerFooter>\n <DrawerClose render={<Button variant=\"secondary\" />}>Keep it</DrawerClose>\n <Drawer>\n <DrawerTrigger render={<Button variant=\"destructive\" />}>Cancel now</DrawerTrigger>\n <DrawerContent>\n <DrawerHeader>\n <DrawerTitle>Cancel right away?</DrawerTitle>\n <DrawerDescription>\n Access ends now and the unused days are not refunded.\n </DrawerDescription>\n </DrawerHeader>\n <DrawerFooter>\n <DrawerClose render={<Button variant=\"secondary\" />}>Back</DrawerClose>\n <DrawerClose render={<Button variant=\"destructive\" />}>Cancel now</DrawerClose>\n </DrawerFooter>\n </DrawerContent>\n </Drawer>\n </DrawerFooter>\n </DrawerContent>\n </Drawer>\n );\n}"
|
|
12948
|
+
},
|
|
12949
|
+
{
|
|
12950
|
+
"name": "drawer/snap-points",
|
|
12951
|
+
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport {\n Drawer,\n DrawerContent,\n DrawerDescription,\n DrawerHeader,\n DrawerPanel,\n DrawerTitle,\n DrawerTrigger,\n} from \"@dodopayments/ui/drawer\";\n\nconst EVENTS = [\n \"payment.succeeded\",\n \"payment.failed\",\n \"refund.succeeded\",\n \"subscription.active\",\n \"subscription.on_hold\",\n \"subscription.renewed\",\n \"subscription.cancelled\",\n \"dispute.opened\",\n \"dispute.won\",\n \"dispute.lost\",\n \"license_key.created\",\n \"payout.succeeded\",\n];\n\nexport default function DrawerSnapPoints() {\n return (\n <Drawer snapPoints={[0.5, 1]}>\n <DrawerTrigger render={<Button variant=\"secondary\" />}>Webhook events</DrawerTrigger>\n <DrawerContent>\n <DrawerHeader>\n <DrawerTitle>Webhook events</DrawerTitle>\n <DrawerDescription>Drag up to see the full list.</DrawerDescription>\n </DrawerHeader>\n <DrawerPanel>\n <ul className=\"flex flex-col gap-3\">\n {EVENTS.map((event) => (\n <li key={event} className=\"text-mono-primary text-foreground\">\n {event}\n </li>\n ))}\n </ul>\n </DrawerPanel>\n </DrawerContent>\n </Drawer>\n );\n}"
|
|
12952
|
+
}
|
|
12953
|
+
],
|
|
12954
|
+
"docsUrl": "/components/drawer"
|
|
12955
|
+
},
|
|
12956
|
+
{
|
|
12957
|
+
"slug": "direction-provider",
|
|
12958
|
+
"title": "Direction Provider",
|
|
12959
|
+
"category": "Utilities",
|
|
12960
|
+
"status": "stable",
|
|
12961
|
+
"description": "Sets the reading direction for every component inside: keyboard navigation (arrow keys in menus,\ntabs, sliders, radio groups and tree views follow the reading order), slider and scroll positions,\nand the `side=\"start\"` / `side=\"end\"` of Sheet, Sidebar and the `-start` / `-end` Toaster\npositions, which resolve to the physical edge. Wrap the app once, next to `<html dir=\"rtl\">`;\nwith `asWrapper` it also renders a `<div dir>` for a mirrored region inside the page.",
|
|
12962
|
+
"importPath": "@dodopayments/ui/direction-provider",
|
|
12963
|
+
"exports": [
|
|
12964
|
+
"DirectionProvider",
|
|
12965
|
+
"DirectionProviderProps",
|
|
12966
|
+
"TextDirection",
|
|
12967
|
+
"useDirection"
|
|
12968
|
+
],
|
|
12969
|
+
"parts": [
|
|
12970
|
+
{
|
|
12971
|
+
"name": "DirectionProvider",
|
|
12972
|
+
"description": "Sets the reading direction for every component inside: keyboard navigation (arrow keys in menus,\ntabs, sliders, radio groups and tree views follow the reading order), slider and scroll positions,\nand the `side=\"start\"` / `side=\"end\"` of Sheet, Sidebar and the `-start` / `-end` Toaster\npositions, which resolve to the physical edge. Wrap the app once, next to `<html dir=\"rtl\">`;\nwith `asWrapper` it also renders a `<div dir>` for a mirrored region inside the page.",
|
|
12973
|
+
"props": [
|
|
12974
|
+
{
|
|
12975
|
+
"name": "asWrapper",
|
|
12976
|
+
"type": "boolean",
|
|
12977
|
+
"required": false,
|
|
12978
|
+
"default": "false",
|
|
12979
|
+
"description": "Also render a `<div dir>` around the children, for a right-to-left region inside a left-to-right\npage (a preview, an Arabic address card). For a whole app, leave it off and set `<html dir>`.",
|
|
12980
|
+
"source": "dodo"
|
|
12981
|
+
},
|
|
12982
|
+
{
|
|
12983
|
+
"name": "className",
|
|
12984
|
+
"type": "string",
|
|
12985
|
+
"required": false,
|
|
12986
|
+
"description": "Classes for the wrapper `<div>`. Only used with `asWrapper`.",
|
|
12987
|
+
"source": "dodo"
|
|
12988
|
+
},
|
|
12989
|
+
{
|
|
12990
|
+
"name": "direction",
|
|
12991
|
+
"type": "TextDirection",
|
|
12992
|
+
"required": false,
|
|
12993
|
+
"default": "\"ltr\"",
|
|
12994
|
+
"description": "Reading direction of everything inside. Set the same value on `<html dir>` so the CSS logical\nutilities (`ms-2`, `start-0`, `text-start`) and the `rtl:` variants mirror with it.",
|
|
12995
|
+
"source": "dodo"
|
|
12996
|
+
}
|
|
12997
|
+
]
|
|
12998
|
+
}
|
|
12999
|
+
],
|
|
13000
|
+
"api": [
|
|
13001
|
+
{
|
|
13002
|
+
"name": "useDirection",
|
|
13003
|
+
"kind": "function",
|
|
13004
|
+
"description": "The reading direction of the closest `DirectionProvider` (`\"ltr\"` outside one).",
|
|
13005
|
+
"members": [
|
|
13006
|
+
{
|
|
13007
|
+
"signature": "useDirection(): TextDirection",
|
|
13008
|
+
"description": "The reading direction of the closest `DirectionProvider` (`\"ltr\"` outside one)."
|
|
13009
|
+
}
|
|
13010
|
+
]
|
|
13011
|
+
}
|
|
13012
|
+
],
|
|
13013
|
+
"examples": [
|
|
13014
|
+
{
|
|
13015
|
+
"name": "direction-provider/basic",
|
|
13016
|
+
"code": "\"use client\";\n\nimport {\n Breadcrumb,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbList,\n BreadcrumbPage,\n BreadcrumbSeparator,\n} from \"@dodopayments/ui/breadcrumb\";\nimport { Button } from \"@dodopayments/ui/button\";\nimport { DirectionProvider, type TextDirection } from \"@dodopayments/ui/direction-provider\";\nimport { InputGroup, InputGroupAddon, InputGroupInput } from \"@dodopayments/ui/input-group\";\nimport { Tabs, TabsList, TabsTrigger } from \"@dodopayments/ui/tabs\";\nimport { useState } from \"react\";\n\nexport default function DirectionProviderBasic() {\n const [direction, setDirection] = useState<TextDirection>(\"rtl\");\n const next = direction === \"rtl\" ? \"ltr\" : \"rtl\";\n\n return (\n <div className=\"flex w-full max-w-md flex-col items-center gap-6\">\n <Button variant=\"secondary\" onClick={() => setDirection(next)}>\n Switch to {next.toUpperCase()}\n </Button>\n <DirectionProvider direction={direction} asWrapper className=\"flex w-full flex-col gap-4\">\n <Breadcrumb>\n <BreadcrumbList>\n <BreadcrumbItem>\n <BreadcrumbLink href=\"#home\">Home</BreadcrumbLink>\n </BreadcrumbItem>\n <BreadcrumbSeparator />\n <BreadcrumbItem>\n <BreadcrumbLink href=\"#products\">Products</BreadcrumbLink>\n </BreadcrumbItem>\n <BreadcrumbSeparator />\n <BreadcrumbItem>\n <BreadcrumbPage>Pro plan</BreadcrumbPage>\n </BreadcrumbItem>\n </BreadcrumbList>\n </Breadcrumb>\n <Tabs defaultValue=\"overview\">\n <TabsList aria-label=\"Customer sections\">\n <TabsTrigger value=\"overview\">Overview</TabsTrigger>\n <TabsTrigger value=\"payments\">Payments</TabsTrigger>\n <TabsTrigger value=\"refunds\">Refunds</TabsTrigger>\n </TabsList>\n </Tabs>\n <InputGroup>\n <InputGroupAddon>$</InputGroupAddon>\n <InputGroupInput aria-label=\"Price in USD\" inputMode=\"decimal\" placeholder=\"0.00\" />\n <InputGroupAddon>USD</InputGroupAddon>\n </InputGroup>\n </DirectionProvider>\n </div>\n );\n}"
|
|
13017
|
+
}
|
|
13018
|
+
],
|
|
13019
|
+
"docsUrl": "/components/direction-provider"
|
|
13020
|
+
},
|
|
13021
|
+
{
|
|
13022
|
+
"slug": "empty",
|
|
13023
|
+
"title": "Empty",
|
|
13024
|
+
"category": "Feedback",
|
|
13025
|
+
"status": "stable",
|
|
13026
|
+
"description": "What a page, card or table shows when there is nothing yet (Dodo Nest Empty state): an optional Featured icon\n(neutral, or `iconTone=\"error\"` when loading failed), a title (Label/Primary), an optional description (Body/Primary, Content/Secondary) and an optional action,\nin a centred column up to 360 wide. It has no container or padding of its own: put it where the content would be.\nThe title, description and action rise in one after the other.",
|
|
13027
|
+
"importPath": "@dodopayments/ui/empty",
|
|
13028
|
+
"exports": [
|
|
13029
|
+
"Empty",
|
|
13030
|
+
"EmptyProps"
|
|
13031
|
+
],
|
|
13032
|
+
"parts": [
|
|
13033
|
+
{
|
|
13034
|
+
"name": "Empty",
|
|
13035
|
+
"description": "What a page, card or table shows when there is nothing yet (Dodo Nest Empty state): an optional Featured icon\n(neutral, or `iconTone=\"error\"` when loading failed), a title (Label/Primary), an optional description (Body/Primary, Content/Secondary) and an optional action,\nin a centred column up to 360 wide. It has no container or padding of its own: put it where the content would be.\nThe title, description and action rise in one after the other.",
|
|
13036
|
+
"props": [
|
|
13037
|
+
{
|
|
13038
|
+
"name": "title",
|
|
13039
|
+
"type": "ReactNode",
|
|
13040
|
+
"required": true,
|
|
13041
|
+
"description": "What is empty, e.g. \"No payouts yet\".",
|
|
13042
|
+
"source": "dodo"
|
|
13043
|
+
},
|
|
13044
|
+
{
|
|
13045
|
+
"name": "action",
|
|
13046
|
+
"type": "ReactNode",
|
|
13047
|
+
"required": false,
|
|
13048
|
+
"description": "One next step, 16 below the text: a `Button` (primary when it is the main next step, secondary otherwise) or a\nlink styled with `buttonVariants()`.",
|
|
13049
|
+
"source": "dodo"
|
|
13050
|
+
},
|
|
13051
|
+
{
|
|
13052
|
+
"name": "description",
|
|
13053
|
+
"type": "ReactNode",
|
|
13054
|
+
"required": false,
|
|
13055
|
+
"description": "What will appear and how to get it, e.g. \"Add a bank account to start receiving payouts.\"",
|
|
13056
|
+
"source": "dodo"
|
|
13057
|
+
},
|
|
13058
|
+
{
|
|
13059
|
+
"name": "icon",
|
|
13060
|
+
"type": "ReactNode",
|
|
13061
|
+
"required": false,
|
|
13062
|
+
"description": "Glyph of the Featured icon above the title, e.g. one from `@dodopayments/ui/icons`. Omit for no icon.",
|
|
13063
|
+
"source": "dodo"
|
|
13064
|
+
},
|
|
13065
|
+
{
|
|
13066
|
+
"name": "iconTone",
|
|
13067
|
+
"type": "\"info\" | \"success\" | \"warning\" | \"error\" | \"violet\" | \"neutral\" | \"pink\" | \"orange\" | null",
|
|
13068
|
+
"required": false,
|
|
13069
|
+
"default": "\"neutral\"",
|
|
13070
|
+
"description": "Tone of the Featured icon. Keep `neutral` for empty states; use `error` when the content failed to load.",
|
|
13071
|
+
"source": "dodo"
|
|
13072
|
+
},
|
|
13073
|
+
{
|
|
13074
|
+
"name": "titleAs",
|
|
13075
|
+
"type": "\"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\" | \"p\"",
|
|
13076
|
+
"required": false,
|
|
13077
|
+
"default": "\"h2\"",
|
|
13078
|
+
"description": "Element used for the title. Match the heading outline of the page, or use `\"p\"` when it must not be a heading.",
|
|
13079
|
+
"source": "dodo"
|
|
13080
|
+
},
|
|
13081
|
+
{
|
|
13082
|
+
"name": "render",
|
|
13083
|
+
"type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, {}>",
|
|
13084
|
+
"required": false,
|
|
13085
|
+
"description": "Allows you to replace the component's HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render.",
|
|
13086
|
+
"source": "base-ui"
|
|
13087
|
+
}
|
|
13088
|
+
]
|
|
13089
|
+
}
|
|
13090
|
+
],
|
|
13091
|
+
"examples": [
|
|
13092
|
+
{
|
|
13093
|
+
"name": "empty/create-first",
|
|
13094
|
+
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport { Empty } from \"@dodopayments/ui/empty\";\nimport { BoxPlusIcon } from \"@dodopayments/ui/icons\";\nimport { useEffect, useState } from \"react\";\n\nconst SAMPLES = [\n { name: \"Pro plan\", price: \"$29.00 / month\" },\n { name: \"Framer template\", price: \"$49.00 one time\" },\n { name: \"API credits\", price: \"$0.002 per request\" },\n];\n\nexport default function EmptyCreateFirst() {\n const [count, setCount] = useState(0);\n const [creating, setCreating] = useState(false);\n\n useEffect(() => {\n if (!creating) return;\n const timer = setTimeout(() => {\n setCreating(false);\n setCount((value) => Math.min(value + 1, SAMPLES.length));\n }, 800);\n return () => clearTimeout(timer);\n }, [creating]);\n\n const products = SAMPLES.slice(0, count);\n\n return (\n <div className=\"flex min-h-70 w-full max-w-md flex-col rounded-2xl border border-border bg-background p-5\">\n {products.length === 0 ? (\n <Empty\n className=\"flex-1 justify-center\"\n titleAs=\"h3\"\n icon={<BoxPlusIcon />}\n title=\"No products yet\"\n description=\"Create a product to start accepting one-time payments and subscriptions.\"\n action={\n <Button loading={creating} loadingText=\"Creating…\" onClick={() => setCreating(true)}>\n Create product\n </Button>\n }\n />\n ) : (\n <div className=\"flex flex-col gap-4\">\n <div className=\"flex items-center justify-between gap-3\">\n <h3 className=\"font-heading text-heading-quaternary text-foreground\">Products</h3>\n <Button variant=\"ghost\" size=\"xs\" onClick={() => setCount(0)}>\n Clear\n </Button>\n </div>\n <ul className=\"flex flex-col divide-y divide-border\">\n {products.map((product) => (\n <li key={product.name} className=\"flex items-center justify-between gap-4 py-3\">\n <span className=\"text-label-primary text-foreground\">{product.name}</span>\n <span className=\"text-body-primary text-muted-foreground\">{product.price}</span>\n </li>\n ))}\n </ul>\n {count < SAMPLES.length ? (\n <Button\n variant=\"secondary\"\n className=\"self-start\"\n loading={creating}\n loadingText=\"Creating…\"\n onClick={() => setCreating(true)}\n >\n Create product\n </Button>\n ) : null}\n </div>\n )}\n </div>\n );\n}"
|
|
13095
|
+
},
|
|
13096
|
+
{
|
|
13097
|
+
"name": "empty/master",
|
|
13098
|
+
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport { Empty } from \"@dodopayments/ui/empty\";\nimport { ClockIcon } from \"@dodopayments/ui/icons\";\n\nexport default function EmptyMaster() {\n return (\n <Empty\n icon={<ClockIcon />}\n title=\"No disputes yet\"\n description=\"Records will show up here after your first dispute is opened.\"\n action={<Button variant=\"secondary\">Learn about disputes</Button>}\n />\n );\n}"
|
|
13099
|
+
},
|
|
13100
|
+
{
|
|
13101
|
+
"name": "empty/no-results",
|
|
13102
|
+
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport { Empty } from \"@dodopayments/ui/empty\";\nimport { MagnifierIcon } from \"@dodopayments/ui/icons\";\nimport { Input } from \"@dodopayments/ui/input\";\nimport { useState } from \"react\";\n\nconst CUSTOMERS = [\n { name: \"Priya Shah\", email: \"priya@lumen.studio\" },\n { name: \"Lucas Meyer\", email: \"lucas@northwind.de\" },\n { name: \"Ana Souza\", email: \"ana@pixelfarm.io\" },\n { name: \"Kenji Ito\", email: \"kenji@tsuki.app\" },\n];\n\nexport default function EmptyNoResults() {\n const [query, setQuery] = useState(\"zebra\");\n const q = query.trim().toLowerCase();\n const matches = CUSTOMERS.filter(\n (customer) => customer.name.toLowerCase().includes(q) || customer.email.includes(q),\n );\n\n return (\n <div className=\"flex min-h-70 w-full max-w-md flex-col gap-4 rounded-2xl border border-border bg-background p-5\">\n <Input\n type=\"search\"\n aria-label=\"Search customers\"\n placeholder=\"Search by name or email\"\n leadingIcon={<MagnifierIcon />}\n value={query}\n onChange={(event) => setQuery(event.target.value)}\n />\n {matches.length === 0 ? (\n <Empty\n className=\"flex-1 justify-center\"\n titleAs=\"h3\"\n icon={<MagnifierIcon />}\n title=\"No customers found\"\n description={`Nothing matches “${query.trim()}”. Check the spelling or search by email.`}\n action={\n <Button variant=\"secondary\" onClick={() => setQuery(\"\")}>\n Clear search\n </Button>\n }\n />\n ) : (\n <ul className=\"flex flex-col divide-y divide-border\">\n {matches.map((customer) => (\n <li key={customer.email} className=\"flex items-center justify-between gap-4 py-3\">\n <span className=\"text-label-primary text-foreground\">{customer.name}</span>\n <span className=\"truncate text-body-primary text-muted-foreground\">\n {customer.email}\n </span>\n </li>\n ))}\n </ul>\n )}\n </div>\n );\n}"
|
|
13103
|
+
},
|
|
13104
|
+
{
|
|
13105
|
+
"name": "empty/screen",
|
|
13106
|
+
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport { Empty } from \"@dodopayments/ui/empty\";\nimport { BoxPlusIcon } from \"@dodopayments/ui/icons\";\n\nexport default function EmptyScreen() {\n return (\n <Empty\n className=\"py-12\"\n titleAs=\"h3\"\n icon={<BoxPlusIcon />}\n title=\"No products yet\"\n description=\"Create a product to start accepting one-time payments and subscriptions.\"\n action={<Button>Create product</Button>}\n />\n );\n}"
|
|
13107
|
+
}
|
|
13108
|
+
],
|
|
13109
|
+
"docsUrl": "/components/empty"
|
|
13110
|
+
},
|
|
13111
|
+
{
|
|
13112
|
+
"slug": "field",
|
|
13113
|
+
"title": "Field",
|
|
13114
|
+
"category": "Forms",
|
|
13115
|
+
"status": "stable",
|
|
13116
|
+
"description": "Groups a label, description, control and error message and wires them together: the label and\nmessages are linked to the control (`htmlFor`, `aria-describedby`) and the control gets\n`aria-invalid` + `data-invalid` when validation fails, which switches `Input` to its destructive\nborder. When a submit of the surrounding `Form` (or `FormField`) fails while the field is invalid,\nits control shakes once (`animate-shake`); typing never shakes it. Renders the `Field` primitive\non Base UI `Field.Root`.\n\nPass `label` (and `description`, `required`, `help`, `action`, `error`) to get the Dodo Nest\nField: `layout=\"vertical\"` (default) for forms, `layout=\"horizontal\"` for settings rows with the\ncontrol (a Switch, a 160px Select, a Button) on the trailing side and optional `expanded` content.\n`children` is then the control. Without `label`, compose the parts as children.",
|
|
13117
|
+
"importPath": "@dodopayments/ui/field",
|
|
13118
|
+
"exports": [
|
|
13119
|
+
"DODO_FIELD_DEFAULT_VARIANTS",
|
|
13120
|
+
"DODO_FIELD_VARIANTS",
|
|
13121
|
+
"Field",
|
|
13122
|
+
"FieldControl",
|
|
13123
|
+
"FieldControlProps",
|
|
13124
|
+
"FieldDescription",
|
|
13125
|
+
"FieldDescriptionProps",
|
|
13126
|
+
"FieldError",
|
|
13127
|
+
"FieldErrorProps",
|
|
13128
|
+
"FieldLabel",
|
|
13129
|
+
"FieldLabelProps",
|
|
13130
|
+
"FieldProps",
|
|
13131
|
+
"fieldVariants"
|
|
13132
|
+
],
|
|
13133
|
+
"parts": [
|
|
13134
|
+
{
|
|
13135
|
+
"name": "Field",
|
|
13136
|
+
"description": "Groups a label, description, control and error message and wires them together: the label and\nmessages are linked to the control (`htmlFor`, `aria-describedby`) and the control gets\n`aria-invalid` + `data-invalid` when validation fails, which switches `Input` to its destructive\nborder. When a submit of the surrounding `Form` (or `FormField`) fails while the field is invalid,\nits control shakes once (`animate-shake`); typing never shakes it. Renders the `Field` primitive\non Base UI `Field.Root`.\n\nPass `label` (and `description`, `required`, `help`, `action`, `error`) to get the Dodo Nest\nField: `layout=\"vertical\"` (default) for forms, `layout=\"horizontal\"` for settings rows with the\ncontrol (a Switch, a 160px Select, a Button) on the trailing side and optional `expanded` content.\n`children` is then the control. Without `label`, compose the parts as children.",
|
|
13137
|
+
"props": [
|
|
13138
|
+
{
|
|
13139
|
+
"name": "action",
|
|
13140
|
+
"type": "ReactNode",
|
|
13141
|
+
"required": false,
|
|
13142
|
+
"description": "A small action on the trailing side of the header, bottom-aligned with the description, e.g.\n`<Button variant=\"secondary\" size=\"xs\">Add translation</Button>`. Vertical layout only.",
|
|
13143
|
+
"source": "dodo"
|
|
13144
|
+
},
|
|
13145
|
+
{
|
|
13146
|
+
"name": "className",
|
|
13147
|
+
"type": "string",
|
|
13148
|
+
"required": false,
|
|
13149
|
+
"description": "Additional Tailwind classes, merged last.",
|
|
13150
|
+
"source": "dodo"
|
|
13151
|
+
},
|
|
13152
|
+
{
|
|
13153
|
+
"name": "description",
|
|
13154
|
+
"type": "ReactNode",
|
|
12684
13155
|
"required": false,
|
|
12685
13156
|
"description": "Helper text under the label (Body/Secondary, Content/Secondary), 2 below it.",
|
|
12686
13157
|
"source": "dodo"
|
|
@@ -12924,7 +13395,7 @@
|
|
|
12924
13395
|
},
|
|
12925
13396
|
{
|
|
12926
13397
|
"name": "size",
|
|
12927
|
-
"type": "\"lg\" | null",
|
|
13398
|
+
"type": "\"sm\" | \"lg\" | null",
|
|
12928
13399
|
"required": false,
|
|
12929
13400
|
"description": "",
|
|
12930
13401
|
"source": "dodo"
|
|
@@ -13501,7 +13972,7 @@
|
|
|
13501
13972
|
},
|
|
13502
13973
|
{
|
|
13503
13974
|
"name": "size",
|
|
13504
|
-
"type": "\"default\" | \"icon\" | \"xs\" | \"lg\" | \"icon-xs\" | \"icon-lg\" | null",
|
|
13975
|
+
"type": "\"default\" | \"sm\" | \"icon\" | \"xs\" | \"lg\" | \"icon-sm\" | \"icon-xs\" | \"icon-lg\" | null",
|
|
13505
13976
|
"required": false,
|
|
13506
13977
|
"description": "",
|
|
13507
13978
|
"source": "dodo"
|
|
@@ -13733,6 +14204,85 @@
|
|
|
13733
14204
|
],
|
|
13734
14205
|
"docsUrl": "/components/file-upload"
|
|
13735
14206
|
},
|
|
14207
|
+
{
|
|
14208
|
+
"slug": "image-crop",
|
|
14209
|
+
"title": "Image Crop",
|
|
14210
|
+
"category": "Forms",
|
|
14211
|
+
"status": "stable",
|
|
14212
|
+
"description": "Crops a picked image before it is uploaded, as the dashboard's image fields do (main's ImageUpload): the\nwhole image with a box of `aspect` over it, 90% of the image and centred to start. Drag the box to move it,\na corner to resize it, or move it with the arrow keys. Crop draws the boxed area to a canvas, shrinks it so\nits longer side is at most `maxDimension`, and calls `onCrop` with the new file. Put it beside a\n`FileUpload`: open it with the picked file, and upload what `onCrop` returns. It stays mounted and toggles\n`open`; its state starts fresh for every file.",
|
|
14213
|
+
"importPath": "@dodopayments/ui/image-crop",
|
|
14214
|
+
"exports": [
|
|
14215
|
+
"ImageCropDialog",
|
|
14216
|
+
"ImageCropDialogProps"
|
|
14217
|
+
],
|
|
14218
|
+
"parts": [
|
|
14219
|
+
{
|
|
14220
|
+
"name": "ImageCropDialog",
|
|
14221
|
+
"description": "Crops a picked image before it is uploaded, as the dashboard's image fields do (main's ImageUpload): the\nwhole image with a box of `aspect` over it, 90% of the image and centred to start. Drag the box to move it,\na corner to resize it, or move it with the arrow keys. Crop draws the boxed area to a canvas, shrinks it so\nits longer side is at most `maxDimension`, and calls `onCrop` with the new file. Put it beside a\n`FileUpload`: open it with the picked file, and upload what `onCrop` returns. It stays mounted and toggles\n`open`; its state starts fresh for every file.",
|
|
14222
|
+
"props": [
|
|
14223
|
+
{
|
|
14224
|
+
"name": "file",
|
|
14225
|
+
"type": "File | null",
|
|
14226
|
+
"required": true,
|
|
14227
|
+
"description": "The picked image. The dialog shows it while `open`.",
|
|
14228
|
+
"source": "dodo"
|
|
14229
|
+
},
|
|
14230
|
+
{
|
|
14231
|
+
"name": "onCrop",
|
|
14232
|
+
"type": "(file: File) => void",
|
|
14233
|
+
"required": true,
|
|
14234
|
+
"description": "Called with the cropped image: the same name, and the same type when it is JPEG, PNG or WebP (else PNG).",
|
|
14235
|
+
"source": "dodo"
|
|
14236
|
+
},
|
|
14237
|
+
{
|
|
14238
|
+
"name": "onOpenChange",
|
|
14239
|
+
"type": "(open: boolean) => void",
|
|
14240
|
+
"required": true,
|
|
14241
|
+
"description": "",
|
|
14242
|
+
"source": "dodo"
|
|
14243
|
+
},
|
|
14244
|
+
{
|
|
14245
|
+
"name": "open",
|
|
14246
|
+
"type": "boolean",
|
|
14247
|
+
"required": true,
|
|
14248
|
+
"description": "",
|
|
14249
|
+
"source": "dodo"
|
|
14250
|
+
},
|
|
14251
|
+
{
|
|
14252
|
+
"name": "aspect",
|
|
14253
|
+
"type": "number",
|
|
14254
|
+
"required": false,
|
|
14255
|
+
"default": "1",
|
|
14256
|
+
"description": "Width over height of the crop, e.g. `1` for a product image or `16 / 9` for a banner.",
|
|
14257
|
+
"source": "dodo"
|
|
14258
|
+
},
|
|
14259
|
+
{
|
|
14260
|
+
"name": "maxDimension",
|
|
14261
|
+
"type": "number",
|
|
14262
|
+
"required": false,
|
|
14263
|
+
"default": "1920",
|
|
14264
|
+
"description": "The longest side of the output in pixels; a larger crop is shrunk to it, a smaller one kept.",
|
|
14265
|
+
"source": "dodo"
|
|
14266
|
+
},
|
|
14267
|
+
{
|
|
14268
|
+
"name": "title",
|
|
14269
|
+
"type": "string",
|
|
14270
|
+
"required": false,
|
|
14271
|
+
"default": "the locale's `imageCropTitle` (\"Crop image\")",
|
|
14272
|
+
"description": "Accessible title.",
|
|
14273
|
+
"source": "dodo"
|
|
14274
|
+
}
|
|
14275
|
+
]
|
|
14276
|
+
}
|
|
14277
|
+
],
|
|
14278
|
+
"examples": [
|
|
14279
|
+
{
|
|
14280
|
+
"name": "image-crop/master",
|
|
14281
|
+
"code": "\"use client\";\n\nimport { FileUpload } from \"@dodopayments/ui/file-upload\";\nimport { ImageCropDialog } from \"@dodopayments/ui/image-crop\";\nimport { useEffect, useState } from \"react\";\n\nexport default function ImageCropMaster() {\n const [picked, setPicked] = useState<File | null>(null);\n const [open, setOpen] = useState(false);\n const [preview, setPreview] = useState<string | null>(null);\n\n useEffect(\n () => () => {\n if (preview) URL.revokeObjectURL(preview);\n },\n [preview],\n );\n\n return (\n <div className=\"flex w-full max-w-120 flex-col gap-4\">\n <FileUpload\n accept=\"image/png,image/jpeg,image/webp\"\n description=\"PNG, JPG or WebP, up to 3 MB. Cropped to a square.\"\n maxSize={3 * 1024 * 1024}\n onFilesAdded={([file]) => {\n if (!file) return;\n setPicked(file);\n setOpen(true);\n }}\n />\n {preview ? (\n // biome-ignore lint/performance/noImgElement: a local object URL in a demo.\n <img\n alt=\"Cropped\"\n className=\"size-24 rounded-lg border border-border object-cover\"\n src={preview}\n />\n ) : null}\n <ImageCropDialog\n file={picked}\n open={open}\n onOpenChange={setOpen}\n onCrop={(file: File) => {\n setPreview(URL.createObjectURL(file));\n setOpen(false);\n }}\n />\n </div>\n );\n}"
|
|
14282
|
+
}
|
|
14283
|
+
],
|
|
14284
|
+
"docsUrl": "/components/image-crop"
|
|
14285
|
+
},
|
|
13736
14286
|
{
|
|
13737
14287
|
"slug": "grid",
|
|
13738
14288
|
"title": "Grid",
|
|
@@ -13880,6 +14430,13 @@
|
|
|
13880
14430
|
"description": "The key of a `chip`, e.g. \"Customer ID\" (Body/Secondary, Content/Secondary).",
|
|
13881
14431
|
"source": "dodo"
|
|
13882
14432
|
},
|
|
14433
|
+
{
|
|
14434
|
+
"name": "link",
|
|
14435
|
+
"type": "ReactElement<Record<string, unknown>, string | JSXElementConstructor<any>>",
|
|
14436
|
+
"required": false,
|
|
14437
|
+
"description": "Renders the value as this link, e.g. `<NextLink href=\"/payments/pay_…\" />`, for an ID that opens its record. The\nvalue keeps its middle truncation and underlines on hover; the copy button stays beside it, outside the link.\n`inline` and `chip` only.",
|
|
14438
|
+
"source": "dodo"
|
|
14439
|
+
},
|
|
13883
14440
|
{
|
|
13884
14441
|
"name": "onCopy",
|
|
13885
14442
|
"type": "((value: string) => void)",
|
|
@@ -14094,7 +14651,7 @@
|
|
|
14094
14651
|
"examples": [
|
|
14095
14652
|
{
|
|
14096
14653
|
"name": "money/basic",
|
|
14097
|
-
"code": "\"use client\";\n\nimport { Money } from \"@dodopayments/ui/money\";\n\nconst rows = [\n { label: \"Payment\", minor: 123_450, currency: \"USD\" },\n { label: \"Refund\", minor: -4500, currency: \"USD\" },\n { label: \"Payout (de-DE)\", minor: 98_765, currency: \"EUR\", locale: \"de-DE\" },\n { label: \"Order (ja-JP)\", minor: 123_456, currency: \"JPY\", locale: \"ja-JP\" },\n { label: \"Invoice (3 decimals)\", minor: 12_500, currency: \"KWD\", display: \"code\" },\n { label: \"Card charge (CAD)\", minor: 5000, currency: \"CAD\", display: \"symbolAndCode\" },\n] as const;\n\nexport default function MoneyBasic() {\n return (\n <ul className=\"flex w-full max-w-sm flex-col divide-y divide-border text-
|
|
14654
|
+
"code": "\"use client\";\n\nimport { Money } from \"@dodopayments/ui/money\";\n\nconst rows = [\n { label: \"Payment\", minor: 123_450, currency: \"USD\" },\n { label: \"Refund\", minor: -4500, currency: \"USD\" },\n { label: \"Payout (de-DE)\", minor: 98_765, currency: \"EUR\", locale: \"de-DE\" },\n { label: \"Order (ja-JP)\", minor: 123_456, currency: \"JPY\", locale: \"ja-JP\" },\n { label: \"Invoice (3 decimals)\", minor: 12_500, currency: \"KWD\", display: \"code\" },\n { label: \"Card charge (CAD)\", minor: 5000, currency: \"CAD\", display: \"symbolAndCode\" },\n] as const;\n\nexport default function MoneyBasic() {\n return (\n <ul className=\"flex w-full max-w-sm flex-col divide-y divide-border text-body-primary\">\n {rows.map((row) => (\n <li key={row.label} className=\"flex items-baseline justify-between gap-4 py-2\">\n <span className=\"text-muted-foreground\">{row.label}</span>\n <Money\n minor={row.minor}\n currency={row.currency}\n locale={\"locale\" in row ? row.locale : undefined}\n display={\"display\" in row ? row.display : undefined}\n className=\"text-label-primary\"\n />\n </li>\n ))}\n <li className=\"flex items-baseline justify-between gap-4 py-2\">\n <span className=\"text-muted-foreground\">Failed charge</span>\n <Money minor={8900} currency=\"USD\" status=\"failed\" className=\"text-label-primary\" />\n </li>\n </ul>\n );\n}"
|
|
14098
14655
|
},
|
|
14099
14656
|
{
|
|
14100
14657
|
"name": "money/compact-and-blur",
|
|
@@ -14194,7 +14751,7 @@
|
|
|
14194
14751
|
"title": "Input",
|
|
14195
14752
|
"category": "Forms",
|
|
14196
14753
|
"status": "stable",
|
|
14197
|
-
"description": "The Dodo Nest Input. Lets the merchant type a value: one line (text, search, URLs, phone), several lines\n(`type=\"textarea\"`), a list of chips (`type=\"chips\"`, typed, or picked from `suggestions`), an amount in minor\nunits (`type=\"money\"`), a phone number with a country picker (`type=\"phone\"`) or a GSTIN / ABN (`type=\"tax-id\"`). A flat field on the panel: 1px Border/Primary, Radius/Medium,\na brand ring on focus, a red ring and placeholder when invalid, grey (Surface/Secondary) when read-only. Every Input\nis 36 tall
|
|
14754
|
+
"description": "The Dodo Nest Input. Lets the merchant type a value: one line (text, search, URLs, phone), several lines\n(`type=\"textarea\"`), a list of chips (`type=\"chips\"`, typed, or picked from `suggestions`), an amount in minor\nunits (`type=\"money\"`), a phone number with a country picker (`type=\"phone\"`) or a GSTIN / ABN (`type=\"tax-id\"`). A flat field on the panel: 1px Border/Primary, Radius/Medium,\na brand ring on focus, a red ring and placeholder when invalid, grey (Surface/Secondary) when read-only. Every Input\nis 36 tall; a one-line input can be the compact `size=\"sm\"` (28). A one-line input takes icons, an inline `prefix` / `suffix`,\na boxed `addon`, `prefixSelect` / `suffixSelect` and a `shortcut`; read-only shows a copy button. With\n`suggestions` it suggests values in a list while the user types (an autocomplete; the value stays free text). Inside\na `Field` it picks up the label, description and validation state.",
|
|
14198
14755
|
"importPath": "@dodopayments/ui/input",
|
|
14199
14756
|
"exports": [
|
|
14200
14757
|
"DODO_INPUT_DEFAULT_VARIANTS",
|
|
@@ -14227,7 +14784,7 @@
|
|
|
14227
14784
|
"parts": [
|
|
14228
14785
|
{
|
|
14229
14786
|
"name": "Input",
|
|
14230
|
-
"description": "The Dodo Nest Input. Lets the merchant type a value: one line (text, search, URLs, phone), several lines\n(`type=\"textarea\"`), a list of chips (`type=\"chips\"`, typed, or picked from `suggestions`), an amount in minor\nunits (`type=\"money\"`), a phone number with a country picker (`type=\"phone\"`) or a GSTIN / ABN (`type=\"tax-id\"`). A flat field on the panel: 1px Border/Primary, Radius/Medium,\na brand ring on focus, a red ring and placeholder when invalid, grey (Surface/Secondary) when read-only. Every Input\nis 36 tall
|
|
14787
|
+
"description": "The Dodo Nest Input. Lets the merchant type a value: one line (text, search, URLs, phone), several lines\n(`type=\"textarea\"`), a list of chips (`type=\"chips\"`, typed, or picked from `suggestions`), an amount in minor\nunits (`type=\"money\"`), a phone number with a country picker (`type=\"phone\"`) or a GSTIN / ABN (`type=\"tax-id\"`). A flat field on the panel: 1px Border/Primary, Radius/Medium,\na brand ring on focus, a red ring and placeholder when invalid, grey (Surface/Secondary) when read-only. Every Input\nis 36 tall; a one-line input can be the compact `size=\"sm\"` (28). A one-line input takes icons, an inline `prefix` / `suffix`,\na boxed `addon`, `prefixSelect` / `suffixSelect` and a `shortcut`; read-only shows a copy button. With\n`suggestions` it suggests values in a list while the user types (an autocomplete; the value stays free text). Inside\na `Field` it picks up the label, description and validation state.",
|
|
14231
14788
|
"props": [
|
|
14232
14789
|
{
|
|
14233
14790
|
"name": "aria-label",
|
|
@@ -14360,6 +14917,10 @@
|
|
|
14360
14917
|
"name": "input/async-suggestions",
|
|
14361
14918
|
"code": "\"use client\";\n\nimport { Field } from \"@dodopayments/ui/field\";\nimport { Input, type InputSuggestionItem } from \"@dodopayments/ui/input\";\nimport { useEffect, useRef, useState } from \"react\";\n\nconst products = [\n { value: \"pdt_01\", label: \"Framer Template\", description: \"One-time · $49.00\" },\n { value: \"pdt_02\", label: \"Pro plan\", description: \"Subscription · $29.00 / month\" },\n { value: \"pdt_03\", label: \"Team plan\", description: \"Subscription · $99.00 / month\" },\n { value: \"pdt_04\", label: \"Icon pack\", description: \"One-time · $19.00\" },\n { value: \"pdt_05\", label: \"API credits\", description: \"Usage based · $0.002 / call\" },\n] satisfies InputSuggestionItem[];\n\n/** Stands in for a product search request: answers after 600 ms. */\nfunction searchProducts(query: string, signal: AbortSignal): Promise<InputSuggestionItem[]> {\n return new Promise((resolve, reject) => {\n const timer = setTimeout(() => {\n const needle = query.trim().toLowerCase();\n resolve(\n products.filter((product) =>\n `${product.label} ${product.description}`.toLowerCase().includes(needle),\n ),\n );\n }, 600);\n signal.addEventListener(\"abort\", () => {\n clearTimeout(timer);\n reject(new Error(\"Search cancelled\"));\n });\n });\n}\n\nexport default function InputAsyncSuggestions() {\n const [query, setQuery] = useState(\"\");\n const [results, setResults] = useState<InputSuggestionItem[]>([]);\n const [loading, setLoading] = useState(false);\n const request = useRef<AbortController | null>(null);\n useEffect(() => () => request.current?.abort(), []);\n\n const search = (next: string) => {\n setQuery(next);\n request.current?.abort();\n if (next.trim() === \"\") {\n setResults([]);\n setLoading(false);\n return;\n }\n const controller = new AbortController();\n request.current = controller;\n setLoading(true);\n searchProducts(next, controller.signal)\n .then((found) => {\n setResults(found);\n setLoading(false);\n })\n .catch(() => undefined);\n };\n\n return (\n <Field\n label=\"Product\"\n description=\"Results come from the server as you type.\"\n className=\"w-full max-w-sm\"\n >\n <Input\n placeholder=\"Search products\"\n value={query}\n onValueChange={search}\n // The server already matched these, so the Input shows them as they are.\n suggestions={loading ? [] : results}\n filterSuggestions={false}\n suggestionsLoading={loading}\n suggestionsLoadingText=\"Searching products\"\n suggestionsEmpty={query.trim() === \"\" ? undefined : \"No products found.\"}\n clearable\n />\n </Field>\n );\n}"
|
|
14362
14919
|
},
|
|
14920
|
+
{
|
|
14921
|
+
"name": "input/compact",
|
|
14922
|
+
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport { MagnifierIcon } from \"@dodopayments/ui/icons\";\nimport { Input } from \"@dodopayments/ui/input\";\nimport { Select, SelectContent, SelectTrigger, SelectValue } from \"@dodopayments/ui/select\";\n\nconst STATUSES = [\n { value: \"all\", label: \"All statuses\" },\n { value: \"succeeded\", label: \"Succeeded\" },\n { value: \"failed\", label: \"Failed\" },\n];\n\nexport default function InputCompact() {\n return (\n <div className=\"flex w-full max-w-xl flex-wrap items-center gap-2\">\n <Input\n size=\"sm\"\n type=\"search\"\n aria-label=\"Search payments\"\n placeholder=\"Search payments\"\n leadingIcon={<MagnifierIcon />}\n className=\"min-w-40 flex-1\"\n />\n <Select items={STATUSES} defaultValue=\"all\">\n <SelectTrigger size=\"sm\" aria-label=\"Status\" className=\"w-40\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent />\n </Select>\n <Button size=\"sm\" variant=\"secondary\">\n Reset\n </Button>\n </div>\n );\n}"
|
|
14923
|
+
},
|
|
14363
14924
|
{
|
|
14364
14925
|
"name": "input/country-lookup",
|
|
14365
14926
|
"code": "\"use client\";\n\nimport { Field } from \"@dodopayments/ui/field\";\nimport { Flag } from \"@dodopayments/ui/payment-logos\";\nimport { Input, type InputSuggestion } from \"@dodopayments/ui/input\";\n\nconst countries = [\n { value: \"IN\", label: \"India\", description: \"INR · Indian rupee\", icon: <Flag country=\"IN\" /> },\n {\n value: \"US\",\n label: \"United States\",\n description: \"USD · US dollar\",\n icon: <Flag country=\"US\" />,\n },\n {\n value: \"GB\",\n label: \"United Kingdom\",\n description: \"GBP · Pound sterling\",\n icon: <Flag country=\"GB\" />,\n },\n { value: \"DE\", label: \"Germany\", description: \"EUR · Euro\", icon: <Flag country=\"DE\" /> },\n { value: \"FR\", label: \"France\", description: \"EUR · Euro\", icon: <Flag country=\"FR\" /> },\n { value: \"JP\", label: \"Japan\", description: \"JPY · Japanese yen\", icon: <Flag country=\"JP\" /> },\n {\n value: \"SG\",\n label: \"Singapore\",\n description: \"SGD · Singapore dollar\",\n icon: <Flag country=\"SG\" />,\n },\n {\n value: \"AU\",\n label: \"Australia\",\n description: \"AUD · Australian dollar\",\n icon: <Flag country=\"AU\" />,\n },\n {\n value: \"CA\",\n label: \"Canada\",\n description: \"CAD · Canadian dollar\",\n icon: <Flag country=\"CA\" />,\n },\n {\n value: \"BR\",\n label: \"Brazil\",\n description: \"BRL · Brazilian real\",\n icon: <Flag country=\"BR\" />,\n },\n];\n\n/** Matches the country name, its ISO code or its currency code, so \"eur\" finds Germany and France. */\nfunction matchCountry(suggestion: InputSuggestion, query: string) {\n if (typeof suggestion === \"string\") return false;\n const country = countries.find((item) => item.value === suggestion.value);\n const text = `${suggestion.label} ${suggestion.value} ${country?.description ?? \"\"}`;\n return text.toLowerCase().includes(query.trim().toLowerCase());\n}\n\nexport default function InputCountryLookup() {\n return (\n <Field\n label=\"Country or currency\"\n description=\"Type a name, an ISO code (IN) or a currency (EUR).\"\n className=\"w-full max-w-sm\"\n >\n <Input\n placeholder=\"e.g. India or EUR\"\n suggestions={countries}\n filterSuggestions={matchCountry}\n suggestionsEmpty=\"No country or currency matches.\"\n openSuggestionsOnClick\n suggestionsTrigger\n />\n </Field>\n );\n}"
|
|
@@ -14546,10 +15107,10 @@
|
|
|
14546
15107
|
},
|
|
14547
15108
|
{
|
|
14548
15109
|
"name": "size",
|
|
14549
|
-
"type": "\"lg\"",
|
|
15110
|
+
"type": "\"sm\" | \"lg\"",
|
|
14550
15111
|
"required": false,
|
|
14551
15112
|
"default": "\"lg\"",
|
|
14552
|
-
"description": "Input height, as `Input` (`DODO_INPUT_VARIANTS`):
|
|
15113
|
+
"description": "Input height, as `Input` (`DODO_INPUT_VARIANTS`): `lg` 36 or the compact `sm` 28.",
|
|
14553
15114
|
"source": "dodo"
|
|
14554
15115
|
},
|
|
14555
15116
|
{
|
|
@@ -14656,7 +15217,7 @@
|
|
|
14656
15217
|
"title": "Menu",
|
|
14657
15218
|
"category": "Overlays",
|
|
14658
15219
|
"status": "stable",
|
|
14659
|
-
"description": "The floating list of actions (the `MenuPopup` primitive: portal + positioner + popup): Surface/Overlay,\nRadius/Large, 160 to 320 wide, scrolls past 320 tall.
|
|
15220
|
+
"description": "The floating list of actions (the `MenuPopup` primitive: portal + positioner + popup): Surface/Overlay,\nRadius/Large, 160 to 320 wide, scrolls past 320 tall. With `mobileSheet` it opens below 640px as a bottom sheet\nover a scrim, full width, with the same items. Holds `MenuItem`, `MenuLinkItem`, `MenuCheckboxItem`, `MenuRadioGroup`,\n`MenuGroup`, `MenuSeparator` and `MenuSub`.",
|
|
14660
15221
|
"importPath": "@dodopayments/ui/menu",
|
|
14661
15222
|
"exports": [
|
|
14662
15223
|
"Menu",
|
|
@@ -14692,7 +15253,7 @@
|
|
|
14692
15253
|
"parts": [
|
|
14693
15254
|
{
|
|
14694
15255
|
"name": "MenuContent",
|
|
14695
|
-
"description": "The floating list of actions (the `MenuPopup` primitive: portal + positioner + popup): Surface/Overlay,\nRadius/Large, 160 to 320 wide, scrolls past 320 tall.
|
|
15256
|
+
"description": "The floating list of actions (the `MenuPopup` primitive: portal + positioner + popup): Surface/Overlay,\nRadius/Large, 160 to 320 wide, scrolls past 320 tall. With `mobileSheet` it opens below 640px as a bottom sheet\nover a scrim, full width, with the same items. Holds `MenuItem`, `MenuLinkItem`, `MenuCheckboxItem`, `MenuRadioGroup`,\n`MenuGroup`, `MenuSeparator` and `MenuSub`.",
|
|
14696
15257
|
"props": [
|
|
14697
15258
|
{
|
|
14698
15259
|
"name": "align",
|
|
@@ -14734,8 +15295,8 @@
|
|
|
14734
15295
|
"name": "mobileSheet",
|
|
14735
15296
|
"type": "boolean",
|
|
14736
15297
|
"required": false,
|
|
14737
|
-
"default": "
|
|
14738
|
-
"description": "Below 640px the menu
|
|
15298
|
+
"default": "false",
|
|
15299
|
+
"description": "Below 640px, open the menu as a bottom sheet over a scrim, full width (Figma Menu › Responsive). Off by\ndefault: the menu stays a popover on its trigger at every width.",
|
|
14739
15300
|
"source": "dodo"
|
|
14740
15301
|
},
|
|
14741
15302
|
{
|
|
@@ -15428,7 +15989,7 @@
|
|
|
15428
15989
|
},
|
|
15429
15990
|
{
|
|
15430
15991
|
"name": "MenuSubContent",
|
|
15431
|
-
"description": "The nested list. Opens beside its `MenuSubTrigger`, aligned with the trigger row.
|
|
15992
|
+
"description": "The nested list. Opens beside its `MenuSubTrigger`, aligned with the trigger row. With `mobileSheet` (set it on the\nparent `MenuContent` too) it opens below 640px as a bottom sheet over its parent, with a Back row (`backLabel`)\nthat closes only the submenu.",
|
|
15432
15993
|
"props": [
|
|
15433
15994
|
{
|
|
15434
15995
|
"name": "align",
|
|
@@ -15456,7 +16017,7 @@
|
|
|
15456
16017
|
"name": "backLabel",
|
|
15457
16018
|
"type": "string",
|
|
15458
16019
|
"required": false,
|
|
15459
|
-
"description": "Text of the row that returns to the parent menu.
|
|
16020
|
+
"description": "Text of the row that returns to the parent menu. With `mobileSheet`, the submenu opens below 640px as a bottom\nsheet over its parent and starts with this row. Defaults to the `back` message of the `LocaleProvider` (\"Back\" in English).",
|
|
15460
16021
|
"source": "dodo"
|
|
15461
16022
|
},
|
|
15462
16023
|
{
|
|
@@ -15477,8 +16038,8 @@
|
|
|
15477
16038
|
"name": "mobileSheet",
|
|
15478
16039
|
"type": "boolean",
|
|
15479
16040
|
"required": false,
|
|
15480
|
-
"default": "
|
|
15481
|
-
"description": "Below 640px the menu
|
|
16041
|
+
"default": "false",
|
|
16042
|
+
"description": "Below 640px, open the menu as a bottom sheet over a scrim, full width (Figma Menu › Responsive). Off by\ndefault: the menu stays a popover on its trigger at every width.",
|
|
15482
16043
|
"source": "dodo"
|
|
15483
16044
|
},
|
|
15484
16045
|
{
|
|
@@ -16068,6 +16629,14 @@
|
|
|
16068
16629
|
"description": "Space in px to keep between the popover and the edges of the viewport. When the popover does\nnot fit on `side`, it flips to the opposite side and then shifts along the edge.",
|
|
16069
16630
|
"source": "dodo"
|
|
16070
16631
|
},
|
|
16632
|
+
{
|
|
16633
|
+
"name": "mobileSheet",
|
|
16634
|
+
"type": "boolean",
|
|
16635
|
+
"required": false,
|
|
16636
|
+
"default": "false",
|
|
16637
|
+
"description": "Below 640px, open as a bottom sheet over a scrim, full width, as Menu and Select can. Off by default: turn it\non for a panel without text fields (notifications, a list of choices). A sheet sits at the bottom edge, where\nthe software keyboard would cover a field; for a form on a phone, use a `Dialog` or a `Drawer`.",
|
|
16638
|
+
"source": "dodo"
|
|
16639
|
+
},
|
|
16071
16640
|
{
|
|
16072
16641
|
"name": "portalProps",
|
|
16073
16642
|
"type": "PopoverPortalProps",
|
|
@@ -16482,7 +17051,7 @@
|
|
|
16482
17051
|
},
|
|
16483
17052
|
{
|
|
16484
17053
|
"name": "popover/notifications",
|
|
16485
|
-
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport { BellIcon, CreditCardIcon, DotsIcon, GearIcon, UserIcon } from \"@dodopayments/ui/icons\";\nimport {\n Popover,\n PopoverContent,\n PopoverHeader,\n PopoverNotificationItem,\n PopoverPanel,\n PopoverTitle,\n PopoverTrigger,\n} from \"@dodopayments/ui/popover\";\nimport { Tabs, TabsList, TabsTrigger } from \"@dodopayments/ui/tabs\";\n\nconst NOTIFICATIONS = [\n { title: \"Payment succeeded\", id: \"pay_0NlZbY…k09c\", time: \"2 min ago\", unread: true },\n { title: \"Refund processed\", id: \"rfd_0NmQ8x…T2aP\", time: \"1 hr ago\", unread: true },\n { title: \"Dispute opened\", id: \"dsp_0NkR4c…9WqL\", time: \"Yesterday\", unread: false },\n];\n\nexport default function PopoverNotifications() {\n return (\n <Popover>\n <PopoverTrigger\n render={<Button variant=\"secondary\" size=\"icon-lg\" aria-label=\"Notifications\" />}\n >\n <BellIcon aria-hidden=\"true\" />\n </PopoverTrigger>\n <PopoverContent size=\"lg\">\n <PopoverHeader\n actions={\n <>\n <Button variant=\"ghost\" size=\"icon-xs\" aria-label=\"Notification settings\">\n <GearIcon aria-hidden=\"true\" />\n </Button>\n <Button variant=\"ghost\" size=\"icon-xs\" aria-label=\"More\">\n <DotsIcon aria-hidden=\"true\" />\n </Button>\n </>\n }\n >\n <PopoverTitle>Notifications</PopoverTitle>\n </PopoverHeader>\n <PopoverPanel>\n <Tabs defaultValue=\"all\">\n <TabsList aria-label=\"Notification type\" className=\"px-1\">\n <TabsTrigger value=\"all\" icon={<BellIcon aria-hidden=\"true\" />} count={19}>\n All\n </TabsTrigger>\n <TabsTrigger\n value=\"transactions\"\n icon={<CreditCardIcon aria-hidden=\"true\" />}\n count={19}\n >\n Transactions\n </TabsTrigger>\n <TabsTrigger value=\"business\" icon={<UserIcon aria-hidden=\"true\" />}>\n Business\n </TabsTrigger>\n </TabsList>\n </Tabs>\n {NOTIFICATIONS.map((item) => (\n <PopoverNotificationItem\n key={item.id}\n icon={<CreditCardIcon />}\n title={item.title}\n id={item.id}\n time={item.time}\n unread={item.unread}\n />\n ))}\n </PopoverPanel>\n </PopoverContent>\n </Popover>\n );\n}"
|
|
17054
|
+
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport { BellIcon, CreditCardIcon, DotsIcon, GearIcon, UserIcon } from \"@dodopayments/ui/icons\";\nimport {\n Popover,\n PopoverContent,\n PopoverHeader,\n PopoverNotificationItem,\n PopoverPanel,\n PopoverTitle,\n PopoverTrigger,\n} from \"@dodopayments/ui/popover\";\nimport { Tabs, TabsList, TabsTrigger } from \"@dodopayments/ui/tabs\";\n\nconst NOTIFICATIONS = [\n { title: \"Payment succeeded\", id: \"pay_0NlZbY…k09c\", time: \"2 min ago\", unread: true },\n { title: \"Refund processed\", id: \"rfd_0NmQ8x…T2aP\", time: \"1 hr ago\", unread: true },\n { title: \"Dispute opened\", id: \"dsp_0NkR4c…9WqL\", time: \"Yesterday\", unread: false },\n];\n\nexport default function PopoverNotifications() {\n return (\n <Popover>\n <PopoverTrigger\n render={<Button variant=\"secondary\" size=\"icon-lg\" aria-label=\"Notifications\" />}\n >\n <BellIcon aria-hidden=\"true\" />\n </PopoverTrigger>\n <PopoverContent size=\"lg\" mobileSheet>\n <PopoverHeader\n actions={\n <>\n <Button variant=\"ghost\" size=\"icon-xs\" aria-label=\"Notification settings\">\n <GearIcon aria-hidden=\"true\" />\n </Button>\n <Button variant=\"ghost\" size=\"icon-xs\" aria-label=\"More\">\n <DotsIcon aria-hidden=\"true\" />\n </Button>\n </>\n }\n >\n <PopoverTitle>Notifications</PopoverTitle>\n </PopoverHeader>\n <PopoverPanel>\n <Tabs defaultValue=\"all\">\n <TabsList aria-label=\"Notification type\" className=\"px-1\">\n <TabsTrigger value=\"all\" icon={<BellIcon aria-hidden=\"true\" />} count={19}>\n All\n </TabsTrigger>\n <TabsTrigger\n value=\"transactions\"\n icon={<CreditCardIcon aria-hidden=\"true\" />}\n count={19}\n >\n Transactions\n </TabsTrigger>\n <TabsTrigger value=\"business\" icon={<UserIcon aria-hidden=\"true\" />}>\n Business\n </TabsTrigger>\n </TabsList>\n </Tabs>\n {NOTIFICATIONS.map((item) => (\n <PopoverNotificationItem\n key={item.id}\n icon={<CreditCardIcon />}\n title={item.title}\n id={item.id}\n time={item.time}\n unread={item.unread}\n />\n ))}\n </PopoverPanel>\n </PopoverContent>\n </Popover>\n );\n}"
|
|
16486
17055
|
}
|
|
16487
17056
|
],
|
|
16488
17057
|
"docsUrl": "/components/popover"
|
|
@@ -17053,14 +17622,18 @@
|
|
|
17053
17622
|
},
|
|
17054
17623
|
{
|
|
17055
17624
|
"name": "size",
|
|
17056
|
-
"type": "\"xs\" | \"sm\" | \"md\" | \"lg\"",
|
|
17625
|
+
"type": "\"2xs\" | \"xs\" | \"sm\" | \"md\" | \"lg\"",
|
|
17057
17626
|
"required": false,
|
|
17058
17627
|
"description": "",
|
|
17059
17628
|
"source": "dodo",
|
|
17060
17629
|
"values": [
|
|
17630
|
+
{
|
|
17631
|
+
"value": "2xs",
|
|
17632
|
+
"description": "12px tall artwork with 2px clear space on every side. Only for print-sized text, such as an invoice footer."
|
|
17633
|
+
},
|
|
17061
17634
|
{
|
|
17062
17635
|
"value": "xs",
|
|
17063
|
-
"description": "16px tall artwork with 4px clear space on every side.
|
|
17636
|
+
"description": "16px tall artwork with 4px clear space on every side. For a line of small text such as \"Secure checkout by\"."
|
|
17064
17637
|
},
|
|
17065
17638
|
{
|
|
17066
17639
|
"value": "sm",
|
|
@@ -18086,7 +18659,7 @@
|
|
|
18086
18659
|
"title": "Select",
|
|
18087
18660
|
"category": "Forms",
|
|
18088
18661
|
"status": "stable",
|
|
18089
|
-
"description": "The field (Figma `container`) that opens the list: put a `SelectValue` inside.
|
|
18662
|
+
"description": "The field (Figma `container`) that opens the list: put a `SelectValue` inside. 36 tall, or 28 with `size=\"sm\"`; the caret turns up\nwhile the list is open; `aria-invalid` (or an invalid `Field`) shows the error border. `variant=\"compact\"` is a\nborderless 32 trigger that hugs its value, for a language or currency switcher (with an `icon` or a flag).",
|
|
18090
18663
|
"importPath": "@dodopayments/ui/select",
|
|
18091
18664
|
"exports": [
|
|
18092
18665
|
"DODO_SELECT_TRIGGER_DEFAULT_VARIANTS",
|
|
@@ -18113,7 +18686,7 @@
|
|
|
18113
18686
|
"parts": [
|
|
18114
18687
|
{
|
|
18115
18688
|
"name": "SelectTrigger",
|
|
18116
|
-
"description": "The field (Figma `container`) that opens the list: put a `SelectValue` inside.
|
|
18689
|
+
"description": "The field (Figma `container`) that opens the list: put a `SelectValue` inside. 36 tall, or 28 with `size=\"sm\"`; the caret turns up\nwhile the list is open; `aria-invalid` (or an invalid `Field`) shows the error border. `variant=\"compact\"` is a\nborderless 32 trigger that hugs its value, for a language or currency switcher (with an `icon` or a flag).",
|
|
18117
18690
|
"props": [
|
|
18118
18691
|
{
|
|
18119
18692
|
"name": "className",
|
|
@@ -18129,6 +18702,24 @@
|
|
|
18129
18702
|
"description": "An icon before the value (Figma \"Show leading icon\"), e.g. a Nucleo icon for an integration select, a globe for a\nlanguage switcher or a `Flag` for a currency (a Flag keeps its 20 × 14).",
|
|
18130
18703
|
"source": "dodo"
|
|
18131
18704
|
},
|
|
18705
|
+
{
|
|
18706
|
+
"name": "size",
|
|
18707
|
+
"type": "\"default\" | \"sm\"",
|
|
18708
|
+
"required": false,
|
|
18709
|
+
"description": "",
|
|
18710
|
+
"source": "dodo",
|
|
18711
|
+
"values": [
|
|
18712
|
+
{
|
|
18713
|
+
"value": "default",
|
|
18714
|
+
"description": "36 tall (40 below `sm`), as in Figma. The default."
|
|
18715
|
+
},
|
|
18716
|
+
{
|
|
18717
|
+
"value": "sm",
|
|
18718
|
+
"description": "28 tall (32 below `sm`): a compact trigger in a dense toolbar or a table filter row, next to an `sm` Input or Button. Not a Figma size. The chips field of `multiple` and the `compact` variant keep their height."
|
|
18719
|
+
}
|
|
18720
|
+
],
|
|
18721
|
+
"default": "\"default\""
|
|
18722
|
+
},
|
|
18132
18723
|
{
|
|
18133
18724
|
"name": "variant",
|
|
18134
18725
|
"type": "\"default\" | \"compact\"",
|
|
@@ -18388,6 +18979,14 @@
|
|
|
18388
18979
|
"description": "The disabled row shown when no option matches.",
|
|
18389
18980
|
"source": "dodo"
|
|
18390
18981
|
},
|
|
18982
|
+
{
|
|
18983
|
+
"name": "mobileSheet",
|
|
18984
|
+
"type": "boolean",
|
|
18985
|
+
"required": false,
|
|
18986
|
+
"default": "false",
|
|
18987
|
+
"description": "Below 640px, open the list as a bottom sheet over a scrim, full width. Off by default: the list stays under\nthe trigger at every width. A `searchable` or `multiple` list always stays under its field, where the software\nkeyboard cannot cover it.",
|
|
18988
|
+
"source": "dodo"
|
|
18989
|
+
},
|
|
18391
18990
|
{
|
|
18392
18991
|
"name": "portalProps",
|
|
18393
18992
|
"type": "SelectPortalProps",
|
|
@@ -18624,6 +19223,10 @@
|
|
|
18624
19223
|
{
|
|
18625
19224
|
"name": "select/searchable",
|
|
18626
19225
|
"code": "\"use client\";\n\nimport { Field } from \"@dodopayments/ui/field\";\nimport { Select, SelectContent, SelectTrigger, SelectValue } from \"@dodopayments/ui/select\";\n\nconst brands = [\n \"Dodo Payments\",\n \"Acme Studio\",\n \"Northwind Labs\",\n \"Orbit Labs\",\n \"Globex\",\n \"Initech\",\n \"Umbrella\",\n \"Hooli\",\n \"Pied Piper\",\n \"Stark Industries\",\n].map((name) => ({ value: name.toLowerCase().replaceAll(\" \", \"-\"), label: name }));\n\n/** A long list: `searchable` puts a search field on top of the list. */\nexport default function SelectSearchable() {\n return (\n <Field\n label=\"Brand\"\n description=\"Select the brand that will be associated with your product.\"\n className=\"w-full max-w-sm\"\n >\n <Select items={brands} searchable>\n <SelectTrigger>\n <SelectValue placeholder=\"Select a brand\" />\n </SelectTrigger>\n <SelectContent />\n </Select>\n </Field>\n );\n}"
|
|
19226
|
+
},
|
|
19227
|
+
{
|
|
19228
|
+
"name": "select/small",
|
|
19229
|
+
"code": "\"use client\";\n\nimport { Select, SelectContent, SelectTrigger, SelectValue } from \"@dodopayments/ui/select\";\n\nconst RANGES = [\n { value: \"7d\", label: \"Last 7 days\" },\n { value: \"30d\", label: \"Last 30 days\" },\n { value: \"90d\", label: \"Last 90 days\" },\n];\n\nexport default function SelectSmall() {\n return (\n <Select items={RANGES} defaultValue=\"30d\">\n <SelectTrigger size=\"sm\" aria-label=\"Date range\" className=\"w-44\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent />\n </Select>\n );\n}"
|
|
18627
19230
|
}
|
|
18628
19231
|
],
|
|
18629
19232
|
"docsUrl": "/components/select"
|
|
@@ -19456,7 +20059,7 @@
|
|
|
19456
20059
|
},
|
|
19457
20060
|
{
|
|
19458
20061
|
"name": "SidebarProvider",
|
|
19459
|
-
"description": "Holds the sidebar state and lays out `Sidebar` next to `SidebarInset` on the grey app shell. Wrap the app shell\nonce. The docked sidebar starts collapsed to the 68px icon rail; below 1024px it becomes a sheet. Cmd/Ctrl+B\ntoggles it.\n\nReplaces the `SidebarProvider` primitive (it
|
|
20062
|
+
"description": "Holds the sidebar state and lays out `Sidebar` next to `SidebarInset` on the grey app shell. Wrap the app shell\nonce. The docked sidebar starts collapsed to the 68px icon rail; below 1024px it becomes a sheet. Cmd/Ctrl+B\ntoggles it.\n\nReplaces the `SidebarProvider` primitive (it always writes a `cookieStore` cookie and has a fixed\nshortcut) but feeds the `SidebarContext` primitive, so every primitive\nsidebar part reads this state.",
|
|
19460
20063
|
"props": [
|
|
19461
20064
|
{
|
|
19462
20065
|
"name": "defaultOpen",
|
|
@@ -21387,6 +21990,24 @@
|
|
|
21387
21990
|
"description": "Additional Tailwind classes, merged last.",
|
|
21388
21991
|
"source": "dodo"
|
|
21389
21992
|
},
|
|
21993
|
+
{
|
|
21994
|
+
"name": "size",
|
|
21995
|
+
"type": "\"default\" | \"sm\"",
|
|
21996
|
+
"required": false,
|
|
21997
|
+
"description": "",
|
|
21998
|
+
"source": "dodo",
|
|
21999
|
+
"values": [
|
|
22000
|
+
{
|
|
22001
|
+
"value": "default",
|
|
22002
|
+
"description": "Underline tabs 36 tall, pill tabs 28, as in Figma. The default."
|
|
22003
|
+
},
|
|
22004
|
+
{
|
|
22005
|
+
"value": "sm",
|
|
22006
|
+
"description": "Underline tabs 32 tall, pill tabs 24: a compact row inside a card header or a dense toolbar. Not a Figma size. Vertical tabs keep 28."
|
|
22007
|
+
}
|
|
22008
|
+
],
|
|
22009
|
+
"default": "\"default\""
|
|
22010
|
+
},
|
|
21390
22011
|
{
|
|
21391
22012
|
"name": "variant",
|
|
21392
22013
|
"type": "\"underline\" | \"pill\"",
|
|
@@ -21484,6 +22105,10 @@
|
|
|
21484
22105
|
"name": "tabs/basic",
|
|
21485
22106
|
"code": "\"use client\";\n\nimport { Tabs, TabsContent, TabsList, TabsTrigger } from \"@dodopayments/ui/tabs\";\n\nconst SECTIONS = [\n { value: \"overview\", label: \"Overview\", body: \"Lifetime value, last payment and open invoices.\" },\n {\n value: \"payments\",\n label: \"Payments\",\n body: \"Every payment this customer has made, newest first.\",\n },\n {\n value: \"subscriptions\",\n label: \"Subscriptions\",\n body: \"Active plans, renewals and cancellations.\",\n },\n { value: \"refunds\", label: \"Refunds\", body: \"Refunds issued and their current status.\" },\n { value: \"entitlements\", label: \"Entitlements\", body: \"License keys and digital deliveries.\" },\n] as const;\n\nexport default function TabsBasic() {\n return (\n <Tabs defaultValue=\"overview\" className=\"max-w-2xl\">\n <TabsList aria-label=\"Customer sections\">\n {SECTIONS.map((section) => (\n <TabsTrigger key={section.value} value={section.value}>\n {section.label}\n </TabsTrigger>\n ))}\n </TabsList>\n {SECTIONS.map((section) => (\n <TabsContent\n key={section.value}\n value={section.value}\n className=\"p-1 text-body-primary text-muted-foreground\"\n >\n {section.body}\n </TabsContent>\n ))}\n </Tabs>\n );\n}"
|
|
21486
22107
|
},
|
|
22108
|
+
{
|
|
22109
|
+
"name": "tabs/compact",
|
|
22110
|
+
"code": "\"use client\";\n\nimport { Tabs, TabsContent, TabsList, TabsTrigger } from \"@dodopayments/ui/tabs\";\n\nexport default function TabsCompact() {\n return (\n <div className=\"flex w-full max-w-md flex-col gap-6\">\n <Tabs defaultValue=\"all\">\n <TabsList size=\"sm\" aria-label=\"Payments\">\n <TabsTrigger value=\"all\">All</TabsTrigger>\n <TabsTrigger value=\"succeeded\">Succeeded</TabsTrigger>\n <TabsTrigger value=\"failed\">Failed</TabsTrigger>\n </TabsList>\n <TabsContent value=\"all\" className=\"text-body-primary text-muted-foreground\">\n Every payment.\n </TabsContent>\n <TabsContent value=\"succeeded\" className=\"text-body-primary text-muted-foreground\">\n Payments that went through.\n </TabsContent>\n <TabsContent value=\"failed\" className=\"text-body-primary text-muted-foreground\">\n Payments that failed.\n </TabsContent>\n </Tabs>\n <Tabs defaultValue=\"7d\">\n <TabsList variant=\"pill\" size=\"sm\" aria-label=\"Period\">\n <TabsTrigger value=\"7d\">7 days</TabsTrigger>\n <TabsTrigger value=\"30d\">30 days</TabsTrigger>\n <TabsTrigger value=\"90d\">90 days</TabsTrigger>\n </TabsList>\n </Tabs>\n </div>\n );\n}"
|
|
22111
|
+
},
|
|
21487
22112
|
{
|
|
21488
22113
|
"name": "tabs/icon-count",
|
|
21489
22114
|
"code": "\"use client\";\n\nimport { BellIcon, CreditCardIcon, UserIcon } from \"@dodopayments/ui/icons\";\nimport { Tabs, TabsContent, TabsList, TabsTrigger } from \"@dodopayments/ui/tabs\";\n\nexport default function TabsIconCount() {\n return (\n <Tabs defaultValue=\"all\" className=\"max-w-md\">\n <TabsList aria-label=\"Notifications\">\n <TabsTrigger value=\"all\" icon={<BellIcon aria-hidden=\"true\" />} count={19}>\n All\n </TabsTrigger>\n <TabsTrigger value=\"transactions\" icon={<CreditCardIcon aria-hidden=\"true\" />} count={4}>\n Transactions\n </TabsTrigger>\n <TabsTrigger value=\"business\" icon={<UserIcon aria-hidden=\"true\" />}>\n Business\n </TabsTrigger>\n </TabsList>\n <TabsContent value=\"all\" className=\"pt-3 text-body-secondary text-muted-foreground\">\n 19 unread notifications.\n </TabsContent>\n <TabsContent value=\"transactions\" className=\"pt-3 text-body-secondary text-muted-foreground\">\n 4 payments need a look.\n </TabsContent>\n <TabsContent value=\"business\" className=\"pt-3 text-body-secondary text-muted-foreground\">\n No new notifications.\n </TabsContent>\n </Tabs>\n );\n}"
|
|
@@ -21590,7 +22215,14 @@
|
|
|
21590
22215
|
"name": "leadingIcon",
|
|
21591
22216
|
"type": "ReactNode",
|
|
21592
22217
|
"required": false,
|
|
21593
|
-
"description": "An icon before the label (Figma \"Show leading icon\"), 12px, e.g. a clock on a session timer or a card on a\npayment method chip. Decorative: the label names the badge. Replaces the `dot`.",
|
|
22218
|
+
"description": "An icon before the label (Figma \"Show leading icon\"), 12px, e.g. a clock on a session timer or a card on a\npayment method chip. Decorative: the label names the badge. Replaces the `dot`.",
|
|
22219
|
+
"source": "dodo"
|
|
22220
|
+
},
|
|
22221
|
+
{
|
|
22222
|
+
"name": "size",
|
|
22223
|
+
"type": "\"sm\" | \"md\" | null",
|
|
22224
|
+
"required": false,
|
|
22225
|
+
"description": "",
|
|
21594
22226
|
"source": "dodo"
|
|
21595
22227
|
},
|
|
21596
22228
|
{
|
|
@@ -21627,7 +22259,7 @@
|
|
|
21627
22259
|
"examples": [
|
|
21628
22260
|
{
|
|
21629
22261
|
"name": "test-mode-banner/basic",
|
|
21630
|
-
"code": "\"use client\";\n\nimport { TestModeBadge, TestModeBanner } from \"@dodopayments/ui/test-mode-banner\";\n\nexport default function TestModeBannerBasic() {\n return (\n <div className=\"w-full overflow-hidden rounded-xl border\">\n <TestModeBanner\n onSwitchToLive={() => undefined}\n learnMoreHref=\"https://docs.dodopayments.com/miscellaneous/test-mode-vs-live-mode\"\n />\n <div className=\"flex items-center gap-2 p-4
|
|
22262
|
+
"code": "\"use client\";\n\nimport { TestModeBadge, TestModeBanner } from \"@dodopayments/ui/test-mode-banner\";\n\nexport default function TestModeBannerBasic() {\n return (\n <div className=\"w-full overflow-hidden rounded-xl border border-border bg-background\">\n <TestModeBanner\n onSwitchToLive={() => undefined}\n learnMoreHref=\"https://docs.dodopayments.com/miscellaneous/test-mode-vs-live-mode\"\n />\n <div className=\"flex items-center gap-2 p-4\">\n <span className=\"min-w-0 truncate text-label-primary text-foreground\">\n pay_2IjeQm4hqU6RA4Z4kwDee\n </span>\n <TestModeBadge />\n </div>\n </div>\n );\n}"
|
|
21631
22263
|
}
|
|
21632
22264
|
],
|
|
21633
22265
|
"docsUrl": "/components/test-mode-banner"
|
|
@@ -21737,7 +22369,7 @@
|
|
|
21737
22369
|
},
|
|
21738
22370
|
{
|
|
21739
22371
|
"name": "size",
|
|
21740
|
-
"type": "\"default\" | \"icon\" | \"xs\" | \"lg\" | \"icon-xs\" | \"icon-lg\" | null",
|
|
22372
|
+
"type": "\"default\" | \"sm\" | \"icon\" | \"xs\" | \"lg\" | \"icon-sm\" | \"icon-xs\" | \"icon-lg\" | null",
|
|
21741
22373
|
"required": false,
|
|
21742
22374
|
"description": "",
|
|
21743
22375
|
"source": "dodo"
|
|
@@ -23918,7 +24550,7 @@
|
|
|
23918
24550
|
"examples": [
|
|
23919
24551
|
{
|
|
23920
24552
|
"name": "milestone/celebration",
|
|
23921
|
-
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport { type MilestoneCategory, MilestoneToast } from \"@dodopayments/ui/milestone\";\nimport { SegmentedControl } from \"@dodopayments/ui/segmented-control\";\nimport { useState } from \"react\";\n\nconst NOTICES: Record<MilestoneCategory, { title: string; description: string }> = {\n customers: {\n title: \"100 customers, and counting\",\n description: \"You've officially got product-market fit. Let the world know.\",\n },\n geography: {\n title: \"Your business has no borders\",\n description: \"You've made sales in 23 countries. Most founders never leave their home market.\",\n },\n revenue: {\n title: \"Crossed $10,000\",\n description:\n \"From zero to $10,000 that's real money, from people who believed in what you built.\",\n },\n growth: {\n title: \"3x growth this month\",\n description: \"Month over month, you didn't just grow, you multiplied.\",\n },\n};\n\nexport default function MilestoneCelebration() {\n const [category, setCategory] = useState<MilestoneCategory>(\"customers\");\n const [open, setOpen] = useState(true);\n\n return (\n <div className=\"flex flex-col items-center gap-6\">\n <SegmentedControl\n aria-label=\"Milestone category\"\n value={category}\n onValueChange={(value) => {\n setCategory(value as MilestoneCategory);\n setOpen(true);\n }}\n items={[\n { value: \"customers\", label: \"Customers\" },\n { value: \"geography\", label: \"Geography\" },\n { value: \"revenue\", label: \"Revenue\" },\n { value: \"growth\", label: \"Growth\" },\n ]}\n />\n {open ? (\n <MilestoneToast\n category={category}\n {...NOTICES[category]}\n onShare={() => setOpen(false)}\n onDismiss={() => setOpen(false)}\n />\n ) : (\n <Button variant=\"secondary\" onClick={() => setOpen(true)}>\n Show the notice again\n </Button>\n )}\n </div>\n );\n}"
|
|
24553
|
+
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport { type MilestoneCategory, MilestoneToast } from \"@dodopayments/ui/milestone\";\nimport { SegmentedControl } from \"@dodopayments/ui/segmented-control\";\nimport { useState } from \"react\";\n\nconst NOTICES: Record<MilestoneCategory, { title: string; description: string }> = {\n customers: {\n title: \"100 customers, and counting\",\n description: \"You've officially got product-market fit. Let the world know.\",\n },\n geography: {\n title: \"Your business has no borders\",\n description: \"You've made sales in 23 countries. Most founders never leave their home market.\",\n },\n revenue: {\n title: \"Crossed $10,000\",\n description:\n \"From zero to $10,000 that's real money, from people who believed in what you built.\",\n },\n growth: {\n title: \"3x growth this month\",\n description: \"Month over month, you didn't just grow, you multiplied.\",\n },\n};\n\nexport default function MilestoneCelebration() {\n const [category, setCategory] = useState<MilestoneCategory>(\"customers\");\n const [open, setOpen] = useState(true);\n\n return (\n <div className=\"flex w-full flex-col items-center gap-6\">\n <SegmentedControl\n aria-label=\"Milestone category\"\n value={category}\n onValueChange={(value) => {\n setCategory(value as MilestoneCategory);\n setOpen(true);\n }}\n items={[\n { value: \"customers\", label: \"Customers\" },\n { value: \"geography\", label: \"Geography\" },\n { value: \"revenue\", label: \"Revenue\" },\n { value: \"growth\", label: \"Growth\" },\n ]}\n />\n {open ? (\n <MilestoneToast\n category={category}\n {...NOTICES[category]}\n onShare={() => setOpen(false)}\n onDismiss={() => setOpen(false)}\n />\n ) : (\n <Button variant=\"secondary\" onClick={() => setOpen(true)}>\n Show the notice again\n </Button>\n )}\n </div>\n );\n}"
|
|
23922
24554
|
},
|
|
23923
24555
|
{
|
|
23924
24556
|
"name": "milestone/empty",
|
|
@@ -23943,6 +24575,69 @@
|
|
|
23943
24575
|
],
|
|
23944
24576
|
"docsUrl": "/components/milestone"
|
|
23945
24577
|
},
|
|
24578
|
+
{
|
|
24579
|
+
"slug": "sale-share-card",
|
|
24580
|
+
"title": "Sale share card",
|
|
24581
|
+
"category": "Data display",
|
|
24582
|
+
"status": "stable",
|
|
24583
|
+
"description": "A new sale as an image to share (the dashboard's payments list, Share): 720 by 400, the artwork behind, the\nbusiness chip, a headline and the amount in the brand lime with a dark outline. Always light, whatever the theme,\nso the saved picture looks the same. Capture this element at its own size, and preview it in a `ScaledFrame`.",
|
|
24584
|
+
"importPath": "@dodopayments/ui/sale-share-card",
|
|
24585
|
+
"exports": [
|
|
24586
|
+
"SaleShareBusiness",
|
|
24587
|
+
"SaleShareCard",
|
|
24588
|
+
"SaleShareCardProps"
|
|
24589
|
+
],
|
|
24590
|
+
"parts": [
|
|
24591
|
+
{
|
|
24592
|
+
"name": "SaleShareCard",
|
|
24593
|
+
"description": "A new sale as an image to share (the dashboard's payments list, Share): 720 by 400, the artwork behind, the\nbusiness chip, a headline and the amount in the brand lime with a dark outline. Always light, whatever the theme,\nso the saved picture looks the same. Capture this element at its own size, and preview it in a `ScaledFrame`.",
|
|
24594
|
+
"props": [
|
|
24595
|
+
{
|
|
24596
|
+
"name": "amount",
|
|
24597
|
+
"type": "string",
|
|
24598
|
+
"required": true,
|
|
24599
|
+
"description": "The sale, formatted, e.g. \"$1,234.56\". It shrinks to fit the card.",
|
|
24600
|
+
"source": "dodo"
|
|
24601
|
+
},
|
|
24602
|
+
{
|
|
24603
|
+
"name": "background",
|
|
24604
|
+
"type": "string",
|
|
24605
|
+
"required": true,
|
|
24606
|
+
"description": "The artwork behind the card, an image URL. Decorative.",
|
|
24607
|
+
"source": "dodo"
|
|
24608
|
+
},
|
|
24609
|
+
{
|
|
24610
|
+
"name": "headline",
|
|
24611
|
+
"type": "ReactNode",
|
|
24612
|
+
"required": true,
|
|
24613
|
+
"description": "The line above the amount, e.g. \"Cha-ching! A new sale is in\".",
|
|
24614
|
+
"source": "dodo"
|
|
24615
|
+
},
|
|
24616
|
+
{
|
|
24617
|
+
"name": "business",
|
|
24618
|
+
"type": "SaleShareBusiness",
|
|
24619
|
+
"required": false,
|
|
24620
|
+
"description": "The business chip at the top. Leave it out when the merchant turns off \"Include business and logo\"; the card\nkeeps its size so the shared image is always 720 by 400.",
|
|
24621
|
+
"source": "dodo"
|
|
24622
|
+
},
|
|
24623
|
+
{
|
|
24624
|
+
"name": "className",
|
|
24625
|
+
"type": "string",
|
|
24626
|
+
"required": false,
|
|
24627
|
+
"description": "Additional Tailwind classes, merged last.",
|
|
24628
|
+
"source": "dodo"
|
|
24629
|
+
}
|
|
24630
|
+
]
|
|
24631
|
+
}
|
|
24632
|
+
],
|
|
24633
|
+
"examples": [
|
|
24634
|
+
{
|
|
24635
|
+
"name": "sale-share-card/master",
|
|
24636
|
+
"code": "\"use client\";\n\nimport { SaleShareCard } from \"@dodopayments/ui/sale-share-card\";\nimport { ScaledFrame } from \"@dodopayments/ui/scaled-frame\";\n\nexport default function SaleShareCardDemo() {\n return (\n <ScaledFrame width={720} height={400} className=\"max-w-180\">\n <SaleShareCard\n amount=\"$1,234.56\"\n headline=\"Cha-ching! A new sale is in\"\n background=\"/samples/sale-share-lagoon.webp\"\n business={{ name: \"Incubix\" }}\n />\n </ScaledFrame>\n );\n}"
|
|
24637
|
+
}
|
|
24638
|
+
],
|
|
24639
|
+
"docsUrl": "/components/sale-share-card"
|
|
24640
|
+
},
|
|
23946
24641
|
{
|
|
23947
24642
|
"slug": "setup-guide",
|
|
23948
24643
|
"title": "Setup guide",
|
|
@@ -24081,7 +24776,7 @@
|
|
|
24081
24776
|
"examples": [
|
|
24082
24777
|
{
|
|
24083
24778
|
"name": "setup-guide/master",
|
|
24084
|
-
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport {\n SetupGuide,\n SetupGuideIntro,\n type SetupGuideItem,\n type SetupGuideTaskState,\n} from \"@dodopayments/ui/setup-guide\";\nimport { useState } from \"react\";\n\nconst VERIFY = [\n [\"product\", \"Product Verification\"],\n [\"identity\", \"Personal identity\"],\n [\"business\", \"Business Information\"],\n [\"bank\", \"Bank Details\"],\n] as const;\nconst TEST = [\n [\"test-product\", \"Create a product\"],\n [\"test-integrate\", \"Integrate\"],\n [\"test-payment\", \"Make first test payment\"],\n] as const;\nconst LIVE = [\n [\"live-products\", \"Create products in Live mode\", false],\n [\"live-integrate\", \"Integrate (live)\", true],\n [\"branding\", \"Set up branding\", true],\n [\"zero-payment\", \"Make a $0 payment\", false],\n] as const;\n\ntype TaskId = (typeof VERIFY)[number][0] | (typeof TEST)[number][0] | (typeof LIVE)[number][0];\n\nconst INITIAL = Object.fromEntries(\n [...VERIFY, ...TEST, ...LIVE].map(([id]) => [id, \"pending\"]),\n) as Record<TaskId, SetupGuideTaskState>;\n\n/**\n * The Setup guide with the Design File's content: press a verification task to submit it (In review), press a test\n * or live task to finish it or use Mark as done, open the steps, collapse the guide, dismiss the intro, and close and\n * reopen the guide.\n */\nexport default function SetupGuideMaster() {\n const [states, setStates] = useState(INITIAL);\n const [intro, setIntro] = useState(true);\n const [open, setOpen] = useState(true);\n const set = (id: TaskId, state: SetupGuideTaskState) =>\n setStates((current) => ({ ...current, [id]: state }));\n\n const items: SetupGuideItem[] = [\n {\n id: \"verify\",\n title: \"Verify your account\",\n tasks: VERIFY.map(([id, label]) => ({\n id,\n label,\n state: states[id],\n // A pending form opens; submitting it puts it in review.\n onSelect: states[id] === \"pending\" ? () => set(id, \"in-review\") : undefined,\n })),\n },\n {\n id: \"test\",\n title: \"Test mode integration\",\n tasks: TEST.map(([id, label]) => ({\n id,\n label,\n state: states[id],\n onSelect: states[id] === \"done\" ? undefined : () => set(id, \"done\"),\n })),\n },\n {\n id: \"live\",\n title: \"Live mode integration\",\n tasks: LIVE.map(([id, label, manual]) => ({\n id,\n label,\n state: states[id],\n onSelect: manual || states[id] === \"done\" ? undefined : () => set(id, \"done\"),\n onMarkDone: manual ? () => set(id, \"done\") : undefined,\n })),\n },\n {\n id: \"go-live\",\n title: \"Go live\",\n hint: \"Unlocks once verification is approved\",\n locked: true,\n },\n ];\n\n return (\n <div className=\"flex min-h-130 flex-col items-center justify-end gap-2\">\n {open && intro ? <SetupGuideIntro onDismiss={() => setIntro(false)} /> : null}\n {open ? (\n <SetupGuide items={items} defaultOpenItem=\"verify\" onClose={() => setOpen(false)} />\n ) : (\n <Button variant=\"secondary\" onClick={() => setOpen(true)}>\n Open the setup guide\n </Button>\n )}\n </div>\n );\n}"
|
|
24779
|
+
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport {\n SetupGuide,\n SetupGuideIntro,\n type SetupGuideItem,\n type SetupGuideTaskState,\n} from \"@dodopayments/ui/setup-guide\";\nimport { useState } from \"react\";\n\nconst VERIFY = [\n [\"product\", \"Product Verification\"],\n [\"identity\", \"Personal identity\"],\n [\"business\", \"Business Information\"],\n [\"bank\", \"Bank Details\"],\n] as const;\nconst TEST = [\n [\"test-product\", \"Create a product\"],\n [\"test-integrate\", \"Integrate\"],\n [\"test-payment\", \"Make first test payment\"],\n] as const;\nconst LIVE = [\n [\"live-products\", \"Create products in Live mode\", false],\n [\"live-integrate\", \"Integrate (live)\", true],\n [\"branding\", \"Set up branding\", true],\n [\"zero-payment\", \"Make a $0 payment\", false],\n] as const;\n\ntype TaskId = (typeof VERIFY)[number][0] | (typeof TEST)[number][0] | (typeof LIVE)[number][0];\n\nconst INITIAL = Object.fromEntries(\n [...VERIFY, ...TEST, ...LIVE].map(([id]) => [id, \"pending\"]),\n) as Record<TaskId, SetupGuideTaskState>;\n\n/**\n * The Setup guide with the Design File's content: press a verification task to submit it (In review), press a test\n * or live task to finish it or use Mark as done, open the steps, collapse the guide, dismiss the intro, and close and\n * reopen the guide.\n */\nexport default function SetupGuideMaster() {\n const [states, setStates] = useState(INITIAL);\n const [intro, setIntro] = useState(true);\n const [open, setOpen] = useState(true);\n const set = (id: TaskId, state: SetupGuideTaskState) =>\n setStates((current) => ({ ...current, [id]: state }));\n\n const items: SetupGuideItem[] = [\n {\n id: \"verify\",\n title: \"Verify your account\",\n tasks: VERIFY.map(([id, label]) => ({\n id,\n label,\n state: states[id],\n // A pending form opens; submitting it puts it in review.\n onSelect: states[id] === \"pending\" ? () => set(id, \"in-review\") : undefined,\n })),\n },\n {\n id: \"test\",\n title: \"Test mode integration\",\n tasks: TEST.map(([id, label]) => ({\n id,\n label,\n state: states[id],\n onSelect: states[id] === \"done\" ? undefined : () => set(id, \"done\"),\n })),\n },\n {\n id: \"live\",\n title: \"Live mode integration\",\n tasks: LIVE.map(([id, label, manual]) => ({\n id,\n label,\n state: states[id],\n onSelect: manual || states[id] === \"done\" ? undefined : () => set(id, \"done\"),\n onMarkDone: manual ? () => set(id, \"done\") : undefined,\n })),\n },\n {\n id: \"go-live\",\n title: \"Go live\",\n hint: \"Unlocks once verification is approved\",\n locked: true,\n },\n ];\n\n return (\n <div className=\"flex min-h-130 w-full flex-col items-center justify-end gap-2\">\n {open && intro ? <SetupGuideIntro onDismiss={() => setIntro(false)} /> : null}\n {open ? (\n <SetupGuide items={items} defaultOpenItem=\"verify\" onClose={() => setOpen(false)} />\n ) : (\n <Button variant=\"secondary\" onClick={() => setOpen(true)}>\n Open the setup guide\n </Button>\n )}\n </div>\n );\n}"
|
|
24085
24780
|
},
|
|
24086
24781
|
{
|
|
24087
24782
|
"name": "setup-guide/with-top-bar",
|
|
@@ -24142,7 +24837,7 @@
|
|
|
24142
24837
|
"name": "renderItem",
|
|
24143
24838
|
"type": "(item: T) => ReactNode",
|
|
24144
24839
|
"required": true,
|
|
24145
|
-
"description": "Content of one cell.",
|
|
24840
|
+
"description": "Content of one cell: drawn in the white panel of the cell's card tray.",
|
|
24146
24841
|
"source": "dodo"
|
|
24147
24842
|
},
|
|
24148
24843
|
{
|
|
@@ -24198,6 +24893,13 @@
|
|
|
24198
24893
|
"description": "Called with the id of the filter the user picks.",
|
|
24199
24894
|
"source": "dodo"
|
|
24200
24895
|
},
|
|
24896
|
+
{
|
|
24897
|
+
"name": "renderTitle",
|
|
24898
|
+
"type": "((item: T) => ReactNode)",
|
|
24899
|
+
"required": false,
|
|
24900
|
+
"description": "Title of one cell, at the top of its white panel above the `renderItem` content (Heading/Quaternary,\ntruncated). Without it the panel holds `renderItem` only.",
|
|
24901
|
+
"source": "dodo"
|
|
24902
|
+
},
|
|
24201
24903
|
{
|
|
24202
24904
|
"name": "rowHeight",
|
|
24203
24905
|
"type": "number",
|
|
@@ -24274,7 +24976,7 @@
|
|
|
24274
24976
|
"examples": [
|
|
24275
24977
|
{
|
|
24276
24978
|
"name": "filter-grid/basic",
|
|
24277
|
-
"code": "\"use client\";\n\nimport { FilterGrid, type FilterGridFilter } from \"@dodopayments/ui/filter-grid\";\n\ninterface Product {\n id: string;\n name: string;\n price: string;\n kind: \"subscription\" | \"one-time\" | \"usage\";\n}\n\nconst PRODUCTS: Product[] = [\n { id: \"p1\", name: \"Starter\", price: \"$9 / mo\", kind: \"subscription\" },\n { id: \"p2\", name: \"Pro\", price: \"$29 / mo\", kind: \"subscription\" },\n { id: \"p3\", name: \"Team\", price: \"$99 / mo\", kind: \"subscription\" },\n { id: \"p4\", name: \"Lifetime license\", price: \"$249\", kind: \"one-time\" },\n { id: \"p5\", name: \"Icon pack\", price: \"$19\", kind: \"one-time\" },\n { id: \"p6\", name: \"API calls\", price: \"$0.002 / call\", kind: \"usage\" },\n { id: \"p7\", name: \"Storage\", price: \"$0.10 / GB\", kind: \"usage\" },\n];\n\nconst FILTERS: FilterGridFilter<Product>[] = [\n { id: \"all\", label: \"All\", match: () => true },\n { id: \"subscription\", label: \"Subscriptions\", match: (p) => p.kind === \"subscription\" },\n { id: \"one-time\", label: \"One-time\", match: (p) => p.kind === \"one-time\" },\n { id: \"usage\", label: \"Usage\", match: (p) => p.kind === \"usage\" },\n];\n\nexport default function FilterGridBasic() {\n return (\n <FilterGrid\n className=\"max-w-lg\"\n aria-label=\"Product type\"\n items={PRODUCTS}\n filters={FILTERS}\n getKey={(p) => p.id}\n
|
|
24979
|
+
"code": "\"use client\";\n\nimport { FilterGrid, type FilterGridFilter } from \"@dodopayments/ui/filter-grid\";\n\ninterface Product {\n id: string;\n name: string;\n price: string;\n kind: \"subscription\" | \"one-time\" | \"usage\";\n}\n\nconst PRODUCTS: Product[] = [\n { id: \"p1\", name: \"Starter\", price: \"$9 / mo\", kind: \"subscription\" },\n { id: \"p2\", name: \"Pro\", price: \"$29 / mo\", kind: \"subscription\" },\n { id: \"p3\", name: \"Team\", price: \"$99 / mo\", kind: \"subscription\" },\n { id: \"p4\", name: \"Lifetime license\", price: \"$249\", kind: \"one-time\" },\n { id: \"p5\", name: \"Icon pack\", price: \"$19\", kind: \"one-time\" },\n { id: \"p6\", name: \"API calls\", price: \"$0.002 / call\", kind: \"usage\" },\n { id: \"p7\", name: \"Storage\", price: \"$0.10 / GB\", kind: \"usage\" },\n];\n\nconst FILTERS: FilterGridFilter<Product>[] = [\n { id: \"all\", label: \"All\", match: () => true },\n { id: \"subscription\", label: \"Subscriptions\", match: (p) => p.kind === \"subscription\" },\n { id: \"one-time\", label: \"One-time\", match: (p) => p.kind === \"one-time\" },\n { id: \"usage\", label: \"Usage\", match: (p) => p.kind === \"usage\" },\n];\n\nexport default function FilterGridBasic() {\n return (\n <FilterGrid\n className=\"max-w-lg\"\n aria-label=\"Product type\"\n items={PRODUCTS}\n filters={FILTERS}\n getKey={(p) => p.id}\n renderTitle={(p) => p.name}\n renderItem={(p) => <span className=\"text-body-secondary text-muted-foreground\">{p.price}</span>}\n />\n );\n}"
|
|
24278
24980
|
},
|
|
24279
24981
|
{
|
|
24280
24982
|
"name": "filter-grid/empty",
|
|
@@ -24478,7 +25180,7 @@
|
|
|
24478
25180
|
},
|
|
24479
25181
|
{
|
|
24480
25182
|
"name": "size",
|
|
24481
|
-
"type": "\"default\" | \"icon\" | \"xs\" | \"lg\" | \"icon-xs\" | \"icon-lg\" | null",
|
|
25183
|
+
"type": "\"default\" | \"sm\" | \"icon\" | \"xs\" | \"lg\" | \"icon-sm\" | \"icon-xs\" | \"icon-lg\" | null",
|
|
24482
25184
|
"required": false,
|
|
24483
25185
|
"description": "",
|
|
24484
25186
|
"source": "dodo"
|
|
@@ -24649,7 +25351,7 @@
|
|
|
24649
25351
|
},
|
|
24650
25352
|
{
|
|
24651
25353
|
"name": "size",
|
|
24652
|
-
"type": "\"default\" | \"icon\" | \"xs\" | \"lg\" | \"icon-xs\" | \"icon-lg\" | null",
|
|
25354
|
+
"type": "\"default\" | \"sm\" | \"icon\" | \"xs\" | \"lg\" | \"icon-sm\" | \"icon-xs\" | \"icon-lg\" | null",
|
|
24653
25355
|
"required": false,
|
|
24654
25356
|
"description": "",
|
|
24655
25357
|
"source": "dodo"
|
|
@@ -24930,6 +25632,13 @@
|
|
|
24930
25632
|
"description": "Turns off dragging and keyboard moves.",
|
|
24931
25633
|
"source": "dodo"
|
|
24932
25634
|
},
|
|
25635
|
+
{
|
|
25636
|
+
"name": "interactive",
|
|
25637
|
+
"type": "boolean",
|
|
25638
|
+
"required": false,
|
|
25639
|
+
"description": "Rows hold their own controls, such as a switch or a menu. Their content stays readable by assistive\ntechnology, a key pressed on a control does not grab the row, and a row drags only from its handle, so a\nclick on a control never starts a drag.",
|
|
25640
|
+
"source": "dodo"
|
|
25641
|
+
},
|
|
24933
25642
|
{
|
|
24934
25643
|
"name": "onValueCommitted",
|
|
24935
25644
|
"type": "((next: T[]) => void)",
|
|
@@ -25005,11 +25714,15 @@
|
|
|
25005
25714
|
"examples": [
|
|
25006
25715
|
{
|
|
25007
25716
|
"name": "reorder-list/basic",
|
|
25008
|
-
"code": "\"use client\";\n\nimport { ReorderList } from \"@dodopayments/ui/reorder-list\";\nimport { useState } from \"react\";\n\ninterface Method {\n id: string;\n name: string;\n detail: string;\n}\n\nconst METHODS: Method[] = [\n { id: \"card\", name: \"Cards\", detail: \"Visa, Mastercard, Amex\" },\n { id: \"upi\", name: \"UPI\", detail: \"India only\" },\n { id: \"wallets\", name: \"Wallets\", detail: \"Apple Pay, Google Pay\" },\n { id: \"bank\", name: \"Bank transfer\", detail: \"SEPA, ACH\" },\n];\n\nexport default function ReorderListBasic() {\n const [methods, setMethods] = useState(METHODS);\n\n return (\n <div className=\"flex w-full max-w-sm flex-col gap-3\">\n <ReorderList\n aria-label=\"Checkout payment methods\"\n value={methods}\n getKey={(m) => m.id}\n getLabel={(m) => m.name}\n onValueChange={setMethods}\n >\n {(m) => (\n <div className=\"flex items-center justify-between gap-3\">\n <span className=\"
|
|
25717
|
+
"code": "\"use client\";\n\nimport { ReorderList } from \"@dodopayments/ui/reorder-list\";\nimport { useState } from \"react\";\n\ninterface Method {\n id: string;\n name: string;\n detail: string;\n}\n\nconst METHODS: Method[] = [\n { id: \"card\", name: \"Cards\", detail: \"Visa, Mastercard, Amex\" },\n { id: \"upi\", name: \"UPI\", detail: \"India only\" },\n { id: \"wallets\", name: \"Wallets\", detail: \"Apple Pay, Google Pay\" },\n { id: \"bank\", name: \"Bank transfer\", detail: \"SEPA, ACH\" },\n];\n\nexport default function ReorderListBasic() {\n const [methods, setMethods] = useState(METHODS);\n\n return (\n <div className=\"flex w-full max-w-sm flex-col gap-3\">\n <ReorderList\n aria-label=\"Checkout payment methods\"\n value={methods}\n getKey={(m) => m.id}\n getLabel={(m) => m.name}\n onValueChange={setMethods}\n >\n {(m) => (\n <div className=\"flex items-center justify-between gap-3\">\n <span className=\"text-label-primary\">{m.name}</span>\n <span className=\"truncate text-body-secondary text-muted-foreground\">{m.detail}</span>\n </div>\n )}\n </ReorderList>\n <p className=\"text-body-primary text-muted-foreground\">\n Checkout order: {methods.map((m) => m.name).join(\", \")}\n </p>\n </div>\n );\n}"
|
|
25009
25718
|
},
|
|
25010
25719
|
{
|
|
25011
25720
|
"name": "reorder-list/commit",
|
|
25012
25721
|
"code": "\"use client\";\n\nimport { ReorderList } from \"@dodopayments/ui/reorder-list\";\nimport { useState } from \"react\";\n\nconst STEPS = [\n \"Verify email\",\n \"Add a payment method\",\n \"Create a product\",\n \"Share the checkout link\",\n];\n\nexport default function ReorderListCommit() {\n const [steps, setSteps] = useState(STEPS);\n const [saved, setSaved] = useState(0);\n\n return (\n <div className=\"flex w-full max-w-sm flex-col gap-3\">\n <ReorderList\n aria-label=\"Onboarding steps\"\n value={steps}\n getKey={(s) => s}\n getLabel={(s) => s}\n onValueChange={setSteps}\n onValueCommitted={() => {\n setSaved((n) => n + 1);\n }}\n >\n {(s) => s}\n </ReorderList>\n <p className=\"text-body-primary text-muted-foreground\">\n Saved {saved} times. A save runs once per drop.\n </p>\n </div>\n );\n}"
|
|
25722
|
+
},
|
|
25723
|
+
{
|
|
25724
|
+
"name": "reorder-list/interactive",
|
|
25725
|
+
"code": "\"use client\";\n\nimport { ReorderList } from \"@dodopayments/ui/reorder-list\";\nimport { Switch } from \"@dodopayments/ui/switch\";\nimport { useState } from \"react\";\n\nconst PLANS = [\n { id: \"monthly\", name: \"Pro monthly\", on: true },\n { id: \"annual\", name: \"Pro annual\", on: true },\n { id: \"lifetime\", name: \"Lifetime\", on: false },\n];\n\nexport default function ReorderListInteractive() {\n const [plans, setPlans] = useState(PLANS);\n\n return (\n <ReorderList\n aria-label=\"Plans at checkout\"\n className=\"max-w-sm\"\n interactive\n value={plans}\n getKey={(p) => p.id}\n getLabel={(p) => p.name}\n onValueChange={setPlans}\n >\n {(p) => (\n <label className=\"flex items-center justify-between gap-3\">\n <span className=\"text-label-primary\">{p.name}</span>\n <Switch\n checked={p.on}\n onCheckedChange={(on) => {\n setPlans((all) => all.map((x) => (x.id === p.id ? { ...x, on } : x)));\n }}\n />\n </label>\n )}\n </ReorderList>\n );\n}"
|
|
25013
25726
|
}
|
|
25014
25727
|
],
|
|
25015
25728
|
"docsUrl": "/components/reorder-list"
|
|
@@ -25648,6 +26361,8 @@
|
|
|
25648
26361
|
"description": "A timestamp that reveals the exact time on hover, focus or tap: the trigger shows the time in\n`format`, the tooltip lists it in the preferred (or device) zone, in UTC, relative to now and as\nepoch milliseconds. Relative times refresh every 30 seconds. Built on the `Tooltip` primitive; on\ntouch (coarse pointer) devices a tap toggles it, since primitive tooltips open on hover and focus only.",
|
|
25649
26362
|
"importPath": "@dodopayments/ui/timestamp",
|
|
25650
26363
|
"exports": [
|
|
26364
|
+
"TimeZoneProvider",
|
|
26365
|
+
"TimeZoneProviderProps",
|
|
25651
26366
|
"Timestamp",
|
|
25652
26367
|
"TimestampFormat",
|
|
25653
26368
|
"TimestampLabels",
|
|
@@ -25684,7 +26399,7 @@
|
|
|
25684
26399
|
"name": "timeZone",
|
|
25685
26400
|
"type": "string",
|
|
25686
26401
|
"required": false,
|
|
25687
|
-
"description": "IANA time zone (e.g. \"Asia/Kolkata\") for the trigger and the first tooltip row. When
|
|
26402
|
+
"description": "IANA time zone (e.g. \"Asia/Kolkata\") for the trigger and the first tooltip row, over the\nnearest `TimeZoneProvider`'s. When neither is set or valid, the trigger uses UTC and the first row uses the device's zone.",
|
|
25688
26403
|
"source": "dodo"
|
|
25689
26404
|
},
|
|
25690
26405
|
{
|
|
@@ -25741,6 +26456,19 @@
|
|
|
25741
26456
|
"source": "base-ui"
|
|
25742
26457
|
}
|
|
25743
26458
|
]
|
|
26459
|
+
},
|
|
26460
|
+
{
|
|
26461
|
+
"name": "TimeZoneProvider",
|
|
26462
|
+
"description": "Sets the time zone of every `Timestamp` inside it (and the components built on it, such as the\nActivity timeline), e.g. a business's preferred zone. A `timeZone` prop on a Timestamp still wins.",
|
|
26463
|
+
"props": [
|
|
26464
|
+
{
|
|
26465
|
+
"name": "timeZone",
|
|
26466
|
+
"type": "string",
|
|
26467
|
+
"required": true,
|
|
26468
|
+
"description": "IANA time zone every `Timestamp` inside uses when it has no `timeZone` of its own.",
|
|
26469
|
+
"source": "dodo"
|
|
26470
|
+
}
|
|
26471
|
+
]
|
|
25744
26472
|
}
|
|
25745
26473
|
],
|
|
25746
26474
|
"examples": [
|
|
@@ -26814,6 +27542,222 @@
|
|
|
26814
27542
|
],
|
|
26815
27543
|
"docsUrl": "/blocks/details-panel"
|
|
26816
27544
|
},
|
|
27545
|
+
{
|
|
27546
|
+
"slug": "invoice-document",
|
|
27547
|
+
"title": "Invoice Document",
|
|
27548
|
+
"category": "Blocks",
|
|
27549
|
+
"status": "stable",
|
|
27550
|
+
"description": "An invoice as its PDF prints, ported from the dashboard's invoice preview: A4 at 72 dpi (595 wide,\nat least 842 tall) with the title, status and merchant on a grey strip, the parties, the amount due,\nthe details, the lines and the totals, then Dodo's footer. It always draws light, as the PDF does.\nPut it in a `ScaledFrame` with `width={595}` to fit it to a column.",
|
|
27551
|
+
"importPath": "@dodopayments/ui/invoice-document",
|
|
27552
|
+
"exports": [
|
|
27553
|
+
"InvoiceDocument",
|
|
27554
|
+
"InvoiceDocumentCustomer",
|
|
27555
|
+
"InvoiceDocumentFact",
|
|
27556
|
+
"InvoiceDocumentIssuer",
|
|
27557
|
+
"InvoiceDocumentLabels",
|
|
27558
|
+
"InvoiceDocumentMerchant",
|
|
27559
|
+
"InvoiceDocumentProps",
|
|
27560
|
+
"InvoiceDocumentRow",
|
|
27561
|
+
"InvoiceDocumentTotal",
|
|
27562
|
+
"InvoiceOnlineLabels",
|
|
27563
|
+
"InvoiceOnlinePage",
|
|
27564
|
+
"InvoiceOnlinePageProps",
|
|
27565
|
+
"InvoiceOnlineRow"
|
|
27566
|
+
],
|
|
27567
|
+
"parts": [
|
|
27568
|
+
{
|
|
27569
|
+
"name": "InvoiceDocument",
|
|
27570
|
+
"description": "An invoice as its PDF prints, ported from the dashboard's invoice preview: A4 at 72 dpi (595 wide,\nat least 842 tall) with the title, status and merchant on a grey strip, the parties, the amount due,\nthe details, the lines and the totals, then Dodo's footer. It always draws light, as the PDF does.\nPut it in a `ScaledFrame` with `width={595}` to fit it to a column.",
|
|
27571
|
+
"props": [
|
|
27572
|
+
{
|
|
27573
|
+
"name": "customer",
|
|
27574
|
+
"type": "InvoiceDocumentCustomer",
|
|
27575
|
+
"required": true,
|
|
27576
|
+
"description": "",
|
|
27577
|
+
"source": "dodo"
|
|
27578
|
+
},
|
|
27579
|
+
{
|
|
27580
|
+
"name": "details",
|
|
27581
|
+
"type": "readonly [readonly InvoiceDocumentFact[], readonly InvoiceDocumentFact[]]",
|
|
27582
|
+
"required": true,
|
|
27583
|
+
"description": "Invoice details in two columns: the number (and payment), then the date and currency.",
|
|
27584
|
+
"source": "dodo"
|
|
27585
|
+
},
|
|
27586
|
+
{
|
|
27587
|
+
"name": "footer",
|
|
27588
|
+
"type": "{ disclaimer: ReactNode; copyright: ReactNode; }",
|
|
27589
|
+
"required": true,
|
|
27590
|
+
"description": "The disclaimer and copyright in the footer.",
|
|
27591
|
+
"source": "dodo"
|
|
27592
|
+
},
|
|
27593
|
+
{
|
|
27594
|
+
"name": "headline",
|
|
27595
|
+
"type": "ReactNode",
|
|
27596
|
+
"required": true,
|
|
27597
|
+
"description": "The amount line above the details, e.g. \"$40.00 due on Nov 26, 2026\".",
|
|
27598
|
+
"source": "dodo"
|
|
27599
|
+
},
|
|
27600
|
+
{
|
|
27601
|
+
"name": "issuer",
|
|
27602
|
+
"type": "InvoiceDocumentIssuer",
|
|
27603
|
+
"required": true,
|
|
27604
|
+
"description": "",
|
|
27605
|
+
"source": "dodo"
|
|
27606
|
+
},
|
|
27607
|
+
{
|
|
27608
|
+
"name": "merchant",
|
|
27609
|
+
"type": "InvoiceDocumentMerchant",
|
|
27610
|
+
"required": true,
|
|
27611
|
+
"description": "",
|
|
27612
|
+
"source": "dodo"
|
|
27613
|
+
},
|
|
27614
|
+
{
|
|
27615
|
+
"name": "rows",
|
|
27616
|
+
"type": "readonly InvoiceDocumentRow[]",
|
|
27617
|
+
"required": true,
|
|
27618
|
+
"description": "",
|
|
27619
|
+
"source": "dodo"
|
|
27620
|
+
},
|
|
27621
|
+
{
|
|
27622
|
+
"name": "status",
|
|
27623
|
+
"type": "{ label: ReactNode; tone: \"success\" | \"error\" | \"neutral\"; }",
|
|
27624
|
+
"required": true,
|
|
27625
|
+
"description": "The status pill beside the title, e.g. Unpaid in red or Paid in green.",
|
|
27626
|
+
"source": "dodo"
|
|
27627
|
+
},
|
|
27628
|
+
{
|
|
27629
|
+
"name": "totals",
|
|
27630
|
+
"type": "readonly InvoiceDocumentTotal[]",
|
|
27631
|
+
"required": true,
|
|
27632
|
+
"description": "",
|
|
27633
|
+
"source": "dodo"
|
|
27634
|
+
},
|
|
27635
|
+
{
|
|
27636
|
+
"name": "discount",
|
|
27637
|
+
"type": "{ label: ReactNode; amount: ReactNode; }",
|
|
27638
|
+
"required": false,
|
|
27639
|
+
"description": "The discount row under the lines, e.g. \"Discounts Applied “WELCOME10”\" and its amount.",
|
|
27640
|
+
"source": "dodo"
|
|
27641
|
+
},
|
|
27642
|
+
{
|
|
27643
|
+
"name": "labels",
|
|
27644
|
+
"type": "Partial<InvoiceDocumentLabels>",
|
|
27645
|
+
"required": false,
|
|
27646
|
+
"description": "",
|
|
27647
|
+
"source": "dodo"
|
|
27648
|
+
},
|
|
27649
|
+
{
|
|
27650
|
+
"name": "payOnline",
|
|
27651
|
+
"type": "ReactNode",
|
|
27652
|
+
"required": false,
|
|
27653
|
+
"description": "The \"Pay Online\" link text under the headline. Leave it out on a paid invoice.",
|
|
27654
|
+
"source": "dodo"
|
|
27655
|
+
}
|
|
27656
|
+
]
|
|
27657
|
+
},
|
|
27658
|
+
{
|
|
27659
|
+
"name": "InvoiceOnlinePage",
|
|
27660
|
+
"description": "The invoice email or the hosted invoice page, ported from the dashboard's invoice preview: the\nmerchant over a 480-wide card with the amount due, the customer (email) or the parties (hosted), a\nPay button, the order summary and the contact line. It always draws light. Put it in a\n`ScaledFrame` with `width={480}` to fit it to a column.",
|
|
27661
|
+
"props": [
|
|
27662
|
+
{
|
|
27663
|
+
"name": "amount",
|
|
27664
|
+
"type": "ReactNode",
|
|
27665
|
+
"required": true,
|
|
27666
|
+
"description": "The amount due, large.",
|
|
27667
|
+
"source": "dodo"
|
|
27668
|
+
},
|
|
27669
|
+
{
|
|
27670
|
+
"name": "due",
|
|
27671
|
+
"type": "ReactNode",
|
|
27672
|
+
"required": true,
|
|
27673
|
+
"description": "The line under the amount, e.g. \"Due Nov 26, 2026\".",
|
|
27674
|
+
"source": "dodo"
|
|
27675
|
+
},
|
|
27676
|
+
{
|
|
27677
|
+
"name": "merchant",
|
|
27678
|
+
"type": "InvoiceDocumentMerchant",
|
|
27679
|
+
"required": true,
|
|
27680
|
+
"description": "",
|
|
27681
|
+
"source": "dodo"
|
|
27682
|
+
},
|
|
27683
|
+
{
|
|
27684
|
+
"name": "rows",
|
|
27685
|
+
"type": "readonly InvoiceOnlineRow[]",
|
|
27686
|
+
"required": true,
|
|
27687
|
+
"description": "",
|
|
27688
|
+
"source": "dodo"
|
|
27689
|
+
},
|
|
27690
|
+
{
|
|
27691
|
+
"name": "supportEmail",
|
|
27692
|
+
"type": "ReactNode",
|
|
27693
|
+
"required": true,
|
|
27694
|
+
"description": "The address after `labels.contact`.",
|
|
27695
|
+
"source": "dodo"
|
|
27696
|
+
},
|
|
27697
|
+
{
|
|
27698
|
+
"name": "total",
|
|
27699
|
+
"type": "{ label: ReactNode; value: ReactNode; }",
|
|
27700
|
+
"required": true,
|
|
27701
|
+
"description": "The last line of the summary, e.g. \"Total Due\" and its amount.",
|
|
27702
|
+
"source": "dodo"
|
|
27703
|
+
},
|
|
27704
|
+
{
|
|
27705
|
+
"name": "variant",
|
|
27706
|
+
"type": "\"email\" | \"hosted\"",
|
|
27707
|
+
"required": true,
|
|
27708
|
+
"description": "`email` is the email the customer gets; `hosted` the page where they pay.",
|
|
27709
|
+
"source": "dodo"
|
|
27710
|
+
},
|
|
27711
|
+
{
|
|
27712
|
+
"name": "customer",
|
|
27713
|
+
"type": "InvoiceDocumentCustomer",
|
|
27714
|
+
"required": false,
|
|
27715
|
+
"description": "Email only: the customer block, as on the PDF.",
|
|
27716
|
+
"source": "dodo"
|
|
27717
|
+
},
|
|
27718
|
+
{
|
|
27719
|
+
"name": "discount",
|
|
27720
|
+
"type": "{ label: ReactNode; amount: ReactNode; }",
|
|
27721
|
+
"required": false,
|
|
27722
|
+
"description": "",
|
|
27723
|
+
"source": "dodo"
|
|
27724
|
+
},
|
|
27725
|
+
{
|
|
27726
|
+
"name": "facts",
|
|
27727
|
+
"type": "readonly InvoiceDocumentFact[]",
|
|
27728
|
+
"required": false,
|
|
27729
|
+
"description": "Hosted page only: label / value lines such as \"Invoice to :\" and \"From :\".",
|
|
27730
|
+
"source": "dodo"
|
|
27731
|
+
},
|
|
27732
|
+
{
|
|
27733
|
+
"name": "from",
|
|
27734
|
+
"type": "ReactNode",
|
|
27735
|
+
"required": false,
|
|
27736
|
+
"description": "The email's line above the amount, e.g. \"Invoice from Acme\". Email only.",
|
|
27737
|
+
"source": "dodo"
|
|
27738
|
+
},
|
|
27739
|
+
{
|
|
27740
|
+
"name": "labels",
|
|
27741
|
+
"type": "Partial<InvoiceOnlineLabels>",
|
|
27742
|
+
"required": false,
|
|
27743
|
+
"description": "",
|
|
27744
|
+
"source": "dodo"
|
|
27745
|
+
}
|
|
27746
|
+
]
|
|
27747
|
+
}
|
|
27748
|
+
],
|
|
27749
|
+
"examples": [
|
|
27750
|
+
{
|
|
27751
|
+
"name": "invoice-document/online",
|
|
27752
|
+
"code": "\"use client\";\n\nimport { InvoiceOnlinePage } from \"@dodopayments/ui/invoice-document\";\nimport { ScaledFrame } from \"@dodopayments/ui/scaled-frame\";\n\nconst rows = [\n { amount: \"$100.00 / mo\", id: \"plan\", name: \"Growth plan\", quantity: \"Qty : 1\" },\n { amount: \"$25.00\", id: \"seat\", name: \"Extra seat\", quantity: \"Qty : 1\" },\n];\n\nexport default function InvoiceDocumentOnline() {\n return (\n <div className=\"light grid w-full max-w-3xl gap-4 rounded-xl bg-muted px-4 py-8 sm:grid-cols-2\">\n <ScaledFrame width={480}>\n <InvoiceOnlinePage\n amount=\"$125.00\"\n customer={{ address: [\"Berlin\", \"DE\"], email: \"ada@example.com\", name: \"Ada Lovelace\" }}\n due=\"Due Nov 16, 2026\"\n from=\"Invoice from Acme Labs\"\n merchant={{ name: \"Acme Labs\" }}\n rows={rows}\n supportEmail=\"support@dodopayments.com\"\n total={{ label: \"Total Due\", value: \"$125.00\" }}\n variant=\"email\"\n />\n </ScaledFrame>\n <ScaledFrame width={480}>\n <InvoiceOnlinePage\n amount=\"$125.00\"\n due=\"Due Nov 16, 2026\"\n facts={[\n { label: \"Invoice to :\", value: \"Ada Lovelace\" },\n { label: \"From :\", value: \"Acme Labs\" },\n { label: \"Invoice Number :\", value: \"inv_0NrmhsTUbGRG\" },\n ]}\n merchant={{ name: \"Acme Labs\" }}\n rows={rows}\n supportEmail=\"support@dodopayments.com\"\n total={{ label: \"Total Due\", value: \"$125.00\" }}\n variant=\"hosted\"\n />\n </ScaledFrame>\n </div>\n );\n}"
|
|
27753
|
+
},
|
|
27754
|
+
{
|
|
27755
|
+
"name": "invoice-document/pdf",
|
|
27756
|
+
"code": "\"use client\";\n\nimport { InvoiceDocument } from \"@dodopayments/ui/invoice-document\";\nimport { ScaledFrame } from \"@dodopayments/ui/scaled-frame\";\n\nexport default function InvoiceDocumentPdf() {\n return (\n <div className=\"w-full max-w-xl\">\n <ScaledFrame width={595}>\n <InvoiceDocument\n customer={{\n address: [\"Main St 1, Berlin, 10115\", \"DE\"],\n email: \"ada@example.com\",\n name: \"Ada Lovelace\",\n }}\n details={[\n [{ label: \"Invoice Number :\", value: \"inv_0NrmhsTUbGRG\" }],\n [\n { label: \"Invoice Date :\", value: \"Nov 2, 2026\" },\n { label: \"Currency Code :\", value: \"USD\" },\n ],\n ]}\n discount={{ amount: \"$10.00\", label: \"Discounts Applied “WELCOME10”\" }}\n footer={{\n copyright: \"© 2026 Dodo Payments Inc. All rights reserved.\",\n disclaimer:\n \"If you have a problem with your order (example: don’t recognize the charge, suspect a fraudulent transaction, etc,) please visit dodopayments.com\",\n }}\n headline=\"$115.00 due on Nov 16, 2026\"\n issuer={{\n address: \"8 The Green, STE A, Dover, Country of Kent, Delaware, 19901 United States\",\n name: \"Dodo Payments Inc\",\n taxId: \"993486577\",\n }}\n merchant={{ name: \"Acme Labs\" }}\n payOnline=\"Pay Online\"\n rows={[\n {\n amount: \"$100.00\",\n details: [\"Nov 2 - Dec 2, 2026\"],\n id: \"plan\",\n name: \"Growth plan\",\n quantity: 1,\n tax: \"$0.00\",\n taxPercent: \"-\",\n unitPrice: \"$100.00 / mo\",\n },\n {\n addOn: true,\n amount: \"$25.00\",\n id: \"seat\",\n name: \"Extra seat\",\n quantity: 1,\n tax: \"$0.00\",\n taxPercent: \"-\",\n unitPrice: \"$25.00\",\n },\n ]}\n status={{ label: \"Unpaid\", tone: \"error\" }}\n totals={[\n { label: \"Subtotal\", value: \"$115.00\" },\n { label: \"Total Tax\", value: \"$0.00\" },\n { label: \"Total\", value: \"$115.00\" },\n { label: \"Amount Due\", strong: true, value: \"$115.00\" },\n ]}\n />\n </ScaledFrame>\n </div>\n );\n}"
|
|
27757
|
+
}
|
|
27758
|
+
],
|
|
27759
|
+
"docsUrl": "/blocks/invoice-document"
|
|
27760
|
+
},
|
|
26817
27761
|
{
|
|
26818
27762
|
"slug": "payment-result",
|
|
26819
27763
|
"title": "Payment Result",
|
|
@@ -27725,9 +28669,11 @@
|
|
|
27725
28669
|
"title": "Stat Card",
|
|
27726
28670
|
"category": "Blocks",
|
|
27727
28671
|
"status": "stable",
|
|
27728
|
-
"description": "A static metric (Dodo Nest Stat card): the label on a grey strip, the number in a white panel, and an optional\ntrend chip and comparison under it. Put a `StatCardBreakdown` inside for the parts of the number (Payout balance).\n`loading` shows Skeleton lines, `empty` shows \"-\" and a reason, and `error` (with `onRetry`) a retry; what replaces\nthe loading skeletons fades in. Cards in a CSS grid row (`StatGrid`) stretch to one height. Renders a `<section
|
|
28672
|
+
"description": "A static metric (Dodo Nest Stat card): the label on a grey strip, the number in a white panel, and an optional\ntrend chip and comparison under it. Put a `StatCardBreakdown` inside for the parts of the number (Payout balance).\n`loading` shows Skeleton lines, `empty` shows \"-\" and a reason, and `error` (with `onRetry`) a retry; what replaces\nthe loading skeletons fades in. Cards in a CSS grid row (`StatGrid`) stretch to one height. `layout=\"inline\"`\ndrops the tray for a bare stat; a grouped `StatGrid` makes every card in it inline. Renders a `<section>` labelled by the\nlabel.",
|
|
27729
28673
|
"importPath": "@dodopayments/ui/stat-card",
|
|
27730
28674
|
"exports": [
|
|
28675
|
+
"DODO_STAT_CARD_DEFAULT_VARIANTS",
|
|
28676
|
+
"DODO_STAT_CARD_VARIANTS",
|
|
27731
28677
|
"DODO_STAT_GRID_DEFAULT_VARIANTS",
|
|
27732
28678
|
"DODO_STAT_GRID_VARIANTS",
|
|
27733
28679
|
"StatCard",
|
|
@@ -27737,6 +28683,7 @@
|
|
|
27737
28683
|
"StatCardBreakdownRowProps",
|
|
27738
28684
|
"StatCardDirection",
|
|
27739
28685
|
"StatCardLabels",
|
|
28686
|
+
"StatCardLayout",
|
|
27740
28687
|
"StatCardProps",
|
|
27741
28688
|
"StatCardTrend",
|
|
27742
28689
|
"StatGrid",
|
|
@@ -27745,7 +28692,7 @@
|
|
|
27745
28692
|
"parts": [
|
|
27746
28693
|
{
|
|
27747
28694
|
"name": "StatCard",
|
|
27748
|
-
"description": "A static metric (Dodo Nest Stat card): the label on a grey strip, the number in a white panel, and an optional\ntrend chip and comparison under it. Put a `StatCardBreakdown` inside for the parts of the number (Payout balance).\n`loading` shows Skeleton lines, `empty` shows \"-\" and a reason, and `error` (with `onRetry`) a retry; what replaces\nthe loading skeletons fades in. Cards in a CSS grid row (`StatGrid`) stretch to one height. Renders a `<section
|
|
28695
|
+
"description": "A static metric (Dodo Nest Stat card): the label on a grey strip, the number in a white panel, and an optional\ntrend chip and comparison under it. Put a `StatCardBreakdown` inside for the parts of the number (Payout balance).\n`loading` shows Skeleton lines, `empty` shows \"-\" and a reason, and `error` (with `onRetry`) a retry; what replaces\nthe loading skeletons fades in. Cards in a CSS grid row (`StatGrid`) stretch to one height. `layout=\"inline\"`\ndrops the tray for a bare stat; a grouped `StatGrid` makes every card in it inline. Renders a `<section>` labelled by the\nlabel.",
|
|
27749
28696
|
"props": [
|
|
27750
28697
|
{
|
|
27751
28698
|
"name": "label",
|
|
@@ -27819,6 +28766,24 @@
|
|
|
27819
28766
|
"description": "Replaces some or all of the default texts.",
|
|
27820
28767
|
"source": "dodo"
|
|
27821
28768
|
},
|
|
28769
|
+
{
|
|
28770
|
+
"name": "layout",
|
|
28771
|
+
"type": "\"card\" | \"inline\"",
|
|
28772
|
+
"required": false,
|
|
28773
|
+
"description": "",
|
|
28774
|
+
"source": "dodo",
|
|
28775
|
+
"values": [
|
|
28776
|
+
{
|
|
28777
|
+
"value": "card",
|
|
28778
|
+
"description": "The Stat card: the label on a grey strip, the number in a white panel, in its own tray."
|
|
28779
|
+
},
|
|
28780
|
+
{
|
|
28781
|
+
"value": "inline",
|
|
28782
|
+
"description": "A bare stat: the label (Body/Primary, Content/Secondary) over the number, with no tray or panel. For a grouped StatGrid."
|
|
28783
|
+
}
|
|
28784
|
+
],
|
|
28785
|
+
"default": "\"card\""
|
|
28786
|
+
},
|
|
27822
28787
|
{
|
|
27823
28788
|
"name": "loading",
|
|
27824
28789
|
"type": "boolean",
|
|
@@ -27884,7 +28849,7 @@
|
|
|
27884
28849
|
},
|
|
27885
28850
|
{
|
|
27886
28851
|
"name": "StatGrid",
|
|
27887
|
-
"description": "A responsive row of `StatCard`s: a `Grid` of 2, 3 or 4 equal columns, 16 apart, that stacks the cards 12 apart\nwhen narrow. Cards in a row stretch to the same height, so their panels line up.",
|
|
28852
|
+
"description": "A responsive row of `StatCard`s: a `Grid` of 2, 3 or 4 equal columns, 16 apart, that stacks the cards 12 apart\nwhen narrow. Cards in a row stretch to the same height, so their panels line up. `layout=\"group\"` puts the stats\nin one `Card` instead (the page summary under a page header): its cards turn inline, side by side with dividers\nbetween them, stacked with dividers between rows when narrow.",
|
|
27888
28853
|
"props": [
|
|
27889
28854
|
{
|
|
27890
28855
|
"name": "columns",
|
|
@@ -27915,6 +28880,38 @@
|
|
|
27915
28880
|
"description": "",
|
|
27916
28881
|
"source": "dodo"
|
|
27917
28882
|
},
|
|
28883
|
+
{
|
|
28884
|
+
"name": "heading",
|
|
28885
|
+
"type": "ReactNode",
|
|
28886
|
+
"required": false,
|
|
28887
|
+
"description": "With `layout=\"group\"`: the title on the card's strip, e.g. \"Last 30 days\".",
|
|
28888
|
+
"source": "dodo"
|
|
28889
|
+
},
|
|
28890
|
+
{
|
|
28891
|
+
"name": "help",
|
|
28892
|
+
"type": "ReactNode",
|
|
28893
|
+
"required": false,
|
|
28894
|
+
"description": "With `layout=\"group\"` and a `heading`: help text behind an info icon after it.",
|
|
28895
|
+
"source": "dodo"
|
|
28896
|
+
},
|
|
28897
|
+
{
|
|
28898
|
+
"name": "layout",
|
|
28899
|
+
"type": "\"cards\" | \"group\"",
|
|
28900
|
+
"required": false,
|
|
28901
|
+
"description": "",
|
|
28902
|
+
"source": "dodo",
|
|
28903
|
+
"values": [
|
|
28904
|
+
{
|
|
28905
|
+
"value": "cards",
|
|
28906
|
+
"description": "Separate Stat cards, 16 apart (12 apart when they stack)."
|
|
28907
|
+
},
|
|
28908
|
+
{
|
|
28909
|
+
"value": "group",
|
|
28910
|
+
"description": "One Card tray (with an optional `heading`) whose panel lines the stats up as inline stats with dividers between them; they stack with dividers between rows when narrow."
|
|
28911
|
+
}
|
|
28912
|
+
],
|
|
28913
|
+
"default": "\"cards\""
|
|
28914
|
+
},
|
|
27918
28915
|
{
|
|
27919
28916
|
"name": "render",
|
|
27920
28917
|
"type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, {}>",
|
|
@@ -27930,6 +28927,10 @@
|
|
|
27930
28927
|
"name": "stat-card/basic",
|
|
27931
28928
|
"code": "\"use client\";\n\nimport { StatCard, StatGrid } from \"@dodopayments/ui/stat-card\";\n\nexport default function StatCardBasic() {\n return (\n <StatGrid>\n <StatCard\n label=\"Successful payments\"\n help=\"Payments that succeeded in this period, after retries.\"\n value=\"1,240\"\n trend={{ value: \"12.4%\", direction: \"up\" }}\n comparison=\"vs last 30 days\"\n />\n <StatCard\n label=\"Refunds\"\n help=\"Money returned to customers. Growth is bad here, so the trend is inverted.\"\n value=\"$1,920.00\"\n trend={{ value: \"8.1%\", direction: \"up\", invert: true }}\n comparison=\"vs last 30 days\"\n />\n <StatCard\n label=\"Failed payments\"\n help=\"Payments that failed after every retry. No change from the last period shows a grey -%.\"\n value=\"18\"\n trend={{ direction: \"neutral\" }}\n comparison=\"vs last 30 days\"\n />\n </StatGrid>\n );\n}"
|
|
27932
28929
|
},
|
|
28930
|
+
{
|
|
28931
|
+
"name": "stat-card/grouped",
|
|
28932
|
+
"code": "\"use client\";\n\nimport { StatCard, StatGrid } from \"@dodopayments/ui/stat-card\";\n\n/** The page summary under a page header: one card, three stats side by side. */\nexport default function StatCardGrouped() {\n return (\n <StatGrid layout=\"group\" heading=\"Last 30 days\" className=\"w-full\">\n <StatCard label=\"Successful payments\" value=\"2.2K\" />\n <StatCard label=\"Payment volume\" value=\"$8.4M\" />\n <StatCard label=\"Failed payments\" value=\"154\" />\n </StatGrid>\n );\n}"
|
|
28933
|
+
},
|
|
27933
28934
|
{
|
|
27934
28935
|
"name": "stat-card/master",
|
|
27935
28936
|
"code": "\"use client\";\n\nimport { Progress } from \"@dodopayments/ui/progress\";\nimport {\n StatCard,\n StatCardBreakdown,\n StatCardBreakdownRow,\n StatGrid,\n} from \"@dodopayments/ui/stat-card\";\n\nexport default function StatCardMaster() {\n return (\n <StatGrid columns=\"2\">\n {/* Compact: the label, the value, a trend Badge and its comparison. */}\n <StatCard\n label=\"Successful payments\"\n help=\"Payments that succeeded in this period, after retries.\"\n value=\"1,240\"\n trend={{ value: \"12.4%\", direction: \"up\" }}\n comparison=\"vs last 30 days\"\n />\n {/* Breakdown: the parts of the number under it. */}\n <StatCard label=\"Payout balance\" value=\"$3,300.00\" comparison=\"Next payout on Oct 21\">\n <StatCardBreakdown>\n <Progress\n segments={[\n { label: \"Incoming\", value: 3000, color: \"brand\" },\n { label: \"Available\", value: 100, color: \"tertiary\" },\n { label: \"Reserved\", value: 200, color: \"data\" },\n ]}\n />\n <StatCardBreakdownRow label=\"Incoming\" value=\"$3,000.00\" />\n <StatCardBreakdownRow label=\"Available\" value=\"$100.00\" />\n <StatCardBreakdownRow label=\"Reserved\" value=\"$200.00\" />\n </StatCardBreakdown>\n </StatCard>\n </StatGrid>\n );\n}"
|
|
@@ -29302,7 +30303,7 @@
|
|
|
29302
30303
|
"props": [
|
|
29303
30304
|
{
|
|
29304
30305
|
"name": "brand",
|
|
29305
|
-
"type": "\"meta\" | \"github\" | \"gitlab\" | \"terraform\" | \"vercel\" | \"google-cloud\" | \"aws\" | \"kubernetes\" | \"google-analytics\" | \"google-tag-manager\" | \"stripe\" | \"adyen\" | \"dodo-payments\"",
|
|
30306
|
+
"type": "\"meta\" | \"github\" | \"gitlab\" | \"terraform\" | \"vercel\" | \"google-cloud\" | \"aws\" | \"kubernetes\" | \"google-analytics\" | \"google-tag-manager\" | \"stripe\" | \"adyen\" | \"dodo-payments\" | \"discord\" | \"telegram\" | \"notion\" | \"framer\" | \"figma\"",
|
|
29306
30307
|
"required": true,
|
|
29307
30308
|
"description": "Which brand's mark to draw.",
|
|
29308
30309
|
"source": "dodo"
|
|
@@ -29354,7 +30355,7 @@
|
|
|
29354
30355
|
"props": [
|
|
29355
30356
|
{
|
|
29356
30357
|
"name": "brand",
|
|
29357
|
-
"type": "\"card\" | \"visa\" | \"mastercard\" | \"amex\" | \"discover\" | \"diners\" | \"jcb\" | \"unionpay\" | \"maestro\" | \"rupay\" | \"cartes-bancaires\" | \"apple-pay\" | \"gpay\" | \"amazon-pay\" | \"cash-app\" | \"paypal\" | \"revolut-pay\" | \"satispay\" | \"wechat-pay\" | \"alipay-hk\" | \"kakao-pay\" | \"naver-pay\" | \"payco\" | \"gcash\" | \"touch-n-go\" | \"twint\" | \"bizum\" | \"upi\" | \"ideal\" | \"bancontact\" | \"eps\" | \"multibanco\" | \"pix\" | \"blik\" | \"przelewy24\" | \"fps\" | \"ach\" | \"sepa\" | \"bacs\" | \"klarna\" | \"afterpay\" | \"affirm\" | \"zip\" | \"billie\" | \"stablecoins\" | \"unknown\"",
|
|
30358
|
+
"type": "\"link\" | \"card\" | \"visa\" | \"mastercard\" | \"amex\" | \"discover\" | \"diners\" | \"jcb\" | \"unionpay\" | \"maestro\" | \"rupay\" | \"cartes-bancaires\" | \"apple-pay\" | \"gpay\" | \"amazon-pay\" | \"cash-app\" | \"paypal\" | \"revolut-pay\" | \"satispay\" | \"wechat-pay\" | \"alipay-hk\" | \"kakao-pay\" | \"naver-pay\" | \"payco\" | \"gcash\" | \"touch-n-go\" | \"twint\" | \"bizum\" | \"upi\" | \"ideal\" | \"bancontact\" | \"eps\" | \"multibanco\" | \"pix\" | \"blik\" | \"przelewy24\" | \"fps\" | \"ach\" | \"sepa\" | \"bacs\" | \"klarna\" | \"afterpay\" | \"affirm\" | \"zip\" | \"billie\" | \"stablecoins\" | \"unknown\"",
|
|
29358
30359
|
"required": true,
|
|
29359
30360
|
"description": "The payment method. `unknown` draws a credit card icon for methods without artwork.",
|
|
29360
30361
|
"source": "dodo"
|
|
@@ -29591,7 +30592,7 @@
|
|
|
29591
30592
|
"examples": [
|
|
29592
30593
|
{
|
|
29593
30594
|
"name": "checkout-page/basic",
|
|
29594
|
-
"code": "\"use client\";\n\nimport { Avatar, AvatarFallback, AvatarImage } from \"@dodopayments/ui/avatar\";\nimport { Badge } from \"@dodopayments/ui/badge\";\nimport { Button } from \"@dodopayments/ui/button\";\nimport { CardField } from \"@dodopayments/ui/card-field\";\nimport { Checkbox } from \"@dodopayments/ui/checkbox\";\nimport { CheckoutPage } from \"@dodopayments/ui/checkout-page\";\nimport { Field } from \"@dodopayments/ui/field\";\nimport { Input } from \"@dodopayments/ui/input\";\nimport { OrderSummary } from \"@dodopayments/ui/order-summary\";\nimport { WalletButtons } from \"@dodopayments/ui/wallet-buttons\";\nimport { CircleCheckIcon } from \"@dodopayments/ui/icons\";\nimport { Link } from \"@dodopayments/ui/link\";\n\nconst PRODUCT_IMAGE =\n \"https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?auto=format&fit=crop&w=160&h=160&q=80\";\nconst LOGO =\n \"https://images.unsplash.com/photo-1558591710-4b4a1ae0f04d?auto=format&fit=crop&w=64&h=64&q=80\";\n\n/** The trust footer under the payment column: secure note, merchant of record and the policy links. */\nfunction CheckoutFooter({ links }: { links: { label: string; href: string }[] }) {\n return (\n <footer className=\"flex flex-col items-center gap-3 text-center text-body-secondary text-muted-foreground\">\n <p className=\"flex items-center gap-1.5\">\n <CircleCheckIcon aria-hidden=\"true\" className=\"size-4 text-success-foreground\" />\n Payments are secure and encrypted\n </p>\n <p>Dodo Payments is the merchant of record for this order</p>\n <nav aria-label=\"Legal\">\n <ul className=\"flex flex-wrap items-center justify-center gap-x-4 gap-y-1\">\n {links.map((link) => (\n <li key={link.href}>\n <Link href={link.href} className=\"inline-flex min-h-6 items-center\">\n {link.label}\n </Link>\n </li>\n ))}\n </ul>\n </nav>\n </footer>\n );\n}\n\nexport default function CheckoutPageBasic() {\n return (\n <CheckoutPage\n className=\"rounded-xl border border-border\"\n brand={\n <>\n <Avatar size=\"sm\">\n <AvatarImage src={LOGO} alt=\"\" />\n <AvatarFallback name=\"Acme\" />\n </Avatar>\n <span className=\"font-heading
|
|
30595
|
+
"code": "\"use client\";\n\nimport { Avatar, AvatarFallback, AvatarImage } from \"@dodopayments/ui/avatar\";\nimport { Badge } from \"@dodopayments/ui/badge\";\nimport { Button } from \"@dodopayments/ui/button\";\nimport { CardField } from \"@dodopayments/ui/card-field\";\nimport { Checkbox } from \"@dodopayments/ui/checkbox\";\nimport { CheckoutPage } from \"@dodopayments/ui/checkout-page\";\nimport { Field } from \"@dodopayments/ui/field\";\nimport { Input } from \"@dodopayments/ui/input\";\nimport { OrderSummary } from \"@dodopayments/ui/order-summary\";\nimport { WalletButtons } from \"@dodopayments/ui/wallet-buttons\";\nimport { CircleCheckIcon } from \"@dodopayments/ui/icons\";\nimport { Link } from \"@dodopayments/ui/link\";\n\nconst PRODUCT_IMAGE =\n \"https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?auto=format&fit=crop&w=160&h=160&q=80\";\nconst LOGO =\n \"https://images.unsplash.com/photo-1558591710-4b4a1ae0f04d?auto=format&fit=crop&w=64&h=64&q=80\";\n\n/** The trust footer under the payment column: secure note, merchant of record and the policy links. */\nfunction CheckoutFooter({ links }: { links: { label: string; href: string }[] }) {\n return (\n <footer className=\"flex flex-col items-center gap-3 text-center text-body-secondary text-muted-foreground\">\n <p className=\"flex items-center gap-1.5\">\n <CircleCheckIcon aria-hidden=\"true\" className=\"size-4 text-success-foreground\" />\n Payments are secure and encrypted\n </p>\n <p>Dodo Payments is the merchant of record for this order</p>\n <nav aria-label=\"Legal\">\n <ul className=\"flex flex-wrap items-center justify-center gap-x-4 gap-y-1\">\n {links.map((link) => (\n <li key={link.href}>\n <Link href={link.href} className=\"inline-flex min-h-6 items-center\">\n {link.label}\n </Link>\n </li>\n ))}\n </ul>\n </nav>\n </footer>\n );\n}\n\nexport default function CheckoutPageBasic() {\n return (\n <CheckoutPage\n className=\"rounded-xl border border-border\"\n brand={\n <>\n <Avatar size=\"sm\">\n <AvatarImage src={LOGO} alt=\"\" />\n <AvatarFallback name=\"Acme\" />\n </Avatar>\n <span className=\"font-heading text-heading-quaternary text-foreground\">Acme</span>\n </>\n }\n summary={\n <OrderSummary\n collapsible\n aria-label=\"Order summary\"\n items={[\n {\n id: \"pro\",\n name: \"Acme Pro\",\n description: \"Unlimited projects, custom domains and priority support.\",\n image: PRODUCT_IMAGE,\n price: \"$49.00\",\n interval: \"/ month\",\n },\n ]}\n discount={\n <Field label=\"Promo code\">\n <div className=\"flex gap-2\">\n <Input autoComplete=\"off\" autoCapitalize=\"characters\" spellCheck={false} />\n <Button type=\"button\" variant=\"secondary\" size=\"lg\">\n Apply\n </Button>\n </div>\n </Field>\n }\n lines={[\n { id: \"subtotal\", label: \"Subtotal\", value: \"$49.00\" },\n { id: \"tax\", label: \"Sales tax\", value: \"$4.41\" },\n { id: \"total\", label: \"Total due today\", value: \"$53.41\", emphasis: \"total\" },\n ]}\n />\n }\n footer={\n <CheckoutFooter\n links={[\n { label: \"Terms\", href: \"#terms\" },\n { label: \"Privacy\", href: \"#privacy\" },\n ]}\n />\n }\n >\n <Badge variant=\"orange\" dot className=\"self-start\">\n Test mode\n </Badge>\n <WalletButtons available={[\"apple-pay\", \"gpay\"]} onSelect={() => undefined} />\n <CardField />\n <fieldset className=\"flex min-w-0 flex-col gap-3\">\n <legend className=\"sr-only\">Agreements</legend>\n <Checkbox label=\"I agree to the terms of service and privacy policy\" required />\n <Checkbox label=\"I authorise recurring charges of $53.41 / month until I cancel\" required />\n </fieldset>\n <Button size=\"lg\" className=\"w-full\">\n Pay now\n </Button>\n </CheckoutPage>\n );\n}"
|
|
29595
30596
|
},
|
|
29596
30597
|
{
|
|
29597
30598
|
"name": "checkout-page/upi",
|