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 (
pageUrlinfigma.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.
coloralready takes any CSS color;'agentic'is one more value, typed'agentic' | (string & {})so autocomplete shows it. - Not an SVG gradient.
--pds-gradient-ai-activeis a CSSlinear-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 usesmaskwith this gradient inutilities/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. Below2xl, or whenisInline(a spinner inline with text, whatever its size), it is ignored. The disc, the Agent Avatar in the ring,avatarVariantandavatarColorwere removed.- Tried and removed: a
discoverycolor; a gradient fill on the bolt (overlay withmix-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
Spinnermarkup, sizes, label,isInlineand reduced-motion rule. - Net-new: the
agenticcolor value, thehasAvatarprop, and seven classes on.pds-spinner:--agentic,__avatar,__bolt,__gradient-arc,__gradient-rotator,__gradient-track,__with-avatar. Seecustom.md. - Stand-ins in the proposal: a local
mergeClassesand avisually-hiddenspan in place of v2'smergeClassesandHiddenLabel.
Accessibility
- Same structure as v2: the root is
<span role='status' aria-hidden='true'>, the ring isaria-hidden, and the label is a text node (visible withshowLabel, otherwise avisually-hiddenspan) that is always in the DOM. Note the root'saria-hidden='true'is v2's as well; whether the label is announced under anaria-hiddenstatus 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 thesandmsizes 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
blackas a fill or stroke, alpha-only and never painted. A grep for raw colors will flag it. Recommendation: keep it (listed incustom.md); the alternative is a different technique, see Expect to change. - The
hasAvatarname 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-sizewide and tall. The agentic ring is aspan(not thesvg) 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. hasAvatarwraps the ring in aninline-flexspan (__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__iconkeepsoverflow: 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-widthis 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-sizeonly. - Browser support for
maskshorthand with a data URI: the package already usesmaskinai-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).
hasAvataris not an avatar (L2, L11). It shows a bolt, the story is namedWithIcon, but the prop and the classes (__avatar,__with-avatar) still say "avatar". It is silently ignored below2xland whenisInline. Recommendation: rename (for examplehasIcon), 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 aniconNameof the sharedAgenticIcontype (zappyorsparklesSolid), as AgentAvatar does.- The bolt as a mask data URI. The
zappyicon already exists in the package (custom-icons.tsx) with the same path as the data URI inspinner.css. Recommendation: render<Icon iconName='zappy' />in the ring instead of the mask, which removes--spinner-bolt-maskand__bolt. Not verified: theIconsizes top out at4xl(2rem), and the5xland6xlbolts are 2rem and 2.5rem tall, so the sizes may need a CSS size override for6xl. 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: keepcolor='agentic': every consumer that already passescolor(Button, IconButtonisWorking, Event Log) gets it with no new prop. The engineer may preferisAgentic, and the CSS does not change either way. Plainstringwith 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
mergeClassesand thevisually-hiddenspan (L9). Proposal stand-ins; use@libs/components/utilsmergeClassesandHiddenLabel. - 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. TheavatarSizeslist there is just the sizes from2xlup. Not ported.
Target-version check
Checked against .pds-reference at v2.0.0-beta.21, the installed package and CHANGELOG.mdx:
color='agentic'onSpinner: not in beta.21 (color?: string). New. (The beta.21 doc comment oncolorsays the default is interactive blue, butspinner.cssdefaults to--pds-color-foreground-default; the proposal follows the CSS.)hasAvataronSpinner: not in beta.21. New. (hasAvatarexists in the package only onAvatarLabel.).pds-spinner--agentic,__gradient-*,__bolt,__avatar,__with-avatar: not in the source or in the package'sindex.css. New.zappyicon: already in beta.21 (custom-icons.tsx);sparklesSolidsince the changelog entry that added it. The proposal does not useIcontoday.--pds-gradient-ai-activeand.pds-ai-active-border,.pds-ai-active-shimmer: already in beta.21 (ai-visuals.css).maskis 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 theagenticbranch into the v2 file; no generator needed. - Swap the local
mergeClassesand the visually-hidden span for v2'smergeClassesandHiddenLabel. - Decide the
hasAvatarname and whether the bolt is anIcon(Expect to change) before copying the CSS. - Add the
v2-newtag 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