← All proposals

Spinner: agentic color variant

Extend the existing PDS v2 Spinner (not a new component).

Extends a PDS componentOpen in Storybook

proposals/Spinner/HANDOFF.md146 lines · View on GitHub

Handoff: Spinner (agentic color)

Rewritten 2026-11-20 against v2.0.0-beta.21 to the lessons template. Facts below were checked against Spinner.tsx, spinner.css, Spinner.stories.tsx and the beta.21 source in the reference checkout. Nothing was checked by eye in a session (no screenshots): how it looks, and any accessibility result, is "not checked". The earlier axe run predates the 2026-10-21 change (disc, avatarVariant and shimmer removed) and is not repeated here.

What and why

AI and agentic surfaces use the AI gradient, so their loading state needs a Spinner that matches the single-color default. This extends the existing PDS v2 Spinner (it is not a new component): color='agentic' paints the arc and track with the AI gradient (--pds-gradient-ai-active, the token pds-ai-active-border uses), and a second prop, hasAvatar, puts the Zappy bolt inside the ring for work an agent is doing (plain foreground color, from 2xl up, never inline).

  • Figma: Spinner page in PDS-Proposals (pageUrl in figma.json; flat captures of 5 stories, light and dark, sent 2026-10-16, before the bolt changes of 2026-10-21, so the last frame still shows the removed disc and is stale). Jira: none. Source: Erika's screenshot of the gradient and the default spinner at nine sizes.
  • Context: context.md

Exploration and decisions

  • Extend Spinner, not a new component. color already takes any CSS color; 'agentic' is one more value, typed 'agentic' | (string & {}) so autocomplete shows it.
  • Not an SVG gradient. --pds-gradient-ai-active is a CSS linear-gradient(), which an SVG stroke can't use, and copying its stops into <stop> would break the tokens-only rule. The agentic variant is CSS boxes with the gradient as background, clipped by an alpha mask in the ring and arc shapes. (The package already uses mask with this gradient in utilities/ai-visuals/ai-visuals.css.)
  • Fixed gradient, spinning arc. The arc box rotates and its gradient layer counter-rotates, so the colors stay put while the arc moves. The track is the same gradient at 0.3 opacity.
  • hasAvatar (2026-10-21) puts the Zappy bolt inside the ring, in the plain foreground color: not the gradient, no shimmer, no disc. It is half the ring tall. It is a boolean, not a slot. Below 2xl, or when isInline (a spinner inline with text, whatever its size), it is ignored. The disc, the Agent Avatar in the ring, avatarVariant and avatarColor were removed.
  • Tried and removed: a discovery color; a gradient fill on the bolt (overlay with mix-blend-mode, then a mask); the shimmer on the bolt; the Agent Avatar disc.

API

Prop Type Default Purpose
className string '' Additional class names.
color 'agentic' | (string & {}) none (CSS falls back to the foreground default) Arc color: any CSS color or var(--token), or 'agentic' for the AI gradient. The v2 prop is string; 'agentic' is the addition.
hasAvatar boolean false New. Show the Zappy bolt inside the ring. Ignored below 2xl and when isInline.
isInline boolean false Inline-flex, no visible label (as v2).
label string 'Loading' Label, visible only with showLabel; always in the DOM (as v2).
showLabel boolean false Show the label under the spinner, not when isInline (as v2).
size 's' | 'm' | 'l' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' '3xl' Spinner size (as v2).

SpinnerProps extends ComponentPropsWithoutRef<'span'>, as in v2. Only color (a new value) and hasAvatar differ from the package.

Variants and states: all nine sizes, agentic color, with and without label, inline with text, hasAvatar (the plain bolt in the gradient ring). Stories: Default (with controls), AllSizes, WithLabel, InlineWithText, WithIcon. WithIcon sets hasAvatar on every size from 2xl up; the InlineWithText story sets hasAvatar on purpose to show it is ignored (story-only demonstration, L9). The story's variants array and the single-entry color control options are story helpers.

Tokens used

From spinner.css as it is now:

  • --pds-color-foreground-default
  • --pds-gradient-ai-active
  • --pds-typography-ff-default
  • --pds-typography-fw-medium
  • --pds-typography-lh-m

From Spinner.tsx (JS tokens, as in v2): SPACING_S to SPACING_6XL, SPACING_XS, SPACING_S, SPACING_M, SPACING_L for the label margin, and TYPOGRAPHY_SIZE_XS, TYPOGRAPHY_SIZE_S, TYPOGRAPHY_SIZE_M for the label size.

Custom variables (see custom.md): --spinner-arc-mask, --spinner-bolt-mask, --spinner-color (also in v2), --spinner-ring-mask. The earlier handoff listed pds-ai-active-shimmer as reused; the shimmer was removed, so it is not used.

Impact

