Handoff: SuggestionCard
Rewritten 2026-11-20 against v2.0.0-beta.21 to the lessons template. Props, defaults, classes and tokens were checked against SuggestionCard.tsx, suggestion-card.css and the stories as they are now. Nothing here was checked by eye in a session, and the a11y panel was not run.
What and why
An agent's proposed changes in a conversation, with the buttons to decide. When an agent proposes a change in a chat (for example edits to page copy), the user needs to see what would change and accept it, ask for something different, or dismiss it. PDS has no component for this, and it is not a variant of the agentic Panel (that is a full-width report on a page; this is a decision prompt in the message stream). Built on the PDS Panel. Includes SuggestionChange, an optional before/after row. A type='choice' option (added 2026-10-21) makes it a multiple choice card: header, a PDS panel list of radio or checkbox rows (SuggestionChoice), and the footer. Figma: Suggestion card page (the designer's hand-built component set; it replaced the first capture). Context: context.md.
Exploration and decisions
- Before and after as a stacked diff (2026-10-21), now the Content Diff component: the two uppercase columns were replaced by one bordered block under the field name: the old value on a red line with a minus, the new value on a green line with a plus. Long text gets the full width, and the "Before" and "After" words are hidden text for screen readers.
- An Other option (2026-10-21):
SuggestionChoicetakeschildrenunder its label, used for a text field. The card does not know about it; the screen enables or selects it (the stories select Other when the field is focused). - Retry and browse is a recipe, Regenerate a suggestion, not part of the card: it fills the existing footer slots.
- The Interactive story shows all three kinds working (changes, single choice, multiple choice). After Accept the Feedback Bar shows and, once a thumb is pressed, "Thanks for the feedback" stays (the screen owns the rating).
- Own component, not a variant of the agentic Panel: different anatomy and lifecycle (the card outlives the decision in the history).
- Built on
Panel(default variant,condensedpadding: the card sits in the narrow chat column, wherestandardleaves too little room for the changes) for border, radius and surface; one inner wrapper so Panel's first-child heading rules do not resize the title. - The content area is a slot (
children);SuggestionChangeis an optional helper. Two optional footer slots:actionsStart(decision buttons) andactionsEnd(for example a Feedback Bar, shown in every state). - Multiple choice (
type='choice', 2026-10-21): the same header, footer slots and states, but the card has no padding of its own: padded header and footer sections divided from a PDSPanelListby lines edge to edge. Rows areSuggestionChoice(aPanelRow): a PDS Checkbox or a PDS-styled radio with a label and a description. The screen owns the selection and what the footer button does. One component with atypeprop rather than a second one, so the header, footer and states are shared. - Three states:
pending,acceptedanddismissed. A finished state replacesactionsStartwith a result line in arole='status'region that is always in the DOM, so it is announced. Dismissed also hides the changes and leaves room for an Undo inactionsEnd. buttonSizeremoved (2026-11-20). It clonedsizeonto children withchild.type === Button, which only works with the local Button and would break when the port swaps imports. The screen now setssize='xs'on eachButtoninactionsStartitself (every story does), so the buttons render at the same size as before (the old default wasxs).- Title is the PDS
pds-heading-m(orl) class and the descriptionpds-copy-s, secondary color;headingLevelonly sets the tag. - No Feedback Bar on a dismissed card in the design (a dismiss is already a signal; nothing was applied to rate).
Full list and reasons: decisions.md.
API
SuggestionCard (a Panel, so a div; extends div props except title). Props are alphabetical:
| Prop | Type | Default | Purpose |
|---|---|---|---|
actionsEnd |
ReactNode |
none | Right end of the footer, shown in every state (for example a Feedback Bar). |
actionsStart |
ReactNode |
none | Decision buttons at the left of the footer; shown while pending, replaced by statusLabel once accepted or dismissed. The screen sets the button size (xs in a chat). |
children |
ReactNode |
none | The content: SuggestionChange (or any content) for changes, SuggestionChoice rows for choice. Hidden when dismissed. |
className |
string |
none | Additional class names. |
description |
ReactNode |
none | Short summary of what is suggested. |
headingLevel |
'h2'-'h6' |
'h3' |
Tag of the title, to fit the page outline. |
headingSize |
'm' | 'l' |
'm' |
Size of the title text (16px / 18px). |
padding |
Panel's padding |
'condensed' |
Same options as Panel. Default differs from Panel (standard) because the card sits in the narrow chat column. Not used by choice. |
state |
'pending' | 'accepted' | 'dismissed' |
'pending' |
Where the suggestion is. |
statusLabel |
string |
none | Result text for accepted and dismissed; announced when it appears. Optional, with a development warning when the state is not pending and it is missing. |
title |
string |
none (required) | What is suggested (for example "2 changes"). |
type |
'changes' | 'choice' |
'changes' |
choice is multiple choice: the children are SuggestionChoice rows in a PDS panel list. padding does not apply to it. |
SuggestionChange (a div: the field name above a ContentDiff): after, before and label (required), afterLabel and beforeLabel (optional since 2026-11-20, screen-reader text only, not shown; a development warning fires when either is missing), plus className. When a label is missing it is passed to ContentDiff as an empty string (ContentDiff still types both as required strings), so the visually hidden dt is empty: pass them.
SuggestionChoice (one row of a choice card): id and label (required), selectionType ('radio' or 'checkbox', required), children (shown under the label, for example a text field for an Other option), description, name (shared by the radios of one question), checked / defaultChecked, disabled, onChange, value, className.
Removed 2026-11-20: buttonSize.
Variants and states: type changes / choice; pending, accepted, dismissed; padding and heading options. Stories: Default, Accepted, Dismissed, Choice Slots, Choice Radio, Choice Checkbox, Interactive (the changes card and both choice cards, working). The Default and slot stories use SlotPlaceholder from _story-helpers; it is story-only and the engineer can drop it.
Tokens used
From suggestion-card.css as it is now (the diff colors moved to ContentDiff; type comes from pds-heading-* and pds-copy-* classes):
--pds-border-width-default--pds-color-border-default--pds-color-foreground-default-secondary--pds-color-status-success-foreground--pds-spacing-2xs--pds-spacing-5xs--pds-spacing-l--pds-spacing-m--pds-spacing-s--pds-spacing-xs--pds-typography-fw-medium--pds-typography-fw-semibold--pds-typography-size-xs
The earlier list also had --pds-color-status-critical-foreground, --pds-typography-fw-bold, --pds-typography-ls-l and --pds-typography-size-2xs; the CSS no longer uses them (stale).
Impact
From impact.md: no existing PDS component is reached and no --pds-* token is redefined. No other proposal imports or uses SuggestionCard by code (the Chat with an agent recipe and the Chat Panel's stories show it in a conversation).
Reused vs net-new
- Reused: PDS
Panel,PanelListandPanelRow(the choice rows), the PDSCheckbox(checkbox rows), the package's.pds-radio-group__optionclass (to style the radio rows), the localIconwrapper (check,circleMinus), the semanticpds-heading-*andpds-copy-sclasses. The proposalContentDiff(../ContentDiff/HANDOFF.md, ready) is imported bySuggestionChangeand is a dependency: it ports first. The proposalFeedbackBar(../FeedbackBar/HANDOFF.md) is composed in the stories (inactionsEnd), not imported by the component. The localButtonis used only in stories. - Net-new:
.pds-suggestion-card(--accepted,--dismissed,__actions,__actions-end,__body,__changes,__description,__footer,__footer--empty,__heading,__result,__result-icon,__title; forchoice:--choice,__choices,__section,__section--header,__section--footer) and.pds-suggestion-choice(__control,__description,__label,__name,__text) and.pds-suggestion-change(__field; the diff itself is the Content Diff); all props; custom CSS variables--suggestion-card-gapand--suggestion-card-actions-gap. No raw values kept. Details incustom.md.
Accessibility
- The result line sits in a
role='status'region that stays in the DOM while empty, so "Changes applied" or "Dismissed" is announced when it appears. - Choice rows: each row is a labelled native input (the PDS Checkbox, or a radio in a label), with the description linked by
aria-describedby. The list isrole='group'labelled by the title. Radios in one question share aname, so arrow keys move between them. The screen owns which is selected. - The title is a real heading; set
headingLevelto fit the outline. Before and after are adlwith visually hiddendtnames ("Before", "After"), and the minus and plus icons carry the meaning too, so it does not depend on color alone. - Focus: the card does not manage it. When Dismiss disappears the screen should move focus to Undo, and back to Dismiss after Undo (the stories use
autoFocus). afterLabel,beforeLabelandstatusLabelare the screen-reader strings; they are translatable top-level props on the card or the change, not fields inside another component's props.statusLabelis both the visible and the announced text.- The a11y panel has not been run, and light and dark were not checked by eye in a session.
Decisions and open questions
Each has a recommended answer (a recommendation, not a decision).
- Feedback Bar is composed in the stories (in
actionsEnd); it is ready for dev and in the port order before this card. The card works without it, sinceactionsEndis a slot. Recommendation: keep it a slot. - Radio rows. PDS has no standalone Radio (
RadioGrouprenders a whole group; checked insrc/components/inputsat beta.21), so the radio rows borrow the package's.pds-radio-group__optionclass. Recommendation: accept the borrowed class for this port; do not block on a standalone Radio. Port a standalone Radio first only if the engineer wants one anyway. - Selection. Only the label (not the empty space in the row) is the click target. Should the card know the selection (for example to disable the confirm button until something is picked)? Recommendation: stay the screen's.
- Accept style. A plain primary button here; the report panel's Approve is agentic. Recommendation: plain primary; use the gradient only for a card that applies something to the site, decided by the screen.
- A pending card the conversation moved on from: is a "superseded" or "expired" state needed? Recommendation: not for the first port.
- Refine: what it does is the screen's (focus the composer, open a field). Recommendation: leave it with the screen.
- Many changes: no height cap or scroll; the chat scrolls. Code-diff changes are not built here (the recipe
Chat with an agentcomposes a Code Diff in the card). Recommendation: no cap yet. - Should the card own spacing between its children, or only the frame? Recommendation: only the frame, as now (the screen composes the changes).
- Convention questions (
type,padding, the optional labels, the borrowed radio class) are under Expect to change.
Extension or new component
New component, not an extension. It is built on the package Panel for the border, radius and surface, but it is not a Panel variant: the anatomy (title, changes or choice rows, decision footer) and the lifecycle (the card outlives the decision, in the history) are different from the agentic Panel, which is a full-width report on a page. The human behavior of Panel is untouched.
Footprint
- Nothing draws outside the card.
- For
type='choice'the card has no padding of its own (padding='none'on thePanel): the header and footer are padded sections and thePanelListrows run edge to edge between them, divided by lines (suggestion-card.css,.pds-suggestion-card__sectionand.pds-suggestion-card__choices). The__choiceslist setsborder-radius: 0, so the rows are square and the card's radius comes from thePanel. Because the header sits above the first row and the footer below the last, a row's hover or focus fill does not reach a rounded corner; this follows from the structure and was not checked by eye. Thepaddingprop is ignored forchoice. - A parent that clips overflow could cut the focus ring on the choice rows at the card edge (the rows touch the left and right edges). Not checked.
- A dismissed choice card has no rows, so the header and footer sections each carry their own line.
- The footer wraps on a narrow card (the buttons and
actionsEnd).
Dark mode and per-size values
Single size. There are no per-theme overrides: colors are semantic tokens (--pds-color-border-default, --pds-color-foreground-default-secondary, --pds-color-status-success-foreground), and the diff colors come from ContentDiff. Light and dark were not checked by eye.
| Item | Value | Source |
|---|---|---|
Card padding (changes) |
condensed by default, any Panel option |
padding prop |
Card padding (choice) |
none; sections --pds-spacing-m / --pds-spacing-l |
CSS |
| Gap between sections | --pds-spacing-s (--suggestion-card-gap) |
single size |
| Space above the buttons | --pds-spacing-m (--suggestion-card-actions-gap) |
single size |
| Title and description gap | --pds-spacing-xs |
single size |
| Title size | m (16px) or l (18px) |
headingSize |
| Button size | set by the screen; xs in the stories |
screen |
Expect to change
Each is a choice that breaks, or may break, a toolkit convention, with a recommended answer (recommendations, for the designer and engineer to confirm).
- One component with
type(changesorchoice). It changes the padding rule, the children contract and the markup. Recommendation: keep one card (the header, footer and states are shared) and document thepaddingexception, as done in the TSDoc and the.mdx. The engineer may splitchoiceinto its own component. paddingdefaultcondensed, unlikePanel'sstandard; a knob with one right value? Recommendation: keep the default and the prop. The card sits in the narrow chat column, wherestandardleaves too little room for the changes. The engineer may drop the prop and fixcondensed.buttonSizewas removed (see Exploration). Nothing to decide.- Screen-reader labels optional.
beforeLabel,afterLabelandstatusLabelare optional with a development warning (process.env.NODE_ENV !== 'production', the pattern the package'sButtonuses), not required. Recommendation: keep. SuggestionChoicehas a requiredselectionType. Recommendation: keep; it picks the control, and a default would hide a required choice.- Borrowed
.pds-radio-group__optionclass: accept for now (see open questions). - Accept style: plain primary (see open questions).
Target-version check
Checked against .pds-reference at v2.0.0-beta.21.
Panel(padding, defaultstandard),PanelList(hasBorder,paddingSize),PanelRow(items-leftslot) andCheckbox: exist.- A standalone Radio: does not exist (
src/components/inputshasRadioGrouponly)..pds-radio-group__optionexists inradio-group.css. - The icons
check,circleMinusexist;minusandplusare used byContentDiff(not re-checked here). SuggestionCard,SuggestionChange,SuggestionChoice,ContentDiff,FeedbackBar: not in the package; nothing in the CHANGELOG up to beta.21 adds them.- The development-warning pattern exists in the package (
Button.tsx,Table.tsx).
Port notes
Would live in src/components/ (a chat or conversation category folder; generator npm run generate:component), built on Panel. Port ContentDiff first (imported by SuggestionChange); FeedbackBar is only used in stories but is in the port order before this card. Not yet matching v2: the local mergeClasses stand-in (use @libs/components/utils); the local Icon wrapper (use the ported Icon); pds-copy-s and pds-heading-* are !important, so a rule on the same element cannot override size or weight. The Button in the stories is the local wrapper; the screen sets its size.
Preview
npm run storybook, story Component Proposals / AI Chat / Suggestion Card.
Figma: https://www.figma.com/design/AMGWJbraJoi2PKWnxo29Ah/PDS-Proposals?node-id=300-7510