← All proposals

Card Select

Add a shadow prop to the PDS Card Select.

Extends a PDS componentOpen in Storybook

proposals/CardSelect/HANDOFF.md150 lines · View on GitHub

Handoff: CardSelect

Rewritten 2026-11-20 against v2.0.0-beta.21 to the lessons template. This proposal had no section in docs/LESSONS-AUDIT.md; it was checked against L1 to L11 for this rewrite. Nothing in this file was checked by eye in a session; where a result is quoted from an earlier note it says so. Not tagged ready for dev.

What and why

The PDS Card Select with a shadow prop. Every card has a drop shadow today; in dense layouts and on surfaces that already carry elevation it is too heavy. shadow={true} (default) is the unchanged PDS look. shadow={false} removes the shadow and draws the card with a border in the input border color, a background tint on hover, and, when the radio indicator is hidden, a focus-color ring on the selected card. The proposal wraps the published CardSelect; PDS is not changed.

  • Figma: Card Select page in PDS-Proposals, with two real components: Card select item (set 665:265: Shadow On/Off x State Default/Hover/Selected x Show Indicator True/False, built like the library item with a placeholder slot and no text) and Card Select (666:213: a label and a row of three exposed cards). Jira: none. Source: a brief from the designer, 2026-11-03.
  • Context: context.md

Exploration and decisions

  • Wrap, not extend (in this repo). Same concept and role, only the look changes; the markup, radio inputs and keyboard behavior come from PDS. The port adds one prop and some CSS (see Port notes).
  • A border replaces the shadow. The PDS raised shadow already includes a 1px edge ring, so removing it alone leaves a white card invisible on a white surface. The border uses --pds-color-border-input, so a card reads like the other form controls.
  • Hover is the secondary Button hover. --pds-color-button-secondary-background-hover, layered over the card background (background-image), so the default, secondary and transparent backgrounds keep their fill.
  • The blue outline is saved for the no-indicator state. With the indicator, the check icon marks the selected card and the border stays; without it, the focus-color ring does.
  • Figma follows Storybook, not the PDS Figma library. The library Card select item pads 16 on all sides; the PDS code pads 20 and 24 (--pds-spacing-l, --pds-spacing-xl). The Figma item pads 20 and 24. Design: the library item should be updated to match the code.
  • The shadow is on the card. In Storybook shadow is a prop of CardSelect and applies to every card; in Figma Shadow is a property of the item and is set per card.
  • Figma indicator color is a token-bound fill on the library circle icon (semantic/border/input; the success fill on circleCheck), because the icon has no color property.
  • Show Indicator is a variant in Figma, not a boolean, because it changes the selected card's border as well as the circle.
  • Tried and not done: a prop on the card (the shadow is on each card, but the group is the API).

Full list: decisions.md.

API

From CardSelect.tsx. CardSelectProps extends the package CardSelectProps (a fieldset without onChange) and adds one prop:

Prop Type Default Purpose
shadow boolean true Show the drop shadow on each card. false: border in the input color, hover tint, and the focus ring on the selected card when showIndicator is false.

Everything else is the package CardSelect at beta.21, unchanged: background, className, defaultValue, id (required), imageVariant, label (required), labelDisplay, layout, onChange, options, padding, showCardLabels, showIndicator, size.

Variants and states: stories WithShadow, WithoutShadow, WithoutShadowOrIndicator, WithoutShadowLarge; unselected, hover, selected; keyboard focus (from the package).

Tokens used

From card-select.css as it is now:

  • --pds-border-width-default
  • --pds-color-border-input
  • --pds-color-button-secondary-background-hover
  • --pds-color-interactive-focus

The rest come from the package Card Select itself. No custom CSS variables and no raw values (the 0 offsets and spread of the ring are zero lengths).

Impact

From impact.md: nothing reaches existing components; the additions are scoped to .pds-card-select--no-shadow. No other proposal imports or uses this one. In the package, the Site Selection Cards pattern is built on CardSelect with showIndicator false; it does not set shadow, so it is unaffected. Port order and readiness: docs/PORT-ORDER.md (an extension of the package Card Select, not tagged ready for dev).

Reused vs net-new

  • Reused: the package CardSelect (unchanged), all its props and its tokens.
  • Net-new: the prop shadow and the modifier .pds-card-select--no-shadow (see custom.md).
  • Local stand-in: mergeClasses is imported from ../_base/Button/utils; the port uses @libs/components/utils.

