← All proposals

Icon Button

Starting point for an IconButton proposal.

Extends a PDS componentOpen in Storybook

proposals/IconButton/HANDOFF.md149 lines · View on GitHub

Handoff: IconButton (agentic and primary variants, working, 2xs)

Rewritten 2026-11-20 against v2.0.0-beta.21 to the lessons template.

What and why

Three independent additions to the v2 IconButton, so each can ship alone (see "Three parts" below):

  1. variant='agentic': the AI gradient as the border, for an action the agent does.
  2. variant='primary' + isWorking + the stop icon: the Send button of a composer (filled like a primary Button, a spinner while working, a stop icon to stop a response).
  3. size='2xs': a 24px box for dense rows (Agent Tree tool icons).

Everything else is the v2 IconButton, so the port is a diff against src/components/buttons/IconButton. The separate SendButton proposal was removed on 2026-10-21; Send is a primary icon button.

Exploration and decisions

  • variant='agentic' (2026-10-21). An extension of the Icon Button, like Send. It replaced an isAgentic boolean (superseded; the old bullets in decisions.md are folded under a note).
  • Send is a primary icon button (2026-10-21). Its three states are made from props: iconName='paperPlane' (send), isWorking (spinner) and iconName='stop' (stop).
  • 2xs (2026-11-18). 24px is the smallest box that meets the WCAG 2.2 minimum target size.
  • Spinner from the package (2026-11-20). isWorking uses the package Spinner with color='currentColor'; the local Spinner proposal is no longer a dependency.
  • Technique (agentic): a transparent border with the gradient on the border-box and the fill on the padding-box, over an opaque surface layer. The fill is a custom property (--icon-button-fill) so hover, active and pressed can swap it. Pressed uses the secondary active background instead of v2's border-color fill, which a gradient cannot provide.

API

All other props are unchanged from v2. The three additions, one per part:

Prop Type Default Part Purpose
variant adds 'agentic' 'standard' 1 The AI gradient border (--pds-gradient-ai-active). Always bordered; hasBorder does not apply.
variant adds 'primary' 'standard' 2 Filled like a primary Button, for the main action of a toolbar (Send). hasBorder does not apply.
isWorking boolean false 2 A spinner replaces the icon; the button is disabled and has aria-busy. The caller changes ariaLabel with the state.
size adds '2xs' 's' 3 A 24px box (--pds-spacing-xl) with a 14px (s) icon. The s Spinner is the smallest, the tooltip offset is 4.

Variants and states: stories are Default (agentic), Sizes, With Border, Pressed, Primary All States and Primary Send. Every v2 variant, size and state is unchanged.

Part 1: variant='agentic'

  • Port: add 'agentic' to the variant union and the .pds-icon-button--agentic rules (rest, hover, active, pressed) in icon-button.css.
  • Needs only --pds-gradient-ai-active and --pds-color-surface-default. Depends on no other proposal.
  • Stories: Default, Sizes (the Agentic row), Pressed.

Part 2: variant='primary' + isWorking + stop

  • Port: add 'primary' to variant, the isWorking prop, .pds-icon-button--primary and --working. stop and paperPlane are the icons: paperPlane is in the package; stop is not (see Target-version check and the Icon handoff: add faStop as a registry entry).
  • isWorking uses the package Spinner (color='currentColor'), so it needs no other proposal. Port Icon first only for stop.
  • Stories: Primary All States, Primary Send.

Part 3: size='2xs'

  • Port: add '2xs' to IconButtonSize (the package type is 'xs' | 's' | 'm') and .pds-icon-button--2xs, plus the icon, spinner and tooltip-offset switch cases.
  • Stories: Sizes.

Tokens used

New to this proposal: --pds-gradient-ai-active (part 1). From the CSS as it is now:

  • --pds-animation-transition-button
  • --pds-border-radius-input
  • --pds-border-width-default, --pds-border-width-outline
  • --pds-color-button-primary-background-active, -default, -hover, --pds-color-button-primary-foreground, --pds-elevation-button-primary-active (part 2)
  • --pds-color-button-critical-secondary-*, --pds-color-button-reverse-secondary-*, --pds-color-button-secondary-* (background, border and foreground states), and the matching --pds-elevation-button-*-secondary-active
  • --pds-color-interactive-focus, --pds-color-interactive-reverse-focus
  • --pds-color-surface-default
  • --pds-elevation-icon-button-pressed
  • --pds-spacing-button-height-m, -s, -xs, and --pds-spacing-xl (the 2xs box)

Impact

From impact.md: no existing PDS component is reached. The additions are .pds-icon-button--agentic, --primary, --working and --2xs, which only apply where those classes are added. Proposals that build on it: MenuButton (variant='agentic', icon-only trigger), through it LabeledDivider; Composer, Chat Attachment, Chat Panel, Feedback Bar and Agent Tree use it directly; the Chat with an agent recipe uses variant='primary'. Port IconButton before them (see docs/PORT-ORDER.md).

