← All proposals

Feedback Bar

A small atomic component: a thumbs-up and thumbs-down pair with one piece of state, built from the local IconButton (its existing isPressed toggle, which maps to aria-pressed).

Net-new componentOpen in Storybook

proposals/FeedbackBar/HANDOFF.md151 lines · View on GitHub

Handoff: FeedbackBar

Rewritten 2026-11-20 against v2.0.0-beta.21 to the lessons template. Every prop, class and token below was checked against FeedbackBar.tsx, feedback-bar.css and the stories as they are now. Nothing here was checked by eye in a session.

What and why

Thumbs up and down for rating agent output. The same control belongs in several places (under a chat reply, in a Suggestion Card, under a Chain of Thought or a Code Diff), and without a component each screen builds its own pair with its own labels, pressed state and spacing. It is UI only: it reports up, down or null and does nothing else; what the screen does with the signal (analytics, a reason, a thank-you) is not decided. Built from the local IconButton. Figma: Feedback bar page (the designer's hand-built component set; it replaced the first capture). Context: context.md.

Exploration and decisions

  • Its own atomic component, not part of Chat Message or Suggestion Card, which stay slot-based; the screen places the bar.
  • UI only: no analytics, no reason flow, no copy. The screen sends the choice with the context that makes it useful.
  • Built from the existing IconButton (isPressed maps to aria-pressed); pressing the chosen thumb again clears it. No solid thumb icon exists, so pressed uses the IconButton's pressed styling.
  • One look, the bare thumbs. A bordered prompt-bar look with a dismiss button was built, then removed at the designer's request.
  • No text hardcoded, and wording must not promise an outcome (the team has not decided what feedback is for).
  • statusLabel replaces the thumbs, in Copy XS and the secondary color, in a role='status' element that is always rendered. The thumbs and the status text fade in when they swap (off with prefers-reduced-motion).
  • Top-level in the sidebar, not under AI Chat: nothing in it is chat-specific.

Full list and reasons: decisions.md.

API

FeedbackBar (a div with role='group'; extends div props except onChange; the rest are spread onto the root after aria-label and role, so a consumer prop would override them):

Prop Type Default Purpose
children ReactNode none Extra actions after the thumbs (for example copy or retry). Hidden while statusLabel is set.
className string none Additional class names.
downLabel string none (required) Screen-reader text and tooltip of the thumbs-down button.
groupLabel string none (required) Name of the group (aria-label), read by screen readers (for example "Rate this response").
onValueChange (value: 'down' | 'up' | null) => void none Called with the new choice; pressing the chosen thumb again passes null.
statusLabel string none Replaces the thumbs (and children) with text (for example a thank-you), in a role='status' element.
upLabel string none (required) Screen-reader text and tooltip of the thumbs-up button.
value 'down' | 'up' | null null The current choice. Controlled only: there is no defaultValue.

Exported types: FeedbackValue, FeedbackBarProps.

Variants and states: no choice, thumbs up chosen, thumbs down chosen, status text, with extra actions. Stories: Interactive, AllStates.

Story-only helpers (the engineer drops these, L9): InteractiveFeedbackBar (keeps value and a 4.5 second THANKS_MS timer in state, so the status shows and then the thumbs return) and the feedback-bar-story__* classes in feedback-bar-story.css; the EXAMPLES and LABELS arrays; the package ClipboardButton and the rotate retry button in the "With extra actions" example. The timing is the screen's, not the component's.

Tokens used

From feedback-bar.css as it is now:

  • --pds-animation-duration-reveal
  • --pds-animation-timing-function-default
  • --pds-color-foreground-default
  • --pds-color-foreground-default-secondary
  • --pds-spacing-2xs

The check tool also lists --pds-spacing-l; that comes from feedback-bar-story.css (story layout only), not the component. The thumbs' own tokens (size, border, pressed fill, focus) belong to IconButton.

Impact

From impact.md: no existing PDS component is reached and no --pds-* token is redefined. The generated report says no other proposal imports it. In fact SuggestionCard (SuggestionCard.stories.tsx, in actionsEnd) and ChatWithAgent (ChatWithAgent.stories.tsx) import it, and Chat Panel's sample content uses it, so port FeedbackBar before them. (The generator misses story imports; not changed here.)

Reused vs net-new

  • Reused: the local IconButton (two toggles at size s, unchanged; port with IconButton and Icon, which are ready), the icons thumbsUp and thumbsDown, the semantic pds-copy-xs class. In stories only: the package ClipboardButton for the copy action.
  • Net-new: .pds-feedback-bar, __actions, __status; all props; one keyframe, pds-feedback-bar-fade-in. No custom CSS variables and no raw values. Details in custom.md.

Accessibility

Nothing here was run: the a11y panel has not been run, and light and dark were not checked by eye. What the code does, and two gaps found while rewriting this section:

  • A role='group' named by groupLabel, with two toggle buttons (aria-pressed from isPressed), each named by upLabel or downLabel and with a tooltip; keyboard operability and focus styles come from the IconButton. The labels stay the same when the state changes, so the pressed state is carried by aria-pressed alone.
  • The status text is in a role='status' element that is always rendered. Gap 1: when it is empty it has display: none (.pds-feedback-bar__status:empty). Elements with display: none are generally out of the accessibility tree, so whether a screen reader announces the text when it appears is not verified; the earlier handoff said it is announced because it stays in the DOM. Recommendation in Expect to change 2.
  • Gap 2: when statusLabel is set, the thumbs (and children) are removed from the DOM, not hidden. If a thumb has focus when the user presses it, that element unmounts and focus falls back to the document. The screen should decide where focus goes; neither the component nor the docs said so before. When the status ends the thumbs mount again as new elements. Recommendation in Expect to change 3.
  • Motion: the fade is off under prefers-reduced-motion.
  • Do not announce twice: the status text is the one announcement of the choice; the screen should not add its own live region for the same message.

Decisions and open questions

Each carries a recommended answer (a recommendation, not a decision; the designer or engineer decides).

  • What is the signal used for, and who owns it (analytics, ML)? It decides whether a reason after thumbs-down is needed, and whether the screen needs a plain disclosure. Recommendation: not a blocker for the port; the component stays UI only and the screen wires onValueChange.
  • A filled (solid) thumb for the pressed state. The icon set has none (thumbsUp and thumbsDown only). Recommendation: do not add an icon; the IconButton's pressed styling (fill with the border color plus an inner elevation) already marks it. Whether it reads clearly is not checked, light or dark.
  • Extra actions (copy, retry) with their own component, a message actions bar? Recommendation: not in this port; children is enough until a second screen needs the same set.
  • Size s of the thumbs. Fixed in code (size='s', 32px, spacing-button-height-s), no prop. Recommendation: keep it fixed; do not add a size prop (L11).
  • Name and placement. The bar is top-level in the sidebar, not under AI Chat. Recommendation: put it in a buttons or generic category folder rather than a chat folder.

Extension or new component

New component, built by composition: it is two IconButton toggles in a labelled group plus a status text, and it adds no new look to IconButton. It is not an extension of IconButton: it needs the pairing logic (choosing one unpresses the other, pressing it again clears it), the group label and the status region, which do not belong on a single button. It does not extend ClipboardButton or any other component. The package at beta.21 has no rating or feedback component (checked). Not verified: whether the engineer would rather ship it as a recipe (IconButton pair in a screen) than as a component; recommendation: component, because the same pair appears in at least three places.

Footprint

Nothing the component draws sits outside its box. What a parent could clip or size wrongly:

  • Focus ring. The IconButton draws its :focus-visible outline outside its border box (.pds-icon-button:focus-visible in icon-button.css), and the bar has no padding. A parent with overflow: hidden right at the bar's edge can clip the ring. Computed from the CSS, not checked by eye.
  • Tooltips are portaled to the body (PDS Tooltip), so a clipping parent does not cut them.
  • Height changes when the status shows. The thumbs are 32px high (spacing-button-height-s), and the status is one line of pds-copy-xs, so the bar gets shorter while the status shows and taller when the thumbs return. A parent that does not reserve the height will shift content below the bar. There is no min-height.
  • The bar is display: flex and takes the width of its parent; it sets no width of its own. The __actions wrapper is a flex row with an spacing-2xs (8px) gap; extra children join that row and are not wrapped.

Dark mode and per-size values

Single size: the thumbs are fixed at IconButton s, and the CSS has no per-theme override. The only colors the bar sets are two semantic tokens that the theme files redefine (values from variables.light.css and variables.dark.css; how they look is not checked).

Part Value Light Dark
Bar color (inherited by thumbs' text) foreground-default oklch(0.2178 0 0) oklch(0.9702 0 0)
Status text color foreground-default-secondary, class pds-copy-xs oklch(0.4778 0.0020 247.87) oklch(0.8452 0 0)
Thumb size IconButton s = spacing-button-height-s (spacing-2xl, 32px) same same
Gap (thumbs and extra actions) spacing-2xs (8px) same same
Fade animation-duration-reveal (300ms), animation-timing-function-default same same
Pressed thumb IconButton's: fill and border from --icon-button-border, --pds-elevation-icon-button-pressed owned by IconButton owned by IconButton

Pressed-state contrast in dark (the audit's open item): not checked; it is the IconButton's own styling.

Expect to change

Each choice below breaks, or may break, a toolkit convention. The answer in italics is a recommendation.

  1. Three required label props (L2, L3). upLabel, downLabel and groupLabel are required strings with no dev warning. They are top-level and translatable (good). Recommendation: make them optional and add a [FeedbackBar] warning under process.env.NODE_ENV !== 'production' when one is missing, as Button does; keep them separate props, because each names a different element.
  2. Always-rendered status region hidden with display: none when empty. The announcement depends on it (see Accessibility, gap 1). Recommendation: keep the role='status' element rendered and hide it with the visually-hidden pattern, or empty-but-not-display: none, so it stays in the accessibility tree; then test with VoiceOver and NVDA. Not tested.
  3. Thumbs removed from the DOM while the status shows (focus is lost). Recommendation: keep the thumbs mounted and hide them (hidden or inert) while the status shows, or document that the screen moves focus; the first costs nothing in the API.
  4. value is controlled only (L2). No defaultValue. Recommendation: keep it controlled; the screen owns the choice and the timing.
  5. Timing and the status swap are the screen's. The component swaps on statusLabel only; the 4.5 second timer lives in the story (L9). Recommendation: keep it out of the component; do not add a statusDuration prop.
  6. children for extra actions. An open slot inside a rating component. Recommendation: keep, and say in TSDoc that it is hidden while statusLabel is set.
  7. Spread props can override role and aria-label. {...props} comes after them. Recommendation: keep {...props} last (convention) and note in TSDoc that role and aria-label should not be overridden; the group name comes from groupLabel.
  8. Fade-in also plays on first mount. The keyframe is on __actions and __status, so it runs when the bar first renders, not only on a swap. Recommendation: confirm that is wanted; otherwise play it only after a swap.
  9. Local mergeClasses import from _base/Button/utils. Recommendation: use @libs/components/utils.

Target-version check

Checked in .pds-reference/src at v2.0.0-beta.21 (and CHANGELOG.mdx). The changelog has no entry for a feedback or rating component.

Item In beta.21? Notes
A feedback or rating component no none in src/components
IconButton isPressed (maps to aria-pressed) and size='s' yes buttons/IconButton/IconButton.tsx
Icons thumbsUp, thumbsDown yes icons/Icon/generated-icon-data.ts
A solid (filled) thumb icon no only thumbsUp and thumbsDown exist
ClipboardButton (story only; swaps copy to check) yes buttons/ClipboardButton
Icon rotate (story only) yes generated-icon-data.ts
Class pds-copy-xs yes typography styles
Tokens animation-duration-reveal, animation-timing-function-default, color and spacing tokens yes pds-design-tokens variables.global.css and theme files
mergeClasses yes in source @libs/components/utils; the published package does not export it
--pds-elevation-icon-button-pressed (IconButton pressed) referenced used in the package icon-button.css; value not checked

Not verified: that the local IconButton wrapper adds nothing this component relies on beyond isPressed, size and ariaLabel.

Port notes

Would live in src/components/ (a buttons or generic category folder, not a chat folder; generator npm run generate:component). Not yet matching v2: the local mergeClasses (from _base/Button/utils, use @libs/components/utils) and the local IconButton (use the ported one, or the package one). pds-copy-xs is !important, so a rule on the same element cannot override size or weight. Port before SuggestionCard, ChatWithAgent and anything else whose stories import it.

Preview

npm run storybook, story Component Proposals / Feedback Bar. Figma: https://www.figma.com/design/AMGWJbraJoi2PKWnxo29Ah/PDS-Proposals?node-id=291-6854