Files
xrpl-dev-portal/shared/patterns/ButtonGroup
Calvin 5021556c8e BDS component polish: link contrast, static cards, uniform CTAs, stacked hero (#3851)
* BDS component polish: link visibility, static cards, uniform CTAs

Component-level fixes and refinements across the 2026 brand components.

Accessibility / contrast
- StandardCard: pin description link colors. Every card variant has a light
  background in both themes, so theme-level link colors were wrong inside it —
  dark mode painted plain anchors white and BdsLink lilac-300, both of which
  wash out on a pale card. Links (including :visited) now use the card's own
  text color with an underline carrying the affordance; hover uses lilac-500,
  which clears 4.5:1 on all four card backgrounds.
- Breadcrumbs: point the open dropdown menu at the breadcrumb color tokens so
  the trail, trigger, and menu read as one color in both themes, and give dark
  mode gray-6 (7.41:1, matching light mode's 7.23:1).

Interaction
- CardOffgrid: drop every hover affordance when a card has neither href nor
  onClick. Static cards no longer get a pointer cursor, the color-wipe overlay,
  or a pressed state — the tokenization and trading carousels pass link-less
  cards and were advertising a click target that did not exist.
- CarouselFeatured: add a 'fade' transition alongside the default 'slide', for
  decks whose slides share a heading. Inactive slides are now inert, keeping
  focus and pointer events out of them in both styles.
- Add a bds-reduced-motion mixin so components can collapse motion to an
  instant state change.

Design consistency
- ButtonGroup: add forceVariant and forceNoPadding overrides, letting a section
  opt out of the count-based variant defaults and render one uniform treatment.
  Existing consumers are unaffected.
- FeatureTwoColumn: render every link as a tertiary button regardless of count,
  flush with the title and description.
- CardImage: render an all-bullet subtitle as a real <ul> so wrapped text hangs
  under the first character and screen readers announce it as a list.
- docs: give the node-installation card descriptions a paragraph break before
  their "Learn More" link.

Dependencies
- Bump @codemirror/state and view, add lang-javascript, lang-json, and lint,
  with overrides pinning state/view to one copy.

Docs updated alongside each component. Built CSS regenerated with the
production script to match the committed artifact's minified format.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* ButtonGroup: don't strip padding from forced filled variants

`noPadding` was derived as `forceNoPadding || isMultiButton`, which was safe
while the 3+ block layout was always tertiary. `forceVariant` also accepts
`primary` and `secondary`, so a 3-button group forcing a filled variant had
`padding: 0 !important` (Button.scss) applied with no way to opt out.

Tie the implied no-padding to the resolved variant being tertiary. Behavior is
unchanged for every caller that doesn't pass `forceVariant`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Stacked hero variant, fade-by-default carousel, component docs

Layout
- HeaderHeroPrimaryMedia: add a `stacked` prop that puts the headline, subtitle,
  and buttons in one column (full width at base, 7/8 at md, 9/12 at lg) instead
  of the default headline-left / CTA-right split. The headline and CTA block
  bottom-align against each other in the two-column layout, so the stacked
  variant undoes that. Both arrangements now share the same headline and CTA
  elements, so they can't drift apart. Used on the docs landing hero.

Motion
- CarouselFeatured: make `fade` the default transition. Slides that share a
  heading are the common case, and a horizontal wipe drags the identical heading
  across the screen only to set it back down. `slide` is now opt-in for decks
  whose panels are genuinely distinct. Nudge the crossfade to 260ms in / 200ms
  out. The home page carousel opts into fade explicitly; developer-funding now
  inherits it.

Fixes
- CardTextIconCard: pass `headingAs` through to `cardContent`, which was
  accepting the prop but never receiving it.

Docs
- Expand the Button, CardImage, CardTextIcon, PageGrid, CalloutMediaBanner,
  LogoSquareGrid, and HeaderHeroPrimaryMedia references.

Built CSS regenerated with the production script.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 16:49:10 -07:00
..

ButtonGroup Component

A responsive button group container that automatically assigns button variants based on the number of buttons passed. Stacks vertically on mobile and horizontally on tablet+.

Features

  • Auto-Variant Assignment: Automatically assigns Primary/Tertiary/Secondary variants based on button count (override with forceVariant)
  • Responsive Layout: Vertical stack on mobile, horizontal row on tablet+ (for 1-2 buttons)
  • Block Layout: 3+ buttons render as all tertiary in a vertical block layout
  • Customizable Spacing: Control gap between buttons on tablet+ (none or small)
  • Theme Support: Green or black color themes
  • Max Buttons Limit: Optionally limit the number of buttons rendered

Button Behavior

The component automatically determines button variants based on count:

Count Behavior
1 button Renders as Primary (or Secondary with singleButtonVariant="secondary")
2 buttons First as Primary, second as Tertiary (responsive layout)
3+ buttons All as Tertiary in block layout (vertical on all screen sizes)

Overriding the variant

Pass forceVariant when a section's design calls for one uniform treatment no matter how many buttons it receives. It supersedes both the count-based defaults and singleButtonVariant; layout (inline vs. block) still follows the count.

When forcing tertiary at 1-2 buttons, pair it with forceNoPadding so the labels sit flush with the surrounding text instead of being indented by the button's horizontal padding. (The 3+ block layout is always flush, so it sets this for you.)

<ButtonGroup
  buttons={[{ label: 'Learn More', href: '/learn' }]}
  forceVariant="tertiary"
  forceNoPadding
/>

FeatureTwoColumn is the reference consumer of this.

Usage

import { ButtonGroup } from 'shared/patterns/ButtonGroup';

// Single button (Primary by default)
<ButtonGroup
  buttons={[
    { label: "Get Started", href: "/start" }
  ]}
  color="green"
/>

// Single button as Secondary
<ButtonGroup
  buttons={[
    { label: "Learn More", href: "/learn" }
  ]}
  singleButtonVariant="secondary"
  color="green"
/>

// Two buttons (auto: Primary + Tertiary)
<ButtonGroup
  buttons={[
    { label: "Get Started", href: "/start" },
    { label: "Learn More", href: "/learn" }
  ]}
  color="green"
/>

// Three or more buttons (auto: all Tertiary, block layout)
<ButtonGroup
  buttons={[
    { label: "Documentation", href: "/docs" },
    { label: "API Reference", href: "/api" },
    { label: "Tutorials", href: "/tutorials" }
  ]}
  color="black"
/>

// Limit to 2 buttons even if more are passed
<ButtonGroup
  buttons={[
    { label: "First", href: "/first" },
    { label: "Second", href: "/second" },
    { label: "Third (not rendered)", href: "/third" }
  ]}
  maxButtons={2}
  color="green"
/>

Props

Prop Type Default Description
buttons ButtonConfig[] required Array of button configurations
color 'green' | 'black' 'green' Button color theme
forceColor boolean false Force color to remain constant across light/dark modes
gap 'none' | 'small' | 'medium' 'small' Gap between buttons: none/small are 0px/4px on tablet+; medium is 16px through tablet, 24px at lg+
singleButtonVariant 'primary' | 'secondary' 'primary' Variant for single button
forceVariant 'primary' | 'secondary' | 'tertiary' - Force every button to this variant, overriding the count-based defaults and singleButtonVariant
forceNoPadding boolean false Strip button padding and left-align labels (always on for the 3+ block layout)
maxButtons number - Maximum number of buttons to render
className string '' Additional CSS classes

ButtonConfig

interface ButtonConfig {
  label: string;
  href?: string;
  onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
  forceColor?: boolean;
}

Responsive Behavior

  • Mobile (<768px): Buttons stack vertically with 8px gap, aligned to start
  • Tablet+ (≥768px): Buttons align horizontally, centered, with configurable gap (0px or 4px)

CSS Classes

  • .bds-button-group - Base component
  • .bds-button-group--gap-none - No gap on tablet+ (0px)
  • .bds-button-group--gap-small - Small gap on tablet+ (4px)