Reused vs net-new

  • Reused: the whole v2 IconButton; the package Icon, Tooltip and Spinner.
  • Net-new: the isWorking prop, the agentic and primary variant values and the 2xs size, .pds-icon-button--agentic, --primary, --working and --2xs, and seven --icon-button-* variables (see custom.md).

Accessibility

  • Unchanged from v2: native button, required ariaLabel, tooltip, aria-pressed, visible focus ring.
  • isWorking sets aria-busy and disables the button. The spinner is decorative and there is no working-state text of its own: the caller must update ariaLabel ("Send message", "Sending message", "Stop response"). This is documented in IconButton.mdx.
  • The gradient border is decorative.
  • Not checked: no a11y panel or contrast run was made in this rewrite, in light or dark. The primary hover and active states in dark are not checked either.

Decisions and open questions

Each has a recommendation.

  • Should critical or reverse get the gradient border too? Recommendation: no, it is not needed by any screen.
  • Does Send need the gradient border or an agentic treatment on primary? Recommendation: no; ship primary without it.
  • A voice (waveform) state for an empty field. Never built. Recommendation: leave it out until a screen needs it.
  • Is the s spinner too big in a 24px box (2xs)? Not looked at. Recommendation: keep s; the Spinner has no smaller size.
  • Strict-null fixes in the local copy (for example icon2Name defaults to undefined, not null) change no behavior. v2 is not strict, this repo is. Recommendation: do not port them.

Extension or new component

An extension of the existing IconButton: new values on variant and size and one new prop, isWorking. The standard, reverse and critical variants and their stories are untouched. The three parts are separable, so any can land on its own.

Footprint

Nothing draws outside the button's box. The agentic gradient is painted on the border-box inside the same width and height as the other variants. The primary focus ring uses outline-offset: 1px, so it draws 1px outside the box, as v2's outline already does at its default offset; a parent with overflow: hidden can clip it. At 2xs the box is 24px, so a row needs at least 24px of height and the tooltip offset is 4px (v2 sizes xs, s and m use 6, 8 and 11).

Dark mode and per-size values

No per-theme override in icon-button.css: every color is a theme-aware token, so light and dark come from the tokens. Not checked by eye in either theme.

Size Box Token Icon Spinner (isWorking) Tooltip offset
2xs (new) 24px --pds-spacing-xl s, 14px s 4
xs 28px --pds-spacing-button-height-xs m, 16px s 6
s (default) 32px --pds-spacing-button-height-s m, 16px m 8
m 40px --pds-spacing-button-height-m xl, 20px l 11

Expect to change

  • variant='primary' and variant='agentic' on IconButton. Recommendation: agree, they extend the existing variant prop (L1). If the engineer prefers, primary can be the secondary-only change and Send a recipe.
  • isWorking (a boolean that disables the button). Recommendation: agree; it mirrors isLoading on Button. Name it isLoading if the toolkit prefers one name for both. The engineer may rename it.
  • No workingLabel prop (L3). Recommendation: do not add one; ariaLabel is already a top-level string and the caller changes it with the state. Documented in the Accessibility section.
  • hasBorder is ignored on agentic and primary without a dev warning. Recommendation: state "ignored" in the TSDoc, or add a [IconButton] dev warning as Button does.
  • size='2xs' is one right value for dense rows (L11, a knob with one use). Recommendation: keep it; it is a size, not a free setting.
  • Raw opacity: 40% and outline-offset: 1px (see custom.md). Recommendation: use the toolkit's disabled opacity.

Target-version check

Checked against .pds-reference/src at v2.0.0-beta.21 (2026-11-20):

Item In the package at beta.21?
variant='agentic', 'primary' no (variant is 'standard' | 'reverse' | 'critical')
isWorking no
size='2xs' no (IconButtonSize is 'xs' | 's' | 'm'); 2xs in the changelog is the layout gap scale
paperPlane icon yes
stop icon no (see the Icon handoff)
Spinner with color string yes (color?: string, --spinner-color); no color='agentic'
Agentic option on Button, IconButton no (the agentic Button is a separate handoff)

Port notes

  • Edit src/components/buttons/IconButton in place. Do not use the generator. Each part is its own change (see "Three parts").
  • Swap the local mergeClasses for the real one. Icon here is the local wrapper; use the package Icon once stop is in the registry.
  • Part 2 needs the stop icon from the Icon handoff; it does not need the Spinner proposal (the package Spinner is enough).

Preview

npm run storybook, then Component Proposals/Buttons/Icon Button.

Figma: https://www.figma.com/design/AMGWJbraJoi2PKWnxo29Ah/PDS-Proposals?node-id=291-6900