From impact.md (generated): nothing reaches existing components; the new classes are scoped to the Spinner block. These proposals import it, so they change with it: AgentInbox, AgenticButton, EventLog, IconButton (its isWorking state) and SpinnerSequence, and through them AgentTree, AgenticMenuButton, ChainOfThought, ChatAttachment, ChatPanel, FeedbackBar and LabeledDivider. Look at them in Storybook after any change here. The change is opt-in (color='agentic' or hasAvatar), so a Spinner that sets neither is the v2 markup.

Reused vs net-new

  • Reused: the v2 Spinner markup, sizes, label, isInline and reduced-motion rule.
  • Net-new: the agentic color value, the hasAvatar prop, and seven classes on .pds-spinner: --agentic, __avatar, __bolt, __gradient-arc, __gradient-rotator, __gradient-track, __with-avatar. See custom.md.
  • Stand-ins in the proposal: a local mergeClasses and a visually-hidden span in place of v2's mergeClasses and HiddenLabel.

Accessibility

  • Same structure as v2: the root is <span role='status' aria-hidden='true'>, the ring is aria-hidden, and the label is a text node (visible with showLabel, otherwise a visually-hidden span) that is always in the DOM. Note the root's aria-hidden='true' is v2's as well; whether the label is announced under an aria-hidden status root: not checked (an existing v2 behavior, not changed here).
  • The bolt is aria-hidden; it adds no text.
  • The rotation stops under prefers-reduced-motion: reduce (the ring, the arc box and its gradient layer); v2 does the same since the change logged in the package CHANGELOG. The agentic arc then sits still with its gradient in place.
  • Nothing in the component is interactive; no keyboard behavior.
  • axe-core, the Storybook a11y panel, and contrast of the gradient arc and track on the surfaces in light and dark: not run for the current build, not checked.

Decisions and open questions

Resolved and removed: disc or bolt, the shimmer in dark mode, the avatar gap (the disc and the shimmer no longer exist). Open, each with a recommendation:

  • Round arc ends come from the mask's stroke-linecap. Recommendation: accept; confirm at 2x in the s and m sizes in review. Not checked.
  • Gap between the ring and the bolt. The bolt is half the ring tall at every size. Recommendation: keep the half-ring rule (no prop for it), and have the designer adjust by eye in the port.
  • Raw values. The mask data URIs contain black as a fill or stroke, alpha-only and never painted. A grep for raw colors will flag it. Recommendation: keep it (listed in custom.md); the alternative is a different technique, see Expect to change.
  • The hasAvatar name and the bolt source. See Expect to change.

Extension or new component

An extension of the existing PDS Spinner (src/components/loading-indicators/Spinner/): one new value on the existing color prop and one new boolean, hasAvatar. A Spinner with neither is the unchanged v2 markup, and its original stories are not touched. It is not a new component: nothing about it is a new behavior, only a color and a glyph. The proposal also stays a separate agentic-color file only because the package Spinner cannot be edited here.

Footprint

From the CSS (not checked by eye):

  • The agentic ring and the default ring occupy the same square, --spinner-size wide and tall. The agentic ring is a span (not the svg) with absolutely positioned children (inset: 0) clipped by an alpha mask to the ring shape, so the paint stays inside the box. The counter-rotating gradient layer is a square that is rotated inside the arc box; the mask clips it to the arc, so its corners do not show.
  • hasAvatar wraps the ring in an inline-flex span (__with-avatar) with the bolt absolutely centered over it (inset: 0). It adds no size beyond the ring.
  • The bolt is calc(var(--spinner-size) * 0.5) tall with an aspect ratio of 374 to 512, so it sits well inside the ring.
  • .pds-spinner__icon keeps overflow: visible (as v2). A parent that clips (overflow: hidden) a spinner flush against its edge could cut the ring's anti-aliased edge; nothing is drawn outside the box.
  • The label stays under the ring in a column; max-width is six times the ring (v2).
  • A parent that sizes the spinner with its own width or height will not scale the bolt: the size comes from --spinner-size only.
  • Browser support for mask shorthand with a data URI: the package already uses mask in ai-visuals.css; the exact support floor was not verified.

Dark mode and per-size values

Single look for both themes in the proposal's CSS. There is no per-theme override: --pds-gradient-ai-active is defined only in the light token file (no dark value in pds-design-tokens), so the gradient is the same in light and dark; the track is the same gradient at 0.3 opacity; the bolt follows --pds-color-foreground-default, which differs per theme. Contrast of the track and arc on dark surfaces: not checked.

Ring and label values per size. Ring box is the size token; the stroke and the arc scale with it (2.5 of 24 of the box, arc 18.7 66 of the circumference). The bolt shows from 2xl.