Accessibility

  • The radio inputs, labels, legend and keyboard behavior are the package Card Select's: arrow keys move the selection between the native radios, and a focus ring (outline 2px, offset 2px) is drawn on the card when its radio is focused. This proposal does not change any of it; not tested here with a screen reader or in a browser.
  • What marks the selected card with shadow={false}: the check icon (indicator shown) or the focus-color ring (indicator hidden). The radio state is what assistive technology announces; the visual marks add nothing to announce and no new screen-reader text is introduced.
  • The unselected border (--pds-color-border-input) is oklch(0.8761 0 0) in light, which is about 1.45:1 against a white card (computed from the token, not measured in a browser), below the 3:1 usually asked of a control boundary. It is the same token the PDS inputs use, and the selected state does not rely on it. Noted for the designer; unchanged.
  • Recorded 2026-11-03 (not re-run for this rewrite): axe-core found no violations on all four stories in light and dark, computed styles of all stories in light mode, keyboard focus on the no-indicator story, and 375px width with no horizontal scroll. Not checked: dark-mode hover and ring colors by eye, and very long card text.

Decisions and open questions

Each has a recommended answer (the designer decides).

  • Should Card and ActionCard get the same option? They have the same raised shadow (card.css, action-card.css), and neither has a shadow prop in beta.21. Recommendation: raise it with the engineer as one decision for the three cards; if all three get it, name it the same on all.
  • Is the unselected contrast acceptable? Recommendation: yes for now, since it matches the PDS inputs and the selected state does not rely on it; revisit with the inputs if the border token changes.
  • Not built in the Figma item: Size, Disabled, background, padding, imageVariant, Show Card Labels (they exist in Storybook and the package component). Recommendation: leave them out; the item has no label, so Size would look the same.

Extension or new component

An extension of the existing PDS CardSelect (cards/CardSelect), not a new component. The proposal wraps it in this repo only so Storybook can show it; the engineer adds the prop to the real component. With shadow={true} (the default) the output is the package's, and the original stories (WithShadow here matches the package look) are untouched. Beta.21 CardSelect has no shadow prop and no --no-shadow class (target-version check below).

Footprint

Computed from card-select.css and the package CSS, not seen:

  • The border is inside the box. box-sizing is border-box, so the 1px border takes layout space from the card's content area (about 1px per side). With the shadow, the 1px edge was a box-shadow outside the box. Result: for the same outer size, the visible edge sits about 1px further in and the content about 1px further in than with shadow={true}. Cards in a row stay the same size; check a bleed image: it now starts inside the border, and its top corners use the card radius while the label's inner radius is a little smaller.
  • The selected ring leaves the box by 1px. With shadow={false} and showIndicator={false}, the ring is the 1px focus-color border plus a 1px box-shadow spread, so 1px is drawn outside the card. The package's own ring (--pds-border-width-outline, 2px spread) is 2px outside. A parent with overflow: hidden or tight padding can clip it; the card grid has a gap (pds-grid--gap-m), so neighbors do not touch.
  • The keyboard focus outline (2px, offset 2px) is drawn outside the card, unchanged from the package.
  • Hover with no shadow changes only background-image; the box does not move or resize.
  • Stacking and size: no position, z-index or size change is added. The card is full width of its grid cell and keeps overflow: hidden, which clips image and content to the radius.

Dark mode and per-size values

There is no per-theme CSS in this proposal; every color is a --pds-* token that changes with the theme. Values are from variables.light.css and variables.dark.css; none was seen on screen.

Value Light Dark
Unselected border border-input oklch(0.8761 0 0), 1px border-input oklch(0.4091 0 0), 1px
Hover tint rgba(0, 0, 0, 0.05) over the card fill rgba(255, 255, 255, 0.08) over the card fill
Selected ring (no indicator) interactive-focus oklch(0.59 0.1689 253.60), 1px border + 1px spread interactive-focus oklch(0.6800 0.1612 253.57), same widths
Card fill (package) card-background white card-background oklch(0.2178 0 0)
Shadow-on look (package) elevation-raised, elevation-overlay on hover the package's dark elevations, which include a lighter 1px edge

Per size and padding: this CSS has no per-size or per-padding values (single set of values for the border, tint and ring).

