@deriv-com/dds-marketing 1.0.2 → 1.1.1
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/.llm/components/awards.md +209 -0
- package/.llm/components/background.md +89 -40
- package/.llm/components/bottomsheet.md +5 -0
- package/.llm/components/comparisoncards.md +257 -0
- package/.llm/components/comparisontable.md +231 -0
- package/.llm/components/ctabanner.md +9 -12
- package/.llm/components/ctabannerslider.md +15 -2
- package/.llm/components/datatable.md +273 -0
- package/.llm/components/downloadbanner.md +283 -0
- package/.llm/components/featurecards.md +41 -3
- package/.llm/components/featurecardscarousel.md +311 -0
- package/.llm/components/featuresplit.md +5 -0
- package/.llm/components/featurestack.md +227 -0
- package/.llm/components/illustrationcard.md +2 -2
- package/.llm/components/illustrationscene.md +6 -10
- package/.llm/components/imagebanner.md +278 -0
- package/.llm/components/navbar.md +1 -1
- package/.llm/components/navbaritem.md +4 -0
- package/.llm/components/pageheader.md +4 -3
- package/.llm/components/paginationdots.md +6 -1
- package/.llm/components/producthero.md +35 -11
- package/.llm/components/resourcebanner.md +247 -0
- package/.llm/components/scenescroll.md +222 -0
- package/.llm/components/select.md +17 -0
- package/.llm/components/stats.md +219 -0
- package/.llm/components/steps.md +286 -0
- package/.llm/components/stickycards.md +251 -0
- package/.llm/components/tableheadercell.md +19 -0
- package/.llm/components/teamgrid.md +243 -0
- package/.llm/components/testimonialrow.md +5 -0
- package/.llm/components/testimonialslider.md +14 -1
- package/.llm/components/textarea.md +13 -0
- package/.llm/components/textinput.md +13 -0
- package/.llm/components/textscroll.md +187 -0
- package/.llm/components/tiers.md +227 -0
- package/.llm/digest/awards.md +45 -0
- package/.llm/digest/background.md +11 -10
- package/.llm/digest/bottomsheet.md +2 -0
- package/.llm/digest/comparisoncards.md +51 -0
- package/.llm/digest/comparisontable.md +53 -0
- package/.llm/digest/ctabanner.md +4 -4
- package/.llm/digest/ctabannerslider.md +4 -0
- package/.llm/digest/datatable.md +65 -0
- package/.llm/digest/downloadbanner.md +65 -0
- package/.llm/digest/featurecards.md +1 -1
- package/.llm/digest/featurecardscarousel.md +54 -0
- package/.llm/digest/featuresplit.md +1 -0
- package/.llm/digest/featurestack.md +48 -0
- package/.llm/digest/illustrationscene.md +2 -3
- package/.llm/digest/imagebanner.md +64 -0
- package/.llm/digest/navbaritem.md +1 -0
- package/.llm/digest/pageheader.md +2 -1
- package/.llm/digest/paginationdots.md +3 -1
- package/.llm/digest/producthero.md +4 -2
- package/.llm/digest/resourcebanner.md +53 -0
- package/.llm/digest/scenescroll.md +49 -0
- package/.llm/digest/select.md +5 -0
- package/.llm/digest/stats.md +46 -0
- package/.llm/digest/steps.md +55 -0
- package/.llm/digest/stickycards.md +52 -0
- package/.llm/digest/tableheadercell.md +4 -0
- package/.llm/digest/teamgrid.md +53 -0
- package/.llm/digest/testimonialrow.md +2 -0
- package/.llm/digest/testimonialslider.md +4 -0
- package/.llm/digest/textarea.md +4 -0
- package/.llm/digest/textinput.md +4 -0
- package/.llm/digest/textscroll.md +43 -0
- package/.llm/digest/tiers.md +50 -0
- package/.llm/index.md +19 -3
- package/.llm/tokens.md +26 -1
- package/AGENTS.md +17 -1
- package/dist/components/awards-data.d.ts +24 -0
- package/dist/components/awards-data.js +11 -0
- package/dist/components/block-image-data.d.ts +24 -0
- package/dist/components/block-image-data.js +9 -0
- package/dist/components/blocks/awards/Awards.css +134 -0
- package/dist/components/blocks/awards/Awards.d.ts +24 -0
- package/dist/components/blocks/awards/Awards.js +114 -0
- package/dist/components/blocks/awards/Awards.types.d.ts +31 -0
- package/dist/components/blocks/awards/Awards.types.js +16 -0
- package/dist/components/blocks/awards/awards-impl.css +222 -0
- package/dist/components/blocks/cards-of.d.ts +16 -0
- package/dist/components/blocks/cards-of.js +23 -0
- package/dist/components/blocks/comparison-cards/ComparisonCards.css +195 -0
- package/dist/components/blocks/comparison-cards/ComparisonCards.d.ts +24 -0
- package/dist/components/blocks/comparison-cards/ComparisonCards.js +75 -0
- package/dist/components/blocks/comparison-cards/ComparisonCards.types.d.ts +49 -0
- package/dist/components/blocks/comparison-cards/ComparisonCards.types.js +26 -0
- package/dist/components/blocks/comparison-cards/comparison-cards-impl.css +262 -0
- package/dist/components/blocks/comparison-table/ComparisonTable.css +111 -0
- package/dist/components/blocks/comparison-table/ComparisonTable.d.ts +25 -0
- package/dist/components/blocks/comparison-table/ComparisonTable.js +100 -0
- package/dist/components/blocks/comparison-table/ComparisonTable.types.d.ts +36 -0
- package/dist/components/blocks/comparison-table/ComparisonTable.types.js +15 -0
- package/dist/components/blocks/comparison-table/comparison-table-impl.css +143 -0
- package/dist/components/blocks/cta-banner/CtaBanner.css +1 -0
- package/dist/components/blocks/cta-banner/CtaBanner.js +2 -2
- package/dist/components/blocks/cta-banner/CtaBanner.types.d.ts +4 -3
- package/dist/components/blocks/cta-banner/CtaBanner.types.js +1 -1
- package/dist/components/blocks/cta-banner-slider/CtaBannerSlider.css +1 -0
- package/dist/components/blocks/cta-banner-slider/CtaBannerSlider.d.ts +1 -1
- package/dist/components/blocks/cta-banner-slider/CtaBannerSlider.js +6 -2
- package/dist/components/blocks/cta-banner-slider/CtaBannerSlider.types.d.ts +8 -0
- package/dist/components/blocks/cta-banner-slider/CtaBannerSlider.types.js +1 -1
- package/dist/components/blocks/data-table/DataTable.css +170 -0
- package/dist/components/blocks/data-table/DataTable.d.ts +29 -0
- package/dist/components/blocks/data-table/DataTable.js +84 -0
- package/dist/components/blocks/data-table/DataTable.types.d.ts +69 -0
- package/dist/components/blocks/data-table/DataTable.types.js +19 -0
- package/dist/components/blocks/data-table/data-table-impl.css +155 -0
- package/dist/components/blocks/download-banner/DownloadBanner.css +228 -0
- package/dist/components/blocks/download-banner/DownloadBanner.d.ts +28 -0
- package/dist/components/blocks/download-banner/DownloadBanner.js +75 -0
- package/dist/components/blocks/download-banner/DownloadBanner.types.d.ts +56 -0
- package/dist/components/blocks/download-banner/DownloadBanner.types.js +23 -0
- package/dist/components/blocks/download-banner/download-banner-impl.css +216 -0
- package/dist/components/blocks/faq-accordion/FaqAccordion.css +1 -0
- package/dist/components/blocks/faq-accordion/faq-accordion-impl.css +3 -7
- package/dist/components/blocks/feature-bullets/FeatureBullets.css +1 -0
- package/dist/components/blocks/feature-bullets/feature-bullets-impl.css +14 -1
- package/dist/components/blocks/feature-cards/FeatureCards.css +1 -0
- package/dist/components/blocks/feature-cards/FeatureCards.d.ts +2 -1
- package/dist/components/blocks/feature-cards/FeatureCards.js +4 -21
- package/dist/components/blocks/feature-cards/feature-cards-impl.css +10 -9
- package/dist/components/blocks/feature-cards-carousel/FeatureCardsCarousel.css +115 -0
- package/dist/components/blocks/feature-cards-carousel/FeatureCardsCarousel.d.ts +30 -0
- package/dist/components/blocks/feature-cards-carousel/FeatureCardsCarousel.js +160 -0
- package/dist/components/blocks/feature-cards-carousel/FeatureCardsCarousel.types.d.ts +52 -0
- package/dist/components/blocks/feature-cards-carousel/FeatureCardsCarousel.types.js +17 -0
- package/dist/components/blocks/feature-cards-carousel/feature-cards-carousel-impl.css +207 -0
- package/dist/components/blocks/feature-scroll/FeatureScroll.css +1 -0
- package/dist/components/blocks/feature-split/FeatureSplit.css +1 -0
- package/dist/components/blocks/feature-split/feature-split-impl.css +14 -1
- package/dist/components/blocks/feature-stack/FeatureStack.css +86 -0
- package/dist/components/blocks/feature-stack/FeatureStack.d.ts +19 -0
- package/dist/components/blocks/feature-stack/FeatureStack.js +27 -0
- package/dist/components/blocks/feature-stack/FeatureStack.types.d.ts +34 -0
- package/dist/components/blocks/feature-stack/FeatureStack.types.js +14 -0
- package/dist/components/blocks/feature-stack/feature-stack-impl.css +87 -0
- package/dist/components/blocks/image-banner/ImageBanner.css +133 -0
- package/dist/components/blocks/image-banner/ImageBanner.d.ts +32 -0
- package/dist/components/blocks/image-banner/ImageBanner.js +41 -0
- package/dist/components/blocks/image-banner/ImageBanner.types.d.ts +54 -0
- package/dist/components/blocks/image-banner/ImageBanner.types.js +14 -0
- package/dist/components/blocks/image-banner/image-banner-impl.css +281 -0
- package/dist/components/blocks/landing-hero/LandingHero.css +1 -0
- package/dist/components/blocks/logo-columns/LogoColumns.css +1 -0
- package/dist/components/blocks/logo-rows/LogoRows.css +1 -0
- package/dist/components/blocks/page-header/PageHeader.css +1 -0
- package/dist/components/blocks/page-header/PageHeader.js +2 -2
- package/dist/components/blocks/page-header/PageHeader.types.d.ts +4 -2
- package/dist/components/blocks/page-header/PageHeader.types.js +1 -1
- package/dist/components/blocks/page-header/page-header-impl.css +5 -3
- package/dist/components/blocks/product-hero/ProductHero.css +8 -3
- package/dist/components/blocks/product-hero/ProductHero.d.ts +1 -1
- package/dist/components/blocks/product-hero/ProductHero.js +5 -2
- package/dist/components/blocks/product-hero/ProductHero.types.d.ts +5 -1
- package/dist/components/blocks/product-hero/ProductHero.types.js +1 -0
- package/dist/components/blocks/product-hero/product-hero-impl.css +43 -12
- package/dist/components/blocks/resource-banner/ResourceBanner.css +106 -0
- package/dist/components/blocks/resource-banner/ResourceBanner.d.ts +32 -0
- package/dist/components/blocks/resource-banner/ResourceBanner.js +51 -0
- package/dist/components/blocks/resource-banner/ResourceBanner.types.d.ts +44 -0
- package/dist/components/blocks/resource-banner/ResourceBanner.types.js +14 -0
- package/dist/components/blocks/resource-banner/resource-banner-impl.css +69 -0
- package/dist/components/blocks/scene-scroll/SceneScroll.css +93 -0
- package/dist/components/blocks/scene-scroll/SceneScroll.d.ts +36 -0
- package/dist/components/blocks/scene-scroll/SceneScroll.js +54 -0
- package/dist/components/blocks/scene-scroll/SceneScroll.types.d.ts +32 -0
- package/dist/components/blocks/scene-scroll/SceneScroll.types.js +15 -0
- package/dist/components/blocks/scene-scroll/scene-scroll-impl.css +275 -0
- package/dist/components/blocks/stats/Stats.css +139 -0
- package/dist/components/blocks/stats/Stats.d.ts +24 -0
- package/dist/components/blocks/stats/Stats.js +120 -0
- package/dist/components/blocks/stats/Stats.types.d.ts +36 -0
- package/dist/components/blocks/stats/Stats.types.js +19 -0
- package/dist/components/blocks/stats/stats-count.d.ts +34 -0
- package/dist/components/blocks/stats/stats-count.js +61 -0
- package/dist/components/blocks/stats/stats-impl.css +284 -0
- package/dist/components/blocks/stats/use-wheel.d.ts +37 -0
- package/dist/components/blocks/stats/use-wheel.js +126 -0
- package/dist/components/blocks/steps/Steps.css +202 -0
- package/dist/components/blocks/steps/Steps.d.ts +32 -0
- package/dist/components/blocks/steps/Steps.js +65 -0
- package/dist/components/blocks/steps/Steps.types.d.ts +48 -0
- package/dist/components/blocks/steps/Steps.types.js +21 -0
- package/dist/components/blocks/steps/steps-impl.css +216 -0
- package/dist/components/blocks/steps/use-turn.d.ts +33 -0
- package/dist/components/blocks/steps/use-turn.js +75 -0
- package/dist/components/blocks/sticky-cards/StickyCards.css +154 -0
- package/dist/components/blocks/sticky-cards/StickyCards.d.ts +35 -0
- package/dist/components/blocks/sticky-cards/StickyCards.js +153 -0
- package/dist/components/blocks/sticky-cards/StickyCards.types.d.ts +43 -0
- package/dist/components/blocks/sticky-cards/StickyCards.types.js +18 -0
- package/dist/components/blocks/sticky-cards/sticky-cards-impl.css +393 -0
- package/dist/components/blocks/team-grid/TeamGrid.css +159 -0
- package/dist/components/blocks/team-grid/TeamGrid.d.ts +28 -0
- package/dist/components/blocks/team-grid/TeamGrid.js +74 -0
- package/dist/components/blocks/team-grid/TeamGrid.types.d.ts +51 -0
- package/dist/components/blocks/team-grid/TeamGrid.types.js +20 -0
- package/dist/components/blocks/team-grid/team-grid-impl.css +129 -0
- package/dist/components/blocks/testimonial-row/TestimonialRow.css +1 -0
- package/dist/components/blocks/testimonial-row/TestimonialRow.d.ts +1 -1
- package/dist/components/blocks/testimonial-row/TestimonialRow.js +4 -3
- package/dist/components/blocks/testimonial-row/TestimonialRow.types.d.ts +3 -0
- package/dist/components/blocks/testimonial-row/TestimonialRow.types.js +1 -1
- package/dist/components/blocks/testimonial-row/testimonial-row-impl.css +8 -0
- package/dist/components/blocks/testimonial-slider/TestimonialSlider.css +1 -0
- package/dist/components/blocks/testimonial-slider/TestimonialSlider.d.ts +1 -1
- package/dist/components/blocks/testimonial-slider/TestimonialSlider.js +2 -2
- package/dist/components/blocks/testimonial-slider/TestimonialSlider.types.d.ts +8 -0
- package/dist/components/blocks/testimonial-slider/TestimonialSlider.types.js +1 -1
- package/dist/components/blocks/text-scroll/TextScroll.css +53 -0
- package/dist/components/blocks/text-scroll/TextScroll.d.ts +5 -0
- package/dist/components/blocks/text-scroll/TextScroll.js +71 -0
- package/dist/components/blocks/text-scroll/TextScroll.types.d.ts +22 -0
- package/dist/components/blocks/text-scroll/TextScroll.types.js +10 -0
- package/dist/components/blocks/text-scroll/text-scroll-impl.css +115 -0
- package/dist/components/blocks/tiers/Tiers.css +233 -0
- package/dist/components/blocks/tiers/Tiers.d.ts +32 -0
- package/dist/components/blocks/tiers/Tiers.js +68 -0
- package/dist/components/blocks/tiers/Tiers.types.d.ts +45 -0
- package/dist/components/blocks/tiers/Tiers.types.js +25 -0
- package/dist/components/blocks/tiers/tiers-impl.css +185 -0
- package/dist/components/blocks/use-rotation.d.ts +12 -2
- package/dist/components/blocks/use-rotation.js +6 -28
- package/dist/components/comparison-cards-data.d.ts +59 -0
- package/dist/components/comparison-cards-data.js +12 -0
- package/dist/components/comparison-table-data.d.ts +39 -0
- package/dist/components/comparison-table-data.js +11 -0
- package/dist/components/core/accordion-item/AccordionItem.css +1 -5
- package/dist/components/core/background/Background.css +23 -0
- package/dist/components/core/background/Background.d.ts +10 -4
- package/dist/components/core/background/Background.js +16 -7
- package/dist/components/core/background/Background.types.d.ts +11 -8
- package/dist/components/core/background/Background.types.js +3 -1
- package/dist/components/core/background/background-impl.css +334 -1
- package/dist/components/core/background/halftone.d.ts +11 -0
- package/dist/components/core/background/halftone.js +43 -3
- package/dist/components/core/background/patterns.d.ts +66 -0
- package/dist/components/core/background/patterns.js +244 -0
- package/dist/components/core/background/shader.d.ts +44 -0
- package/dist/components/core/background/shader.js +307 -0
- package/dist/components/core/background/use-shader.d.ts +11 -0
- package/dist/components/core/background/use-shader.js +25 -0
- package/dist/components/core/background/use-spotlight.d.ts +2 -1
- package/dist/components/core/background/use-spotlight.js +9 -1
- package/dist/components/core/bottom-sheet/BottomSheet.js +2 -2
- package/dist/components/core/bottom-sheet/BottomSheet.types.d.ts +3 -1
- package/dist/components/core/breadcrumb/Breadcrumb.d.ts +1 -0
- package/dist/components/core/breadcrumb/Breadcrumb.js +1 -0
- package/dist/components/core/breadcrumb/breadcrumb-impl.css +11 -0
- package/dist/components/core/button/button-impl.css +14 -1
- package/dist/components/core/illustration-card/IllustrationCard.js +1 -1
- package/dist/components/core/illustration-card/illustration-card-impl.css +20 -0
- package/dist/components/core/illustration-scene/IllustrationScene.css +4 -7
- package/dist/components/core/illustration-scene/IllustrationScene.types.d.ts +2 -3
- package/dist/components/core/illustration-scene/illustration-scene-impl.css +22 -1
- package/dist/components/core/link/Link.js +7 -3
- package/dist/components/core/link/link-impl.css +29 -2
- package/dist/components/core/navbar/Navbar.css +2 -2
- package/dist/components/core/navbar/Navbar.types.d.ts +1 -1
- package/dist/components/core/navbar-item/NavbarItem.d.ts +2 -1
- package/dist/components/core/navbar-item/NavbarItem.js +3 -10
- package/dist/components/core/navbar-item/NavbarItem.types.d.ts +4 -1
- package/dist/components/core/navbar-item/NavbarItem.types.js +1 -1
- package/dist/components/core/navbar-item/navbar-item-impl.css +10 -0
- package/dist/components/core/navbar-menu/navbar-menu-impl.css +9 -0
- package/dist/components/core/navbar-switcher/navbar-switcher-impl.css +19 -0
- package/dist/components/core/pagination/Pagination.js +1 -1
- package/dist/components/core/pagination/pagination-impl.css +9 -0
- package/dist/components/core/pagination-dots/PaginationDots.d.ts +1 -1
- package/dist/components/core/pagination-dots/PaginationDots.js +3 -3
- package/dist/components/core/pagination-dots/PaginationDots.types.d.ts +3 -1
- package/dist/components/core/segmented-control/SegmentedControl.css +4 -3
- package/dist/components/core/segmented-control/SegmentedControl.js +17 -3
- package/dist/components/core/segmented-control-item/SegmentedControlItem.css +2 -1
- package/dist/components/core/select/Select.js +3 -3
- package/dist/components/core/select/Select.types.d.ts +11 -1
- package/dist/components/core/select/Select.types.js +1 -1
- package/dist/components/core/tab-list/TabList.js +9 -1
- package/dist/components/core/table-header-cell/TableHeaderCell.d.ts +1 -1
- package/dist/components/core/table-header-cell/TableHeaderCell.js +5 -2
- package/dist/components/core/table-header-cell/TableHeaderCell.types.d.ts +7 -1
- package/dist/components/core/table-header-cell/TableHeaderCell.types.js +1 -1
- package/dist/components/core/text-area/TextArea.d.ts +1 -1
- package/dist/components/core/text-area/TextArea.js +2 -2
- package/dist/components/core/text-area/TextArea.types.d.ts +9 -1
- package/dist/components/core/text-area/TextArea.types.js +1 -1
- package/dist/components/core/text-input/TextInput.d.ts +1 -1
- package/dist/components/core/text-input/TextInput.js +2 -2
- package/dist/components/core/text-input/TextInput.types.d.ts +9 -1
- package/dist/components/core/text-input/TextInput.types.js +1 -1
- package/dist/components/data-table-data.d.ts +33 -0
- package/dist/components/data-table-data.js +12 -0
- package/dist/components/download-banner-data.d.ts +52 -0
- package/dist/components/download-banner-data.js +11 -0
- package/dist/components/index.d.ts +45 -0
- package/dist/components/index.js +32 -0
- package/dist/components/resource-banner-data.d.ts +34 -0
- package/dist/components/resource-banner-data.js +13 -0
- package/dist/components/scene-scroll-data.d.ts +24 -0
- package/dist/components/scene-scroll-data.js +9 -0
- package/dist/components/stats-data.d.ts +28 -0
- package/dist/components/stats-data.js +11 -0
- package/dist/components/steps-data.d.ts +38 -0
- package/dist/components/steps-data.js +13 -0
- package/dist/components/sticky-cards-data.d.ts +43 -0
- package/dist/components/sticky-cards-data.js +12 -0
- package/dist/components/team-grid-data.d.ts +38 -0
- package/dist/components/team-grid-data.js +11 -0
- package/dist/components/tiers-data.d.ts +47 -0
- package/dist/components/tiers-data.js +13 -0
- package/dist/marketing.css +77 -28
- package/package.json +1 -1
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
<!-- GENERATED from comparison-cards.contract.json. Do not edit. -->
|
|
2
|
+
|
|
3
|
+
# ComparisonCards
|
|
4
|
+
|
|
5
|
+
A section that sets two to four options side by side under a heading, each a card of its own that repeats the same short rows — a label and this option's value — so a reader compares the options line by line: Spot against Futures, one account type against another. Each card is the page's own Card — every option the same colour, so they read as equals — holding a name, a sentence, a list of rows and, where one belongs to it, a footnote and a way on.
|
|
6
|
+
|
|
7
|
+
The reference design's ComparisonCards. The rows line up across the cards — a card's first row level with its neighbour's first row, however long the sentence above either one runs — and every card in the row is as tall as the tallest. One column on a phone; two cards side by side from the fold; three side by side at full width, and stacked until there is room for all three, because a third card under a pair is compared with nothing beside it.
|
|
8
|
+
|
|
9
|
+
## Use when
|
|
10
|
+
|
|
11
|
+
- Two or three products, accounts or plans that answer the same few questions differently — what you hold, what it costs, how far you can lose — and the difference is the point of the section
|
|
12
|
+
- A "What you can trade" band: Spot against Futures, Options against Multipliers, each with its own rows and its own risk note
|
|
13
|
+
|
|
14
|
+
## Do not use
|
|
15
|
+
|
|
16
|
+
- Five or more options, or rows that are the same for every option and read down a column → `ComparisonTable`
|
|
17
|
+
- The options are features rather than alternatives — each a heading and a sentence, with nothing to compare row by row → `FeatureCards`
|
|
18
|
+
- One option and the list of what it includes → `FeatureBullets`
|
|
19
|
+
- Live prices, spreads or any figure fetched from a feed. The values are the page's copy and stand still; a value that moves belongs in a component made to show one
|
|
20
|
+
- More than four cards. A fifth is not drawn — five columns of label and value are too narrow to read, and a fifth under four is compared with nothing
|
|
21
|
+
- A disclaimer for the whole set. A footnote belongs to the card it is written on; one true of every option goes in the page's own copy under the section
|
|
22
|
+
|
|
23
|
+
## Anatomy
|
|
24
|
+
|
|
25
|
+
ComparisonCards renders 20 elements. A token binding names the part it applies to.
|
|
26
|
+
|
|
27
|
+
- `root` — `<section>`, class `dds-comparisoncards`. The section. It paints the ground and the ink to go with it — see `ground` — and asks its own width, so the cards fold on the section's measure rather than the window's. A region named by its heading.
|
|
28
|
+
- `inner` — `<div>`, class `dds-comparisoncards__inner`. The measure and the gutter, the same column every band holds its content in, and the step from the heading to the cards: space.heading.content.
|
|
29
|
+
- `header` — `<div>`, class `dds-comparisoncards__header`. The heading and the line under it, FeatureCards' header and its arrangement: ranged to the start on a phone and centred from the fold, the cards being stacked content under it. It sets no gap: the title's own margin is the step, so a header without a line closes up.
|
|
30
|
+
- `title` — `<h2>`, class `dds-comparisoncards__title`. What is being compared. `h2` because a section sits under the page's own heading; each card's name comes below it in the outline.
|
|
31
|
+
- `description` — `<p>`, class `dds-comparisoncards__description`. The line under the heading, at the description measure. Rendered only when `description` is set.
|
|
32
|
+
- `grid` — `<ul>`, class `dds-comparisoncards__grid`. The cards, as a list — a reader hears how many options there are before the first. One column on a phone; two side by side from the fold when there are two, three at full width when there are three, and four as two rows of two from the fold and one row of four at full width. Where they sit side by side the cards share the grid's rows: one row for every card's name and sentence, one for each line of the comparison, and one for the footnotes, so a card's rows sit level with its neighbour's and every card is as tall as the tallest. The space between cards is the page grid's own gutter, space.grid.gutter.
|
|
33
|
+
- `item` — `<li>`, class `dds-comparisoncards__item`. One option's cell, holding the page's own Card — `surface` for the standard set, following the theme; surface-light, the same in either theme, for the highlighted set; and accent, the coral, for the card it recommends. The cell is what arrives, so the card keeps its own transitions. On a painted ground it is also where the card is re-coloured for it: see `ground`.
|
|
34
|
+
- `body` — `<div>`, class `dds-comparisoncards__body`. The card's content, inset from its edge by space.inset.card — the one inset a page does not choose. It sits inside the Card, which pads nothing of its own.
|
|
35
|
+
- `intro` — `<div>`, class `dds-comparisoncards__intro`. The option's name and its sentence, the step under them to the rows being space.gap.md, which the first row's own inset doubles. Side by side the intros share one row of the grid, so the rows under them start level however long either sentence runs.
|
|
36
|
+
- `card-head` — `<div>`, class `dds-comparisoncards__card-head`. The card's name, in a row of its own at the head of the intro. On the recommended card the badge is pinned over its corner rather than set in this row.
|
|
37
|
+
- `card-title` — `<h3>`, class `dds-comparisoncards__card-title`. The option's name, at font.h5 — a card's heading, the size CardBody gives its own. `h3`, under the section's heading.
|
|
38
|
+
- `highlight` — `<div>`, class `dds-comparisoncards__highlight`. The recommended card's badge, where it has one: Marketing's Badge as it comes, pinned to the card's top end corner, space.inset.xs in from the top and the end edge — the reading direction's end, so a mirrored page pins it top left. Out of the card's flow, so it moves no row. Drawn only on the card marked `recommended`, in the highlighted variant, and only when it gives a `badge`. Rendered only when `variant` is set.
|
|
39
|
+
- `card-description` — `<p>`, class `dds-comparisoncards__card-description`. What the option is, in a sentence or two. Drawn only for a card that has one.
|
|
40
|
+
- `rows` — `<dl>`, class `dds-comparisoncards__rows`. The comparison: a description list, so each value is announced as the answer to its label. Labels are written on every card rather than once for the set — each card is read on its own, and a phone stacks them out of sight of each other.
|
|
41
|
+
- `row` — `<div>`, class `dds-comparisoncards__row`. One label and its value on a line, the label at the start and the value at the end, both on one baseline. A row of a list read down a column, so its inset is space.inset.md. A rule under every row but the last, drawn in the card's own ink receded to opacity.track, so it reads on the light card and the coral one alike.
|
|
42
|
+
- `row-label` — `<dt>`, class `dds-comparisoncards__row-label`. What the row compares, in body copy.
|
|
43
|
+
- `row-value` — `<dd>`, class `dds-comparisoncards__row-value`. This option's answer, at the end of the line and a weight up from its label — font.label.md — so the eye running down a card reads the values as the column that matters.
|
|
44
|
+
- `footer` — `<div>`, class `dds-comparisoncards__footer`. The foot of a card: its footnote, then its way on. Drawn only for a card with either. Side by side it sits in the grid's last row, so footnotes start level across the cards and the rows above them stay where they are.
|
|
45
|
+
- `footnote` — `<p>`, class `dds-comparisoncards__footnote`. A disclaimer that belongs to this option alone, at font.body.sm in the card's ink — italic, as the reference sets it, so it reads as a note on the rows rather than another of them.
|
|
46
|
+
- `action` — `<div>`, class `dds-comparisoncards__action`. The way on to the page about this option: a standalone Link in the card's own ink, which serves the light card where the brand's coral would sit too close to the recommended card's; on the recommended card, a solid Button.
|
|
47
|
+
|
|
48
|
+
Apply these classes from the generated `comparisonCardsParts` constant rather than writing the strings by hand.
|
|
49
|
+
|
|
50
|
+
## Composition
|
|
51
|
+
|
|
52
|
+
- Takes no children. Everything it renders comes from props
|
|
53
|
+
- Never contains: `ComparisonCards`, `FeatureCards`, `LandingHero`, `ProductHero`, `PageHeader`, `Footer`, `Navbar` — in children or in any prop that takes a node
|
|
54
|
+
|
|
55
|
+
## Props
|
|
56
|
+
|
|
57
|
+
### ground — `page` | `subtle` | `strong` (default `page`)
|
|
58
|
+
|
|
59
|
+
- `page` — The default, and the page's own white. The standard card is the recessed surface on it, the highlighted set's light card gray.50, so both have an edge
|
|
60
|
+
- `subtle` — The grey band, the reference design's ground for this section. The standard card is raised to color.bg.surface-card-raised on it and the light card turns white, color.bg.surface-card-light-raised, because their own fills are the band's grey. Painted as the band's tint over the page's own ground, so it is the same grey whatever is behind the section
|
|
61
|
+
- `strong` — `color.bg.brand-strong`, the dark band, for a section a reader should arrive at. The heading and the line under it turn white; the standard card turns to Card's inverse surface with white ink, since its own would be dark words on near-black; the light and coral cards keep their own grounds and ink
|
|
62
|
+
|
|
63
|
+
Use when: Which of the page's three grounds this section paints, FeatureCards' axis and its reason: the page builds its rhythm from these, and the ink follows the ground in the same value.
|
|
64
|
+
Never for: Marking importance. Every section on a page painted a ground is a page with no emphasis left. And never the coral `color.bg.brand`, which belongs to the band that asks a reader to act.
|
|
65
|
+
|
|
66
|
+
### variant — `standard` | `highlighted` (default `standard`)
|
|
67
|
+
|
|
68
|
+
- `standard` — The default: options set side by side as equals — every card Card's own `surface`, which follows the theme, the recessed grey on a light page and a dark grey in dark mode, nothing pointing at one of them. A card marked `recommended` is drawn like the rest here.
|
|
69
|
+
- `highlighted` — One option is the one the page recommends: the card marked `recommended` is drawn coral and lifted off the page, every other card on the light card, gray.50 in both themes, quiet beside it. Where the recommended card has a `badge`, its word stands on a badge pinned to the card's top end corner; where it has an `action`, the action is a solid button. For account and plan comparisons where the page has a recommendation and says so. A known exception: white running copy on the coral is about 3.4:1, under the 4.5:1 body text asks for — the package's ground rule keeps the coral to a headline and an action, and this card carries rows. Recorded rather than recoloured, as CtaBanner's band is; where the copy is long or the contrast matters, use the standard variant.
|
|
70
|
+
|
|
71
|
+
Use when: Whether the set is compared as equals or with one option recommended.
|
|
72
|
+
Never for: Recommending more than one option. The first card marked `recommended` is the one; a recommendation made twice is no recommendation.
|
|
73
|
+
|
|
74
|
+
### title — `string` **Required.**
|
|
75
|
+
|
|
76
|
+
Use when: Always. What is being compared, in the fewest words that name it — "What you can trade", "Choose your account".
|
|
77
|
+
Never for: A sentence, or the verdict. The line under it is for the sentence, and the cards make the case.
|
|
78
|
+
|
|
79
|
+
### description — `string`
|
|
80
|
+
|
|
81
|
+
Use when: A line saying what the options have in common, or what the reader is choosing between, when the title alone does not.
|
|
82
|
+
Never for: A disclaimer. A note that belongs to one option is that card's footnote; one that is true of all of them is the page's copy, not the heading's.
|
|
83
|
+
|
|
84
|
+
### cards — `data` `ComparisonCardsCard[]` **Required.**
|
|
85
|
+
|
|
86
|
+
Use when: Always. The options, in reading order — two to four, each with its `title`, a `description`, its `rows` and, where it has them, a `footnote` and an `action`. Every card is drawn the same card. Keep the same labels in the same order on every card, so each row lines up with its counterpart. Two sit side by side from the fold; three stay stacked until full width; four are two rows of two from the fold and one row of four at full width. Only the first four are drawn, and an empty list draws nothing. With `variant="highlighted"`, the card marked `recommended` is the one drawn coral; give it a `badge` — "Most popular", "Recommended" — only where the page wants to say why.
|
|
87
|
+
Never for: One option on its own — there is nothing for it to be compared with — or values the page cannot stand behind on the day it is read.
|
|
88
|
+
|
|
89
|
+
## Accessibility
|
|
90
|
+
|
|
91
|
+
Guaranteed by the component. Write none of it by hand: the ids these attributes point at are generated per instance, so an attribute set from outside either says the same thing twice or points at nothing.
|
|
92
|
+
|
|
93
|
+
- Announced as: `region`
|
|
94
|
+
- `Tab` — Moves through each card's way on, card by card in reading order. The rows hold nothing to press.
|
|
95
|
+
- accessible name from title, so the section is a named region a screen reader can jump to and skip
|
|
96
|
+
- The cards are a list, each card's name a heading under the section's, and each card's rows a description list — so a value is announced with the label it answers.
|
|
97
|
+
- A footnote stays inside the card it belongs to, after that card's rows, so it is read as part of that option and never as the section's.
|
|
98
|
+
|
|
99
|
+
## Rules
|
|
100
|
+
|
|
101
|
+
- **On a phone a section's actions stack and each fills the width, including when there is only one** — On a phone a page's actions stack, and each one fills the width. Not most of it, and not the width its label happens to need — the whole column.
|
|
102
|
+
|
|
103
|
+
Two side by side is what this replaces. On the narrowest screen each gets half a column minus the gap, which is rarely enough for a real label: the words wrap inside the pills, the two buttons come out different heights, and the pair reads as a broken row rather than as a choice. Stacked, each has the whole width and neither has to shorten its words to fit.
|
|
104
|
+
|
|
105
|
+
A single action fills too, and that is the part worth saying, because it is the one that looks unnecessary. A lone button has the room to sit at its natural width and still should not: a full-width control is the phone's convention for the thing the screen is asking you to do, and a pill hugging its label reads as one option among others that are not there. It also makes the target predictable — the whole width, wherever the thumb lands — which a centred pill does not.
|
|
106
|
+
|
|
107
|
+
Filling is the row's job rather than the button's. A button has no width of its own and is not given one; the row it sits in becomes a column and stretches its children, so nothing about the control changes and the same button is full width here and its own size on a desktop.
|
|
108
|
+
|
|
109
|
+
This is the phone's breakpoint, size.breakpoint.md, and not the wider one that decides whether a heading is centred. Those are different questions and they break at different widths: a heading stops being centred when the measure is the screen, while a button stops being full width much sooner than that — stretched across a tablet it is a long way from its own label, and a label centred in a metre of pill is harder to hit than one in a pill the size of the words.
|
|
110
|
+
|
|
111
|
+
What this is not about is every row of controls. A set of filter chips, a pagination strip, a toolbar, a link sitting after a sentence — none of these is the page asking for something, and stacking them to full width would turn a strip the eye skims into a list it has to read. The test is whether the row is the call to action the section was written for.
|
|
112
|
+
Guidance only — cannot be checked automatically.
|
|
113
|
+
- **Never nest one interactive element inside another** — Nested interactive elements produce ambiguous hit targets and an unreachable inner control for keyboard and screen-reader users. This is why the rule cannot live on any single component — it constrains Button, Link, CardButton and TextInput simultaneously.
|
|
114
|
+
Guidance only — cannot be checked automatically.
|
|
115
|
+
- **A section that paints a ground sets the ink to go with it** — A page sits on color.bg.page, and a section that separates itself from it takes one of three grounds. color.bg.subtle is the light one and needs nothing further — the page's own ink still reads on it. The other two are dark and do not: color.bg.brand-strong takes color.fg.on-brand-strong, and color.bg.brand takes color.fg.on-solid. Both are white, and both are written as the role rather than the white they resolve to. Set one of those backgrounds without its ink and the text inherits whatever the page was already using, which is near-black on a dark band — legible to nobody, and invisible to every check here, because each pair passes contrast on its own and nothing can tell whether a section used both.
|
|
116
|
+
|
|
117
|
+
color.bg.brand carries a second limit that is not about forgetting. Its ink measures 3.39:1, which clears the 3:1 a heading needs and misses the 4.5:1 running copy needs. A coral band may carry a headline and a call to action; a paragraph on one is text the reader has to work through at a ratio the waiver on that role does not cover — the waiver says so itself. A section with copy in it takes color.bg.brand-strong, which is near-black and carries white at full contrast.
|
|
118
|
+
|
|
119
|
+
color.bg.strong is not a section ground. It is the inverted fill for an action that has to outrank what surrounds it, and the components that paint it — Button and ButtonIcon in their inverse form — already set both halves in one rule, which is the pattern a hand-painted section has to copy.
|
|
120
|
+
Guidance only — cannot be checked automatically.
|
|
121
|
+
- **Every gap inside a section names the relationship it expresses, and the same relationship keeps its measure when it turns on its side** — A section's spacing is named by the relationship it expresses, not chosen by size. Every gap in a section has a role token, and reaching for a step off the generic scale because it happens to be the right number is how two sections written by two people stop lining up: the numbers agree today and drift the first time one of them is tuned.
|
|
122
|
+
|
|
123
|
+
The heading group is three steps, not one gap. An eyebrow sits nearer its title than the title sits to its description, and the actions sit further from the description than either — space.heading.eyebrow-title, space.heading.title-description, space.heading.description-actions, in that order. A single `gap` on the group cannot say this; it sets all three the same and the block reads as evenly spaced lines rather than as a mark, a name and a paragraph. The eyebrow has to identify itself for this to work, because a group that opens with a title must not give its description the eyebrow's tighter step.
|
|
124
|
+
|
|
125
|
+
The step between a title and its description follows the size of the title, which is why there are two of it. What a reader sees is not the gap but the gap plus the leading above it, and leading scales with the type: under a display title the leading is most of the space, under a card's title it is half as deep. One value for both makes a card look loose at the size that made a section look right. So space.heading.title-description is the display step and space.heading.title-description-compact is the step at a card's size, and the choice is made by how big the title is rather than by what kind of block it sits in.
|
|
126
|
+
|
|
127
|
+
Every one of those steps is smaller than the gap below the group, and that ordering is what holds the group together as one thing. space.heading.content is the step between a heading group and the content it introduces, and it is the widest measure inside a section: the one gap the eye reads as a change of subject rather than as a continuation.
|
|
128
|
+
|
|
129
|
+
That step is the same whether the content is under the heading or beside it. A split is the same relationship turned on its side — a heading group and the content it introduces — so the space between the two halves is space.heading.content, not a gutter. When the split collapses to one column on a phone the gap becomes vertical again, which is where it started, and nothing has to change for that to be right.
|
|
130
|
+
|
|
131
|
+
space.grid.gutter is between two things of the same kind. Two cards in a row are the same kind; the two halves of a split are not, which is why the gutter is the wrong measure there even when the number would have looked acceptable. The gutter runs on both axes, so a grid reads as an even field rather than as rows with a seam down them.
|
|
132
|
+
|
|
133
|
+
space.inset.card is the card's, not the page's. A row of cards padded differently is a row of different cards, and the fill is the only edge they have. A page composing a row does not get to choose it.
|
|
134
|
+
|
|
135
|
+
Column count is not a breakpoint decision. A row holds as many columns as fit before a column would be narrower than size.grid.column-min, and drops one when they would not. Written as a fixed count that collapses at a breakpoint, a four-up row keeps four columns at every width above the phone and sets its copy two or three words to a line through the whole of the tablet range — and on a narrow desktop, which no breakpoint sits on at all. The threshold is a property of the row rather than of a card: a card fills whatever cell it is given.
|
|
136
|
+
|
|
137
|
+
What this does not cover is the space above and below a section, which is space.section.default and space.section.compact, and the page's own side margin, which is space.inset.page. Those are the section's outside; everything here is its inside.
|
|
138
|
+
Guidance only — cannot be checked automatically.
|
|
139
|
+
- **A section's title is centred over stacked content, starts beside content in columns, and starts on a phone** — Two arrangements, and the title's alignment is decided by which one it is introducing rather than chosen per section.
|
|
140
|
+
|
|
141
|
+
Content stacked under the title — a row of cards, an accordion, a set of steps — takes a centred title. The heading group and the block below it share one axis, so a centred title is symmetric with the thing it names, and the eye drops from the middle of the words to the middle of the set. A title starting at the left over a centred or full-width block reads as belonging to the first column rather than to all of them.
|
|
142
|
+
|
|
143
|
+
Content beside the title — a split, a picture in the other half, anything laid out in columns — takes a title that starts where its content starts. The two share a left edge, and that edge is what says they are one thing read across rather than two stacked. Centring the title there breaks the only alignment the reader has to hold the halves together, and it drifts further from its content the wider the page gets.
|
|
144
|
+
|
|
145
|
+
The heading group is what carries this, not the heading alone. An eyebrow, a title and a description are read as one block and align together; aligning the title without them leaves a centred heading over start-aligned copy, which reads as a mistake rather than as a choice.
|
|
146
|
+
|
|
147
|
+
Centred means all of it, not just the words. A badge, a row of actions, a picture — these are flex children, and a flex child is placed by align-items rather than by text-align, so a block that only sets the text leaves everything that is not text at the start. A hero is the case that shows it: its title and copy centred while its badge and its buttons did not.
|
|
148
|
+
|
|
149
|
+
A capped block centres itself as well as its words. A heading group takes size.heading-group.max, and a cap that is not centred leaves the measure at the start of the column with the words centred inside it — composed, and a long way left of the middle it appears to be in.
|
|
150
|
+
|
|
151
|
+
Both arrangements go to the start on a phone. A centred block reverts below the breakpoint, and the reason is the measure: on a phone the measure is the screen, so a centred title wraps to three or four ragged lines and the eye loses the left edge it was tracking — the same symmetry that reads as composure on a desktop is what makes it hard to scan on a phone. Centring there has to be asked for twice, and a section title is not one of the things that asks: it is centred because there is room for it, and on a phone there is not. Going back to the start means all of it too, and a capped block is the one that hides a leftover: its words go to the start while its measure stays in the middle of the column, which reads as a title still centred over a badge and buttons that are not — the box in the middle and the line inside it at the edge.
|
|
152
|
+
|
|
153
|
+
A hero is a section like any other: its badge, title, copy and actions are one stacked block, so it is centred on a desktop and starts on a phone with everything else.
|
|
154
|
+
|
|
155
|
+
What this is not about is a page whose body is a form or a document. A title over a sign-up form or a guide is not introducing a set of content — it is the first line of the thing itself, and it keeps the alignment the body has, which for running text is the start. The distinction is whether the block below is content the title names or content the title is part of.
|
|
156
|
+
Guidance only — cannot be checked automatically.
|
|
157
|
+
- **Anything a pointer has to hit is at least 24px in both directions** — A control sized by its contents is as big as its contents, and a glyph is chosen for how it reads rather than for how easily it is hit. An icon-only button with no padding is a 16px target — smaller than the pad of a finger, and smaller than the tremor of a hand using a mouse.
|
|
158
|
+
|
|
159
|
+
WCAG 2.2 asks for 24 by 24 CSS pixels at AA. The exceptions are narrower than they look: inline targets inside a sentence are exempt, and so is a small target with 24px of clear space around it — but a clear button sits against the field it empties, and a field is itself a target, so the spacing exemption does not apply to the case that keeps arising.
|
|
160
|
+
|
|
161
|
+
The target and the mark are separate decisions, and conflating them is what produces both faults. Growing the glyph to 24px makes it shout; leaving the button at 16px makes it hard to hit. So the glyph keeps the size that reads correctly beside its text, and the box around it declares a minimum of its own — which is what size.target.min is for.
|
|
162
|
+
|
|
163
|
+
Declared rather than emergent. Padding plus contents does clear 24px in several components today, and it is the weaker statement: it is a size nobody wrote down, so it moves when the type scale or the glyph does, and nothing says it was meant to be a target at all.
|
|
164
|
+
Guidance only — cannot be checked automatically.
|
|
165
|
+
- **A component is written along the reading axis, not along the page's left and right** — Every measure, inset and placement in this package names an axis rather than a side: inline-size and block-size, padding-inline and padding-block, inset-inline-start and inset-block-end, margin-inline: auto, text-align: start. Written that way a component follows whichever direction the page is read in, and a band whose claim ranges to the leading edge with its subject on the trailing one is the same composition in Arabic as in English, mirrored, with nothing restated. Written as left and right it is the same pixels in both, which is a layout nobody designed for the second language.
|
|
166
|
+
|
|
167
|
+
The enum values follow the same rule and for the same reason. A prop that names where a picture sits takes start and end, never left and right — FeatureSplit, FeatureBullets and FeatureScroll all declare mediaPosition that way, and the flex directions they generate flip on their own because row already means the reading order. A value called left would have to be re-read as right by every author working in a mirrored page, which is a translation this system should be doing rather than asking for.
|
|
168
|
+
|
|
169
|
+
The guidance a contract carries is part of the component, so it follows too. Describing a claim as ranging left is describing one of the two languages, and it was written that way here for a while: three of the opening bands said so in their own intent. A reader in a mirrored page meets that sentence and has to decide whether the component is wrong or the sentence is, and neither answer is one documentation should force.
|
|
170
|
+
|
|
171
|
+
Two things genuinely have no logical form and are not covered by this. A CSS gradient takes a physical direction — there is no to inline-end — so a pattern that must mirror has to be stated twice under a direction query, and one that is periodic and centred, like PageHeader's rule grid, does not need to. A glyph that points the way onward is the other: an arrow is a picture of a direction, and mirroring it belongs to the icon set rather than to the component holding it.
|
|
172
|
+
Guidance only — cannot be checked automatically.
|
|
173
|
+
|
|
174
|
+
## Anti-examples
|
|
175
|
+
|
|
176
|
+
❌ ComparisonCards for: Five or more options, or rows that are the same for every option and read down a column
|
|
177
|
+
A table states each label once and reads across a row; past four options a card per option is a row of cards too narrow to hold a value, and four is as many as this draws
|
|
178
|
+
→ use `ComparisonTable` instead.
|
|
179
|
+
|
|
180
|
+
❌ ComparisonCards for: The options are features rather than alternatives — each a heading and a sentence, with nothing to compare row by row
|
|
181
|
+
Features are read side by side and taken in at a glance; rows of label and value are a comparison a reader works through
|
|
182
|
+
→ use `FeatureCards` instead.
|
|
183
|
+
|
|
184
|
+
❌ ComparisonCards for: One option and the list of what it includes
|
|
185
|
+
A single list is counted, not compared, and a card standing alone has nothing to line up against
|
|
186
|
+
→ use `FeatureBullets` instead.
|
|
187
|
+
|
|
188
|
+
## Example
|
|
189
|
+
|
|
190
|
+
```tsx
|
|
191
|
+
import { ComparisonCards } from '@deriv-com/dds-marketing'
|
|
192
|
+
|
|
193
|
+
<ComparisonCards ground="subtle" title="What you can trade" description="Own the asset outright, or trade a contract on its price. Here is how the two compare." cards={[{"title":"Spot","description":"Buy the asset itself and hold it for as long as you like.","rows":[{"label":"What you hold","value":"The asset"},{"label":"Leverage","value":"None"},{"label":"Maximum loss","value":"What you paid"},{"label":"Holding cost","value":"None"},{"label":"Settlement","value":"Instant"}]},{"title":"Futures","description":"Trade a contract on the price, long or short, with leverage on your margin.","rows":[{"label":"What you hold","value":"A contract"},{"label":"Leverage","value":"Up to 1:100"},{"label":"Maximum loss","value":"Up to your margin"},{"label":"Holding cost","value":"Funding rate"},{"label":"Settlement","value":"In USDT"}],"recommended":true}]} />
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## In use
|
|
197
|
+
|
|
198
|
+
### One recommended
|
|
199
|
+
|
|
200
|
+
Three accounts with the middle one recommended: coral, lifted, a badge pinned to its top right corner. The others stand back, light.
|
|
201
|
+
|
|
202
|
+
```tsx
|
|
203
|
+
import { ComparisonCards } from '@deriv-com/dds-marketing'
|
|
204
|
+
|
|
205
|
+
// Three accounts, Swap-free recommended
|
|
206
|
+
<ComparisonCards variant="highlighted" title="Choose your account" description="Every account trades the same markets. What changes is how you pay for it." cards={[{"title":"Standard","description":"Commission-free trading on spreads.","rows":[{"label":"Spread from","value":"0.6 pips"},{"label":"Commission","value":"None"},{"label":"Leverage","value":"Up to 1:1000"}]},{"title":"Swap-free","description":"No overnight fees, for positions you hold.","rows":[{"label":"Spread from","value":"0.6 pips"},{"label":"Commission","value":"None"},{"label":"Leverage","value":"Up to 1:500"}],"badge":"Most popular","recommended":true},{"title":"Zero spread","description":"Raw spreads, with a small commission per trade.","rows":[{"label":"Spread from","value":"0.0 pips"},{"label":"Commission","value":"$0.05 per lot"},{"label":"Leverage","value":"Up to 1:1000"}]}]} />
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Four, one recommended
|
|
210
|
+
|
|
211
|
+
Four options with the third recommended — one row of four at full width, two rows of two from the fold.
|
|
212
|
+
|
|
213
|
+
```tsx
|
|
214
|
+
import { ComparisonCards } from '@deriv-com/dds-marketing'
|
|
215
|
+
|
|
216
|
+
// Four accounts
|
|
217
|
+
<ComparisonCards variant="highlighted" title="Find the account for you" cards={[{"title":"Demo","description":"Practise with virtual funds.","rows":[{"label":"Spread from","value":"0.6 pips"},{"label":"Commission","value":"None"},{"label":"Leverage","value":"Up to 1:1000"}]},{"title":"Standard","description":"Commission-free trading on spreads.","rows":[{"label":"Spread from","value":"0.6 pips"},{"label":"Commission","value":"None"},{"label":"Leverage","value":"Up to 1:1000"}]},{"title":"Swap-free","description":"No overnight fees.","rows":[{"label":"Spread from","value":"0.6 pips"},{"label":"Commission","value":"None"},{"label":"Leverage","value":"Up to 1:500"}],"badge":"Recommended","recommended":true},{"title":"Zero spread","description":"Raw spreads, small commission.","rows":[{"label":"Spread from","value":"0.0 pips"},{"label":"Commission","value":"$0.05 per lot"},{"label":"Leverage","value":"Up to 1:1000"}]}]} />
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Three accounts
|
|
221
|
+
|
|
222
|
+
Three options side by side at full width, every card the same light card, each answering the same rows so they read across.
|
|
223
|
+
|
|
224
|
+
```tsx
|
|
225
|
+
import { ComparisonCards } from '@deriv-com/dds-marketing'
|
|
226
|
+
|
|
227
|
+
// Account types on the page
|
|
228
|
+
<ComparisonCards title="Choose your account" description="Every account trades the same markets. What changes is how you pay for each trade." cards={[{"title":"Standard","description":"Commission-free trading for most traders.","rows":[{"label":"Minimum deposit","value":"USD 5"},{"label":"Spreads from","value":"0.6 pips"},{"label":"Commission","value":"None"},{"label":"Leverage","value":"Up to 1:1000"}],"action":{"label":"Open a Standard account","href":"https://example.com/standard"}},{"title":"Zero spread","description":"Raw pricing with a fixed commission on every lot.","rows":[{"label":"Minimum deposit","value":"USD 5"},{"label":"Spreads from","value":"0.0 pips"},{"label":"Commission","value":"USD 3.50 per lot"},{"label":"Leverage","value":"Up to 1:1000"}],"action":{"label":"Open a Zero spread account","href":"https://example.com/zero-spread"}},{"title":"Swap-free","description":"No overnight swap, for traders who cannot pay or earn interest.","rows":[{"label":"Minimum deposit","value":"USD 5"},{"label":"Spreads from","value":"0.6 pips"},{"label":"Commission","value":"None"},{"label":"Leverage","value":"Up to 1:1000"}],"footnote":"Holding fees may apply to positions kept open for more than five days.","action":{"label":"Open a Swap-free account","href":"https://example.com/swap-free"}}]} />
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Four options
|
|
232
|
+
|
|
233
|
+
Four account types as equals: one row of four at full width, two rows of two from the fold, every card the same light card.
|
|
234
|
+
|
|
235
|
+
```tsx
|
|
236
|
+
import { ComparisonCards } from '@deriv-com/dds-marketing'
|
|
237
|
+
|
|
238
|
+
// Four cards
|
|
239
|
+
<ComparisonCards title="Choose your account" description="Every account trades the same markets. What changes is how you pay for it." cards={[{"title":"Standard","description":"Commission-free trading on spreads.","rows":[{"label":"Spread from","value":"0.6 pips"},{"label":"Commission","value":"None"},{"label":"Leverage","value":"Up to 1:1000"}]},{"title":"Zero spread","description":"Raw spreads, with a small commission per trade.","rows":[{"label":"Spread from","value":"0.0 pips"},{"label":"Commission","value":"$0.05 per lot"},{"label":"Leverage","value":"Up to 1:1000"}]},{"title":"Swap-free","description":"No overnight fees, for positions you hold.","rows":[{"label":"Spread from","value":"0.6 pips"},{"label":"Commission","value":"None"},{"label":"Leverage","value":"Up to 1:500"}]},{"title":"Demo","description":"Practise with virtual funds before you trade.","rows":[{"label":"Spread from","value":"0.6 pips"},{"label":"Commission","value":"None"},{"label":"Leverage","value":"Up to 1:1000"}]}]} />
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Grounds
|
|
243
|
+
|
|
244
|
+
The same pair on the page and on the dark band. The cards keep their own grounds; the heading takes the band's ink.
|
|
245
|
+
|
|
246
|
+
```tsx
|
|
247
|
+
import { ComparisonCards } from '@deriv-com/dds-marketing'
|
|
248
|
+
|
|
249
|
+
// On the page
|
|
250
|
+
<ComparisonCards ground="page" title="Options or Multipliers" cards={[{"title":"Options","description":"Predict the market's move and know your payout before you buy.","rows":[{"label":"Maximum loss","value":"Your stake"},{"label":"Payout","value":"Fixed at purchase"},{"label":"Duration","value":"1 second to 365 days"}]},{"title":"Multipliers","description":"Multiply your exposure without risking more than your stake.","rows":[{"label":"Maximum loss","value":"Your stake"},{"label":"Payout","value":"Follows the market"},{"label":"Duration","value":"Until you close"}]}]} />
|
|
251
|
+
|
|
252
|
+
// On the grey band
|
|
253
|
+
<ComparisonCards ground="subtle" title="Options or Multipliers" cards={[{"title":"Options","description":"Predict the market's move and know your payout before you buy.","rows":[{"label":"Maximum loss","value":"Your stake"},{"label":"Payout","value":"Fixed at purchase"},{"label":"Duration","value":"1 second to 365 days"}]},{"title":"Multipliers","description":"Multiply your exposure without risking more than your stake.","rows":[{"label":"Maximum loss","value":"Your stake"},{"label":"Payout","value":"Follows the market"},{"label":"Duration","value":"Until you close"}]}]} />
|
|
254
|
+
|
|
255
|
+
// On the dark band
|
|
256
|
+
<ComparisonCards ground="strong" title="Options or Multipliers" cards={[{"title":"Options","description":"Predict the market's move and know your payout before you buy.","rows":[{"label":"Maximum loss","value":"Your stake"},{"label":"Payout","value":"Fixed at purchase"},{"label":"Duration","value":"1 second to 365 days"}]},{"title":"Multipliers","description":"Multiply your exposure without risking more than your stake.","rows":[{"label":"Maximum loss","value":"Your stake"},{"label":"Payout","value":"Follows the market"},{"label":"Duration","value":"Until you close"}]}]} />
|
|
257
|
+
```
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
<!-- GENERATED from comparison-table.contract.json. Do not edit. -->
|
|
2
|
+
|
|
3
|
+
# ComparisonTable
|
|
4
|
+
|
|
5
|
+
A comparison-table section for short, fixed column sets. It renders a rounded card with a light header row, horizontal dividers only, a bold first-column label, and two or three value columns. Unlike Table, this block has no search, pagination, or header tooltips.
|
|
6
|
+
|
|
7
|
+
The reference design's DynamicTable, named for what it is for. A heading and, where it needs one, a line under it, over the page's own Table in the page's own Card: a band of column names, then one row per thing compared, each row named by its first cell. Its columns and rows are records rather than children, because the block has to draw every row against the same columns. A cell holds one line or a short list of them. On a phone the columns keep a readable width and the table scrolls across inside its card.
|
|
8
|
+
|
|
9
|
+
## Use when
|
|
10
|
+
|
|
11
|
+
- Comparing two or three options — platforms, plans, operating systems — on the same handful of features, where the reader reads across a row as often as down a column
|
|
12
|
+
- A product page's "Web terminal, desktop or mobile": the same few features, each option's answer in a word or a short line
|
|
13
|
+
- Schedule-style rows, where a cell may hold a short list of lines — a market's trading sessions, the days a rate applies
|
|
14
|
+
|
|
15
|
+
## Do not use
|
|
16
|
+
|
|
17
|
+
- Each option has more to say than a cell holds — a sentence of its own, a footnote, a way on → `ComparisonCards`
|
|
18
|
+
- A large dataset — many instruments, many columns — that a reader searches, sorts or pages through → `DataTable`
|
|
19
|
+
- One option and the list of what it includes → `FeatureBullets`
|
|
20
|
+
- More than three options. Only the first four columns are drawn — the labels and three values — because a fourth option in a card this wide is a column too narrow to read
|
|
21
|
+
- Live prices, spreads or any figure fetched from a feed. The values are the page's copy and stand still
|
|
22
|
+
- A paragraph in a cell. A cell is a word, a short line or a short list of them; anything longer belongs in a card of its own
|
|
23
|
+
- Layout. A table means the rows and columns carry meaning, and a screen reader reads it out as rows and columns
|
|
24
|
+
|
|
25
|
+
## Anatomy
|
|
26
|
+
|
|
27
|
+
ComparisonTable renders 9 elements. A token binding names the part it applies to.
|
|
28
|
+
|
|
29
|
+
- `root` — `<section>`, class `dds-comparisontable`. The section. It paints the ground and the ink to go with it — see `ground` — and asks its own width, so the heading centres on the section's measure rather than the window's. A region named by its heading.
|
|
30
|
+
- `inner` — `<div>`, class `dds-comparisontable__inner`. The measure and the gutter, the same column every band holds its content in, and the step from the heading to the table: space.heading.content.
|
|
31
|
+
- `header` — `<div>`, class `dds-comparisontable__header`. The heading and the line under it, FeatureCards' header and its arrangement: ranged to the start on a phone and centred from the fold, the table being stacked content under it. It sets no gap: the title's own margin is the step, so a header without a line closes up.
|
|
32
|
+
- `title` — `<h2>`, class `dds-comparisontable__title`. What is being compared. `h2` because a section sits under the page's own heading.
|
|
33
|
+
- `description` — `<p>`, class `dds-comparisontable__description`. The line under the heading, held to the description measure. Drawn only for a section given a `description`. Rendered only when `description` is set.
|
|
34
|
+
- `body` — `<div>`, class `dds-comparisontable__body`. The table's card and the footnote under it, held together at space.gap.md — closer than the section's step from the heading, so the note reads as belonging to the table. It holds the page's own Card, and in it the page's own Table, which is what scrolls across on a phone.
|
|
35
|
+
- `row-header` — `<th>`, class `dds-comparisontable__row-header`. A row's label, in the first column: a header cell scoped to its row, so a screen reader announces it before every value across the row the way it announces a column's name before every value down it. Drawn in the label weight against the values' body weight — the reference's bold first column. It is TableCell's own cell — the class and the data the row hands it, so the Table's sheet gives it the same inset, rule and wrapping as the values beside it — rendered as a `th`, which TableCell, being a value, never is.
|
|
36
|
+
- `cell-list` — `<ul>`, class `dds-comparisontable__cell-list`. A cell holding several lines — a schedule's sessions, a platform's operating systems — drawn as a list, one line to an item, so a screen reader says how many there are and reads each as its own. No markers: the lines are short and stacked, and a bullet would be a column of dots down every cell. Drawn only for a value given as a list of two or more; one line is plain text.
|
|
37
|
+
- `footnote` — `<p>`, class `dds-comparisontable__footnote`. A note true of the whole table, under the card in small, quieter type — muted on the page and the grey band, the band's own quieter ink on the dark band. Drawn only for a section given a `footnote`. Rendered only when `footnote` is set.
|
|
38
|
+
|
|
39
|
+
Apply these classes from the generated `comparisonTableParts` constant rather than writing the strings by hand.
|
|
40
|
+
|
|
41
|
+
## Composition
|
|
42
|
+
|
|
43
|
+
- Takes no children. Everything it renders comes from props
|
|
44
|
+
- Never contains: `ComparisonTable`, `LandingHero`, `ProductHero`, `PageHeader`, `Footer`, `Navbar` — in children or in any prop that takes a node
|
|
45
|
+
|
|
46
|
+
## Props
|
|
47
|
+
|
|
48
|
+
### ground — `page` | `subtle` | `strong` (default `page`)
|
|
49
|
+
|
|
50
|
+
- `page` — The default, and the page's own white. The card is the recessed surface on it, Card's own `surface`, so it has an edge
|
|
51
|
+
- `subtle` — The grey band, the reference design's ground for this section. The card is raised to color.bg.surface-card-raised on it — white in light — because its own fill is the band's grey. Painted as the band's tint over the page's own ground, so it is the same grey whatever is behind the section
|
|
52
|
+
- `strong` — `color.bg.brand-strong`, the dark band, for a section a reader should arrive at. The heading and the line under it turn white; the card turns to Card's inverse surface with white ink, its header band and rules to the band's own white veils
|
|
53
|
+
|
|
54
|
+
Use when: Which of the page's three grounds this section paints, and with it the table's card: the page builds its rhythm from these, and the ink follows the ground in the same value.
|
|
55
|
+
Never for: Marking importance. Every section on a page painted a ground is a page with no emphasis left. And never the coral `color.bg.brand`, which belongs to the band that asks a reader to act.
|
|
56
|
+
|
|
57
|
+
### title — `string` **Required.**
|
|
58
|
+
|
|
59
|
+
Use when: Always. What is being compared, in the fewest words that name it — "MT5 on every device", "Web terminal or desktop app?". It names the section and the table's scroll region both.
|
|
60
|
+
Never for: The verdict. The table makes the case; a heading that announces a winner leaves the reader nothing to compare.
|
|
61
|
+
|
|
62
|
+
### description — `string`
|
|
63
|
+
|
|
64
|
+
Use when: A line saying what the options have in common, or what the reader is choosing between, when the title alone does not.
|
|
65
|
+
Never for: A disclaimer. A note true of the whole table goes under it, in `footnote`.
|
|
66
|
+
|
|
67
|
+
### columns — `data` `ComparisonTableColumn[]` **Required.**
|
|
68
|
+
|
|
69
|
+
Use when: Always. The columns, in reading order: first the labels' own — its `label` names what the rows are, "Features" — then the two or three options being compared, each with the `key` its values are filed under in every row and the `label` written over it. Only the first four are drawn; the columns share the card's width equally.
|
|
70
|
+
Never for: One option on its own — there is nothing for it to be compared with — or a fourth option, which is not drawn.
|
|
71
|
+
|
|
72
|
+
### rows — `data` `ComparisonTableRow[]` **Required.**
|
|
73
|
+
|
|
74
|
+
Use when: Always. The rows, in reading order — each with its `label`, drawn as the row's header in the first column, and its `values` filed under the columns' keys. A value is one line, or a list of short lines that is drawn as a list. Keep them few enough to read without paging: a handful to a dozen. An empty list draws nothing.
|
|
75
|
+
Never for: Values the page cannot stand behind on the day it is read, or a row whose answers are the same for every option — a row that does not differ is not part of the comparison.
|
|
76
|
+
|
|
77
|
+
### footnote — `string`
|
|
78
|
+
|
|
79
|
+
Use when: A note true of the whole table — where the figures come from, what an asterisk means — under the card in small type.
|
|
80
|
+
Never for: Anything a reader needs to make the comparison. A footnote is read last if at all; a difference that matters is a row.
|
|
81
|
+
|
|
82
|
+
## Accessibility
|
|
83
|
+
|
|
84
|
+
Guaranteed by the component. Write none of it by hand: the ids these attributes point at are generated per instance, so an attribute set from outside either says the same thing twice or points at nothing.
|
|
85
|
+
|
|
86
|
+
- Announced as: `region`
|
|
87
|
+
- `Tab` — Moves to the table's scroll region, Table's own tab stop, so a keyboard can reach the columns a phone scrolls to.
|
|
88
|
+
- `ArrowLeft` — On the focused table: scrolls it the way the key points — the browser's own scrolling, made reachable by the tab stop.
|
|
89
|
+
- `ArrowRight` — On the focused table: scrolls it the way the key points, the mirror of ArrowLeft.
|
|
90
|
+
- accessible name from title, so the section is a named region a screen reader can jump to and skip
|
|
91
|
+
- The column names are header cells scoped to their columns and each row's label a header cell scoped to its row, so every value is announced with both the option and the feature it answers.
|
|
92
|
+
- A cell of several lines is a list, so the count and each line are announced rather than run together as one.
|
|
93
|
+
- The table's scroll region is named by the section's title, so a reader who tabs into it is told what they have arrived in.
|
|
94
|
+
|
|
95
|
+
## Rules
|
|
96
|
+
|
|
97
|
+
- **On a phone a section's actions stack and each fills the width, including when there is only one** — On a phone a page's actions stack, and each one fills the width. Not most of it, and not the width its label happens to need — the whole column.
|
|
98
|
+
|
|
99
|
+
Two side by side is what this replaces. On the narrowest screen each gets half a column minus the gap, which is rarely enough for a real label: the words wrap inside the pills, the two buttons come out different heights, and the pair reads as a broken row rather than as a choice. Stacked, each has the whole width and neither has to shorten its words to fit.
|
|
100
|
+
|
|
101
|
+
A single action fills too, and that is the part worth saying, because it is the one that looks unnecessary. A lone button has the room to sit at its natural width and still should not: a full-width control is the phone's convention for the thing the screen is asking you to do, and a pill hugging its label reads as one option among others that are not there. It also makes the target predictable — the whole width, wherever the thumb lands — which a centred pill does not.
|
|
102
|
+
|
|
103
|
+
Filling is the row's job rather than the button's. A button has no width of its own and is not given one; the row it sits in becomes a column and stretches its children, so nothing about the control changes and the same button is full width here and its own size on a desktop.
|
|
104
|
+
|
|
105
|
+
This is the phone's breakpoint, size.breakpoint.md, and not the wider one that decides whether a heading is centred. Those are different questions and they break at different widths: a heading stops being centred when the measure is the screen, while a button stops being full width much sooner than that — stretched across a tablet it is a long way from its own label, and a label centred in a metre of pill is harder to hit than one in a pill the size of the words.
|
|
106
|
+
|
|
107
|
+
What this is not about is every row of controls. A set of filter chips, a pagination strip, a toolbar, a link sitting after a sentence — none of these is the page asking for something, and stacking them to full width would turn a strip the eye skims into a list it has to read. The test is whether the row is the call to action the section was written for.
|
|
108
|
+
Guidance only — cannot be checked automatically.
|
|
109
|
+
- **Never nest one interactive element inside another** — Nested interactive elements produce ambiguous hit targets and an unreachable inner control for keyboard and screen-reader users. This is why the rule cannot live on any single component — it constrains Button, Link, CardButton and TextInput simultaneously.
|
|
110
|
+
Guidance only — cannot be checked automatically.
|
|
111
|
+
- **A section that paints a ground sets the ink to go with it** — A page sits on color.bg.page, and a section that separates itself from it takes one of three grounds. color.bg.subtle is the light one and needs nothing further — the page's own ink still reads on it. The other two are dark and do not: color.bg.brand-strong takes color.fg.on-brand-strong, and color.bg.brand takes color.fg.on-solid. Both are white, and both are written as the role rather than the white they resolve to. Set one of those backgrounds without its ink and the text inherits whatever the page was already using, which is near-black on a dark band — legible to nobody, and invisible to every check here, because each pair passes contrast on its own and nothing can tell whether a section used both.
|
|
112
|
+
|
|
113
|
+
color.bg.brand carries a second limit that is not about forgetting. Its ink measures 3.39:1, which clears the 3:1 a heading needs and misses the 4.5:1 running copy needs. A coral band may carry a headline and a call to action; a paragraph on one is text the reader has to work through at a ratio the waiver on that role does not cover — the waiver says so itself. A section with copy in it takes color.bg.brand-strong, which is near-black and carries white at full contrast.
|
|
114
|
+
|
|
115
|
+
color.bg.strong is not a section ground. It is the inverted fill for an action that has to outrank what surrounds it, and the components that paint it — Button and ButtonIcon in their inverse form — already set both halves in one rule, which is the pattern a hand-painted section has to copy.
|
|
116
|
+
Guidance only — cannot be checked automatically.
|
|
117
|
+
- **Every gap inside a section names the relationship it expresses, and the same relationship keeps its measure when it turns on its side** — A section's spacing is named by the relationship it expresses, not chosen by size. Every gap in a section has a role token, and reaching for a step off the generic scale because it happens to be the right number is how two sections written by two people stop lining up: the numbers agree today and drift the first time one of them is tuned.
|
|
118
|
+
|
|
119
|
+
The heading group is three steps, not one gap. An eyebrow sits nearer its title than the title sits to its description, and the actions sit further from the description than either — space.heading.eyebrow-title, space.heading.title-description, space.heading.description-actions, in that order. A single `gap` on the group cannot say this; it sets all three the same and the block reads as evenly spaced lines rather than as a mark, a name and a paragraph. The eyebrow has to identify itself for this to work, because a group that opens with a title must not give its description the eyebrow's tighter step.
|
|
120
|
+
|
|
121
|
+
The step between a title and its description follows the size of the title, which is why there are two of it. What a reader sees is not the gap but the gap plus the leading above it, and leading scales with the type: under a display title the leading is most of the space, under a card's title it is half as deep. One value for both makes a card look loose at the size that made a section look right. So space.heading.title-description is the display step and space.heading.title-description-compact is the step at a card's size, and the choice is made by how big the title is rather than by what kind of block it sits in.
|
|
122
|
+
|
|
123
|
+
Every one of those steps is smaller than the gap below the group, and that ordering is what holds the group together as one thing. space.heading.content is the step between a heading group and the content it introduces, and it is the widest measure inside a section: the one gap the eye reads as a change of subject rather than as a continuation.
|
|
124
|
+
|
|
125
|
+
That step is the same whether the content is under the heading or beside it. A split is the same relationship turned on its side — a heading group and the content it introduces — so the space between the two halves is space.heading.content, not a gutter. When the split collapses to one column on a phone the gap becomes vertical again, which is where it started, and nothing has to change for that to be right.
|
|
126
|
+
|
|
127
|
+
space.grid.gutter is between two things of the same kind. Two cards in a row are the same kind; the two halves of a split are not, which is why the gutter is the wrong measure there even when the number would have looked acceptable. The gutter runs on both axes, so a grid reads as an even field rather than as rows with a seam down them.
|
|
128
|
+
|
|
129
|
+
space.inset.card is the card's, not the page's. A row of cards padded differently is a row of different cards, and the fill is the only edge they have. A page composing a row does not get to choose it.
|
|
130
|
+
|
|
131
|
+
Column count is not a breakpoint decision. A row holds as many columns as fit before a column would be narrower than size.grid.column-min, and drops one when they would not. Written as a fixed count that collapses at a breakpoint, a four-up row keeps four columns at every width above the phone and sets its copy two or three words to a line through the whole of the tablet range — and on a narrow desktop, which no breakpoint sits on at all. The threshold is a property of the row rather than of a card: a card fills whatever cell it is given.
|
|
132
|
+
|
|
133
|
+
What this does not cover is the space above and below a section, which is space.section.default and space.section.compact, and the page's own side margin, which is space.inset.page. Those are the section's outside; everything here is its inside.
|
|
134
|
+
Guidance only — cannot be checked automatically.
|
|
135
|
+
- **A section's title is centred over stacked content, starts beside content in columns, and starts on a phone** — Two arrangements, and the title's alignment is decided by which one it is introducing rather than chosen per section.
|
|
136
|
+
|
|
137
|
+
Content stacked under the title — a row of cards, an accordion, a set of steps — takes a centred title. The heading group and the block below it share one axis, so a centred title is symmetric with the thing it names, and the eye drops from the middle of the words to the middle of the set. A title starting at the left over a centred or full-width block reads as belonging to the first column rather than to all of them.
|
|
138
|
+
|
|
139
|
+
Content beside the title — a split, a picture in the other half, anything laid out in columns — takes a title that starts where its content starts. The two share a left edge, and that edge is what says they are one thing read across rather than two stacked. Centring the title there breaks the only alignment the reader has to hold the halves together, and it drifts further from its content the wider the page gets.
|
|
140
|
+
|
|
141
|
+
The heading group is what carries this, not the heading alone. An eyebrow, a title and a description are read as one block and align together; aligning the title without them leaves a centred heading over start-aligned copy, which reads as a mistake rather than as a choice.
|
|
142
|
+
|
|
143
|
+
Centred means all of it, not just the words. A badge, a row of actions, a picture — these are flex children, and a flex child is placed by align-items rather than by text-align, so a block that only sets the text leaves everything that is not text at the start. A hero is the case that shows it: its title and copy centred while its badge and its buttons did not.
|
|
144
|
+
|
|
145
|
+
A capped block centres itself as well as its words. A heading group takes size.heading-group.max, and a cap that is not centred leaves the measure at the start of the column with the words centred inside it — composed, and a long way left of the middle it appears to be in.
|
|
146
|
+
|
|
147
|
+
Both arrangements go to the start on a phone. A centred block reverts below the breakpoint, and the reason is the measure: on a phone the measure is the screen, so a centred title wraps to three or four ragged lines and the eye loses the left edge it was tracking — the same symmetry that reads as composure on a desktop is what makes it hard to scan on a phone. Centring there has to be asked for twice, and a section title is not one of the things that asks: it is centred because there is room for it, and on a phone there is not. Going back to the start means all of it too, and a capped block is the one that hides a leftover: its words go to the start while its measure stays in the middle of the column, which reads as a title still centred over a badge and buttons that are not — the box in the middle and the line inside it at the edge.
|
|
148
|
+
|
|
149
|
+
A hero is a section like any other: its badge, title, copy and actions are one stacked block, so it is centred on a desktop and starts on a phone with everything else.
|
|
150
|
+
|
|
151
|
+
What this is not about is a page whose body is a form or a document. A title over a sign-up form or a guide is not introducing a set of content — it is the first line of the thing itself, and it keeps the alignment the body has, which for running text is the start. The distinction is whether the block below is content the title names or content the title is part of.
|
|
152
|
+
Guidance only — cannot be checked automatically.
|
|
153
|
+
- **Anything a pointer has to hit is at least 24px in both directions** — A control sized by its contents is as big as its contents, and a glyph is chosen for how it reads rather than for how easily it is hit. An icon-only button with no padding is a 16px target — smaller than the pad of a finger, and smaller than the tremor of a hand using a mouse.
|
|
154
|
+
|
|
155
|
+
WCAG 2.2 asks for 24 by 24 CSS pixels at AA. The exceptions are narrower than they look: inline targets inside a sentence are exempt, and so is a small target with 24px of clear space around it — but a clear button sits against the field it empties, and a field is itself a target, so the spacing exemption does not apply to the case that keeps arising.
|
|
156
|
+
|
|
157
|
+
The target and the mark are separate decisions, and conflating them is what produces both faults. Growing the glyph to 24px makes it shout; leaving the button at 16px makes it hard to hit. So the glyph keeps the size that reads correctly beside its text, and the box around it declares a minimum of its own — which is what size.target.min is for.
|
|
158
|
+
|
|
159
|
+
Declared rather than emergent. Padding plus contents does clear 24px in several components today, and it is the weaker statement: it is a size nobody wrote down, so it moves when the type scale or the glyph does, and nothing says it was meant to be a target at all.
|
|
160
|
+
Guidance only — cannot be checked automatically.
|
|
161
|
+
- **A component is written along the reading axis, not along the page's left and right** — Every measure, inset and placement in this package names an axis rather than a side: inline-size and block-size, padding-inline and padding-block, inset-inline-start and inset-block-end, margin-inline: auto, text-align: start. Written that way a component follows whichever direction the page is read in, and a band whose claim ranges to the leading edge with its subject on the trailing one is the same composition in Arabic as in English, mirrored, with nothing restated. Written as left and right it is the same pixels in both, which is a layout nobody designed for the second language.
|
|
162
|
+
|
|
163
|
+
The enum values follow the same rule and for the same reason. A prop that names where a picture sits takes start and end, never left and right — FeatureSplit, FeatureBullets and FeatureScroll all declare mediaPosition that way, and the flex directions they generate flip on their own because row already means the reading order. A value called left would have to be re-read as right by every author working in a mirrored page, which is a translation this system should be doing rather than asking for.
|
|
164
|
+
|
|
165
|
+
The guidance a contract carries is part of the component, so it follows too. Describing a claim as ranging left is describing one of the two languages, and it was written that way here for a while: three of the opening bands said so in their own intent. A reader in a mirrored page meets that sentence and has to decide whether the component is wrong or the sentence is, and neither answer is one documentation should force.
|
|
166
|
+
|
|
167
|
+
Two things genuinely have no logical form and are not covered by this. A CSS gradient takes a physical direction — there is no to inline-end — so a pattern that must mirror has to be stated twice under a direction query, and one that is periodic and centred, like PageHeader's rule grid, does not need to. A glyph that points the way onward is the other: an arrow is a picture of a direction, and mirroring it belongs to the icon set rather than to the component holding it.
|
|
168
|
+
Guidance only — cannot be checked automatically.
|
|
169
|
+
|
|
170
|
+
## Anti-examples
|
|
171
|
+
|
|
172
|
+
❌ ComparisonTable for: Each option has more to say than a cell holds — a sentence of its own, a footnote, a way on
|
|
173
|
+
A card per option has room for its name, a sentence and its own action; a cell is a word or a short line, and a paragraph in one makes every row as tall as its longest answer
|
|
174
|
+
→ use `ComparisonCards` instead.
|
|
175
|
+
|
|
176
|
+
❌ ComparisonTable for: A large dataset — many instruments, many columns — that a reader searches, sorts or pages through
|
|
177
|
+
Search, pagination and header tooltips are what a long specification grid needs and what this block deliberately leaves out; past a dozen rows a reader is looking something up rather than comparing
|
|
178
|
+
→ use `DataTable` instead.
|
|
179
|
+
|
|
180
|
+
❌ ComparisonTable for: One option and the list of what it includes
|
|
181
|
+
A single list is counted, not compared, and a table with one value column has nothing to line up against
|
|
182
|
+
→ use `FeatureBullets` instead.
|
|
183
|
+
|
|
184
|
+
## Example
|
|
185
|
+
|
|
186
|
+
```tsx
|
|
187
|
+
import { ComparisonTable } from '@deriv-com/dds-marketing'
|
|
188
|
+
|
|
189
|
+
<ComparisonTable ground="subtle" title="MT5 on every device" description="Trade from your browser, your computer or your phone. Here is what each version of MetaTrader 5 gives you." columns={[{"key":"feature","label":"Features"},{"key":"web","label":"Web terminal"},{"key":"desktop","label":"Desktop"},{"key":"mobile","label":"Mobile app"}]} rows={[{"label":"Installation","values":{"web":"None — runs in your browser","desktop":"Download and install","mobile":"From the App Store or Google Play"}},{"label":"Charts","values":{"web":"21 timeframes","desktop":"21 timeframes","mobile":"9 timeframes"}},{"label":"Indicators","values":{"web":"30 built in","desktop":"38 built in, plus custom","mobile":"30 built in"}},{"label":"Expert Advisors","values":{"web":"Not available","desktop":"Yes","mobile":"Not available"}},{"label":"One-click trading","values":{"web":"Yes","desktop":"Yes","mobile":"Yes"}},{"label":"Platforms","values":{"web":["Any modern browser"],"desktop":["Windows","macOS"],"mobile":["iOS","Android"]}}]} />
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## In use
|
|
193
|
+
|
|
194
|
+
### Three options
|
|
195
|
+
|
|
196
|
+
The labels and three options, the most the card draws: a band of names, a bold label down the side and rules between the rows. A list cell stacks its lines.
|
|
197
|
+
|
|
198
|
+
```tsx
|
|
199
|
+
import { ComparisonTable } from '@deriv-com/dds-marketing'
|
|
200
|
+
|
|
201
|
+
// MT5 on every device
|
|
202
|
+
<ComparisonTable ground="subtle" title="MT5 on every device" description="Trade from your browser, your computer or your phone. Here is what each version of MetaTrader 5 gives you." columns={[{"key":"feature","label":"Features"},{"key":"web","label":"Web terminal"},{"key":"desktop","label":"Desktop"},{"key":"mobile","label":"Mobile app"}]} rows={[{"label":"Installation","values":{"web":"None — runs in your browser","desktop":"Download and install","mobile":"From the App Store or Google Play"}},{"label":"Charts","values":{"web":"21 timeframes","desktop":"21 timeframes","mobile":"9 timeframes"}},{"label":"Indicators","values":{"web":"30 built in","desktop":"38 built in, plus custom","mobile":"30 built in"}},{"label":"Expert Advisors","values":{"web":"Not available","desktop":"Yes","mobile":"Not available"}},{"label":"One-click trading","values":{"web":"Yes","desktop":"Yes","mobile":"Yes"}},{"label":"Platforms","values":{"web":["Any modern browser"],"desktop":["Windows","macOS"],"mobile":["iOS","Android"]}}]} />
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### A schedule, with lines in a cell
|
|
206
|
+
|
|
207
|
+
Two options and cells of several short lines — a market's sessions, its breaks — each read as a list of its own. A note true of the whole table goes under the card.
|
|
208
|
+
|
|
209
|
+
```tsx
|
|
210
|
+
import { ComparisonTable } from '@deriv-com/dds-marketing'
|
|
211
|
+
|
|
212
|
+
// Trading hours, with a footnote
|
|
213
|
+
<ComparisonTable title="When you can trade" columns={[{"key":"market","label":"Market"},{"key":"hours","label":"Trading hours (GMT)"},{"key":"breaks","label":"Daily break"}]} rows={[{"label":"Forex","values":{"hours":["Sunday 21:05 to Friday 20:55"],"breaks":"None"}},{"label":"Stock indices","values":{"hours":["Monday to Friday","01:00 to 20:15"],"breaks":["20:15 to 21:00","Varies by index"]}},{"label":"Commodities","values":{"hours":["Monday to Friday","23:00 to 21:59"],"breaks":"21:59 to 23:00"}},{"label":"Cryptocurrencies","values":{"hours":"Every day, all day","breaks":"None"}},{"label":"Derived indices","values":{"hours":"Every day, all day","breaks":"None"}}]} footnote="Times shift by an hour when daylight saving starts or ends. Public holidays may close a market early." />
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### The three grounds
|
|
217
|
+
|
|
218
|
+
The card is the recessed surface on the page, white on the grey band, and Card's inverse surface with white ink, a white header veil and white rules on the dark band.
|
|
219
|
+
|
|
220
|
+
```tsx
|
|
221
|
+
import { ComparisonTable } from '@deriv-com/dds-marketing'
|
|
222
|
+
|
|
223
|
+
// ground="page"
|
|
224
|
+
<ComparisonTable ground="page" title="Windows or Mac?" columns={[{"key":"feature","label":"Features"},{"key":"windows","label":"Windows"},{"key":"mac","label":"Mac"}]} rows={[{"label":"Desktop app","values":{"windows":"Yes","mac":"Yes"}},{"label":"Expert Advisors","values":{"windows":"Yes","mac":"Yes"}},{"label":"System","values":{"windows":["Windows 10 or later","64-bit"],"mac":["macOS 12 or later","Apple silicon or Intel"]}}]} />
|
|
225
|
+
|
|
226
|
+
// ground="subtle"
|
|
227
|
+
<ComparisonTable ground="subtle" title="Windows or Mac?" columns={[{"key":"feature","label":"Features"},{"key":"windows","label":"Windows"},{"key":"mac","label":"Mac"}]} rows={[{"label":"Desktop app","values":{"windows":"Yes","mac":"Yes"}},{"label":"Expert Advisors","values":{"windows":"Yes","mac":"Yes"}},{"label":"System","values":{"windows":["Windows 10 or later","64-bit"],"mac":["macOS 12 or later","Apple silicon or Intel"]}}]} />
|
|
228
|
+
|
|
229
|
+
// ground="strong"
|
|
230
|
+
<ComparisonTable ground="strong" title="Windows or Mac?" columns={[{"key":"feature","label":"Features"},{"key":"windows","label":"Windows"},{"key":"mac","label":"Mac"}]} rows={[{"label":"Desktop app","values":{"windows":"Yes","mac":"Yes"}},{"label":"Expert Advisors","values":{"windows":"Yes","mac":"Yes"}},{"label":"System","values":{"windows":["Windows 10 or later","64-bit"],"mac":["macOS 12 or later","Apple silicon or Intel"]}}]} />
|
|
231
|
+
```
|
|
@@ -61,13 +61,13 @@ Accepts: Button, Link
|
|
|
61
61
|
Use when: The one action the message asks for, or two at most. The coral is the banner's ground, so the primary is Button variant="inverse" tone="brand" — a primary Button is coral on coral, and the tone keeps it near-black in both themes — and a second is Button variant="secondary" tone="brand" — a white tint with a white label, fixed in both themes like the band.
|
|
62
62
|
Never for: A third action, or a primary Button: coral on the coral ground is a button nobody can see.
|
|
63
63
|
|
|
64
|
-
### background — `
|
|
64
|
+
### background — `grid` | `plain` (default `grid`)
|
|
65
65
|
|
|
66
|
-
- `
|
|
67
|
-
- `
|
|
66
|
+
- `grid` — The default: a fine rule grid behind the band's content — light coral hairlines rising out of a deeper red at the band's foot, moving slowly at rest and brightening around the pointer. Drawn by Background as a layer under the band's own content, so the band's layout is untouched.
|
|
67
|
+
- `plain` — The flat coral and nothing on it, asked for by name: a page that already spends its one pattern on another band, or a banner set among busy content where the grid would be texture fighting texture.
|
|
68
68
|
|
|
69
|
-
Use when:
|
|
70
|
-
Never for: More than one band on a page. The pattern is what makes a band the one a reader remembers, and two of them make neither
|
|
69
|
+
Use when: Whether the band carries its grid. It does unless asked not to: the banner is the page's standout moment, and the grid is what makes it one.
|
|
70
|
+
Never for: More than one patterned band on a page — pass plain to the others. The pattern is what makes a band the one a reader remembers, and two of them make neither
|
|
71
71
|
|
|
72
72
|
## Accessibility
|
|
73
73
|
|
|
@@ -195,17 +195,14 @@ import { Button, CtaBanner } from '@deriv-com/dds-marketing'
|
|
|
195
195
|
|
|
196
196
|
### A patterned ground
|
|
197
197
|
|
|
198
|
-
|
|
198
|
+
A white rule grid on the coral band, behind the words and answering the pointer — drawn by Background under the band's own content. The banner's default; plain asks for the flat coral.
|
|
199
199
|
|
|
200
200
|
```tsx
|
|
201
201
|
import { Button, CtaBanner } from '@deriv-com/dds-marketing'
|
|
202
202
|
|
|
203
|
-
//
|
|
204
|
-
<CtaBanner title="Join 3M+ global traders" description="Open an account in minutes and start trading the world's markets." actions={<Button variant="inverse" href="/signup" tone="brand">Open account</Button>} background="halftone" />
|
|
205
|
-
|
|
206
|
-
// grid — move the pointer over it
|
|
203
|
+
// grid — the default; move the pointer over it
|
|
207
204
|
<CtaBanner title="Join 3M+ global traders" description="Open an account in minutes and start trading the world's markets." actions={<Button variant="inverse" href="/signup" tone="brand">Open account</Button>} background="grid" />
|
|
208
205
|
|
|
209
|
-
//
|
|
210
|
-
<CtaBanner title="Join 3M+ global traders" description="Open an account in minutes and start trading the world's markets." actions={<Button variant="inverse" href="/signup" tone="brand">Open account</Button>} />
|
|
206
|
+
// plain — the flat ground
|
|
207
|
+
<CtaBanner title="Join 3M+ global traders" description="Open an account in minutes and start trading the world's markets." actions={<Button variant="inverse" href="/signup" tone="brand">Open account</Button>} background="plain" />
|
|
211
208
|
```
|