Size Ring (token, px) Bolt height (half the ring) Bolt width (x 0.73) Label size (showLabel) Label margin above
s --pds-spacing-s, 12 not shown not shown xs xs
m --pds-spacing-m, 16 not shown not shown xs xs
l --pds-spacing-l, 20 not shown not shown xs xs
xl --pds-spacing-xl, 24 not shown not shown xs xs
2xl --pds-spacing-2xl, 32 16 11.7 xs xs
3xl --pds-spacing-3xl, 40 20 14.6 s s
4xl --pds-spacing-4xl, 48 24 17.5 s s
5xl --pds-spacing-5xl, 64 32 23.4 m m
6xl --pds-spacing-6xl, 80 40 29.2 m l

Ring sizes are the token values at 16px per rem (0.75rem to 5rem). Label size and margin are v2's, unchanged. Bolt width is computed from the aspect ratio. Single size for track opacity (0.3), stroke and animation (1s linear).

Expect to change

Each is a choice that may break a toolkit convention, with a recommended answer (L10).

  • hasAvatar is not an avatar (L2, L11). It shows a bolt, the story is named WithIcon, but the prop and the classes (__avatar, __with-avatar) still say "avatar". It is silently ignored below 2xl and when isInline. Recommendation: rename (for example hasIcon), keep it a flat boolean defaulting to off, and add a development warning when it is set but ignored. A second option the engineer may prefer: take an iconName of the shared AgenticIcon type (zappy or sparklesSolid), as AgentAvatar does.
  • The bolt as a mask data URI. The zappy icon already exists in the package (custom-icons.tsx) with the same path as the data URI in spinner.css. Recommendation: render <Icon iconName='zappy' /> in the ring instead of the mask, which removes --spinner-bolt-mask and __bolt. Not verified: the Icon sizes top out at 4xl (2rem), and the 5xl and 6xl bolts are 2rem and 2.5rem tall, so the sizes may need a CSS size override for 6xl.
  • color: 'agentic' | (string & {}) (L2). A "color" prop that accepts a keyword that is not a CSS color. The package precedent for agentic is a named value on an existing prop (type='agentic' on SectionMessage, variant='agentic-*' on Panel). Recommendation: keep color='agentic': every consumer that already passes color (Button, IconButton isWorking, Event Log) gets it with no new prop. The engineer may prefer isAgentic, and the CSS does not change either way. Plain string with a TSDoc note is acceptable if the union typing is not wanted.
  • Mask technique (L9). Seven new classes and three custom variables carry the gradient; the engineer may prefer an SVG <linearGradient> with the token's stops. It cannot use the CSS token without copying its colors (tokens-only rule), so recommendation: keep the masks.
  • Local mergeClasses and the visually-hidden span (L9). Proposal stand-ins; use @libs/components/utils mergeClasses and HiddenLabel.
  • Stale comment in Spinner.tsx (lines 74 to 76) says the bolt is "one avatar size up from half the ring"; the CSS makes it half the ring. The avatarSizes list there is just the sizes from 2xl up. Not ported.

Target-version check

Checked against .pds-reference at v2.0.0-beta.21, the installed package and CHANGELOG.mdx:

  • color='agentic' on Spinner: not in beta.21 (color?: string). New. (The beta.21 doc comment on color says the default is interactive blue, but spinner.css defaults to --pds-color-foreground-default; the proposal follows the CSS.)
  • hasAvatar on Spinner: not in beta.21. New. (hasAvatar exists in the package only on AvatarLabel.)
  • .pds-spinner--agentic, __gradient-*, __bolt, __avatar, __with-avatar: not in the source or in the package's index.css. New.
  • zappy icon: already in beta.21 (custom-icons.tsx); sparklesSolid since the changelog entry that added it. The proposal does not use Icon today.
  • --pds-gradient-ai-active and .pds-ai-active-border, .pds-ai-active-shimmer: already in beta.21 (ai-visuals.css). mask is already used there.
  • Changelog notes that touch the Spinner: reduced motion stops the rotation entirely; the ring was enlarged (r=10.5) in an earlier release, which the proposal's masks match (r='10.5').
  • Not verified: a Spinner change in beta.21 itself (the beta.21 changelog entry lists only a Table fix).

Port notes

  • This extends the existing Spinner (src/components/loading-indicators/Spinner/). Copy the new CSS and the agentic branch into the v2 file; no generator needed.
  • Swap the local mergeClasses and the visually-hidden span for v2's mergeClasses and HiddenLabel.
  • Decide the hasAvatar name and whether the bolt is an Icon (Expect to change) before copying the CSS.
  • Add the v2-new tag to the story for the new props if the Spinner does not have it; keep argTypes categorized.

Preview

npm run storybook, then Component Proposals/Spinner. Figma: https://www.figma.com/design/AMGWJbraJoi2PKWnxo29Ah/PDS-Proposals?node-id=185-44