Value size="m" (default) size="l"
Card label font size size-m (package) size-l (package)
Indicator size 1.25rem (20px, package) 1.375rem (22px, package)
Border, tint, ring (ours) same as m same as m

Content padding (package): condensed 16px, standard 20px block and 24px inline, spacious 24px block and 32px inline; the 1px border sits inside it.

Expect to change

Each is a choice that may not match toolkit conventions, with a recommended answer.

  1. A default-on boolean named shadow (L2). Booleans in the toolkit are show*, is* or has*, and a default-on prop is a sign the shape is backwards. The sibling props showIndicator and showCardLabels are default-on and named show*. Recommendation: name it showShadow (default true) to match its siblings, or invert to a default-off flag (for example isFlat) if the engineer prefers; either way keep the default look unchanged. The prop name shadow is a recommendation to change, not a settled choice.
  2. One option on one card type (L1, L7). Card and ActionCard share the same shadow and have no such option. Recommendation: decide for all three cards together (see open questions) instead of adding it to CardSelect alone.
  3. The meaning of showIndicator changes with shadow (L11). With the shadow, showIndicator={false} gives ring plus raised elevation (package); without, ring only; with the indicator shown, no ring at all. Recommendation: keep, and document the two-prop interaction in the component docs.
  4. The doubled selector .pds-card-select__option-label.pds-card-select__option-label. It exists only to win over the package rules from outside. In the package the single selectors already win (.pds-card-select--no-shadow .pds-card-select__option-label has higher specificity than .pds-card-select__option-label). Recommendation: write single selectors after the existing rules, as in Port notes.
  5. Ring built from a border plus a spread (card-select.css:24-26). It is 2px in total but only 1px outside; the package ring is a 2px spread using --pds-border-width-outline. Recommendation: match the package ring (outline-width spread, no border-color change) unless the designer wants the inset look.
  6. Hover tint via background-image gradient. It layers a translucent token over any background-color. Recommendation: keep; the engineer may prefer a pseudo-element or color-mix, which is their call.
  7. Story-only parts (L9). The OPTIONS array, the id args and the WithoutShadowLarge story (a size state, not part of the change) are for review. Recommendation: the engineer keeps one shadow story and one no-indicator story and drops the large one.
  8. new-pattern tag on an extension. The stories carry tags: ['in-progress', 'new-pattern']; in the toolkit an extension of an existing component is not a v2-new component, though the new prop is new. Recommendation: no component-level v2-new tag; say it in the changelog.
  9. Required keys, screen-reader text, position props, unions: none added.

Target-version check

Checked 2026-11-20 against .pds-reference/src at v2.0.0-beta.21 and its CHANGELOG.mdx.

Item Already in beta.21?
shadow prop on CardSelect No. Props are background, className, defaultValue, id, imageVariant, label, labelDisplay, layout, onChange, options, padding, showCardLabels, showIndicator, size.
.pds-card-select--no-shadow No. The only elevation rules are elevation-raised, elevation-overlay (hover) and the no-indicator ring.
A shadowless option on Card or ActionCard No (card.css and action-card.css set elevation-raised; no prop).
showCardLabels, padding, background, labelDisplay Yes (in the source and in CHANGELOG.mdx, alpha.49 to alpha.54 entries).
Tokens border-input, button-secondary-background-hover, interactive-focus, border-width-default Yes, in the package token files.
Selected-card ring when showIndicator is false Yes: .pds-card-select--no-indicator .pds-card-select__option-label--selected (outline-width ring plus overlay elevation).

No CardSelect entry exists in CHANGELOG.mdx for beta.19 to beta.21; the beta.21 entry is a Table fix only.

Port notes

  • Existing component, in pds-toolkit-react under src/components/cards/CardSelect/.
  • Add the prop (name per "Expect to change", item 1) to CardSelectProps with TSDoc, and a ${baseClass}--no-shadow class to the class list next to noIndicatorClass.
  • Add the three .pds-card-select--no-shadow rules from card-select.css after the existing ones, as normal single selectors (no doubled label class), and keep the ring scoped to --no-indicator.
  • Update CardSelect.mdx and add a story. Add a changelog entry under [v2 Unreleased].
  • Delete the mergeClasses stand-in import; use @libs/components/utils.

Preview

npm run storybook, stories Component Proposals/Card Select. Figma: Card Select, page Card Select.