Skip to content

docs(Spinner): an iOS-style activity indicator, composed from existing APIs - #10066

Merged
cixzhang merged 2 commits into
mainfrom
lane4/spinner-activity-indicator
Nov 5, 2026
Merged

cixzhang merged 2 commits into
mainfrom
lane4/spinner-activity-indicator

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Supersedes #8211 by @vjeux: his two commits, cherry-picked onto today's main unchanged, with his authorship. Story-only: no library code, no API, and no changeset.

Reader impact

An app that wants iOS's activity indicator finds no Spinner option: Spinner draws a ring everywhere. A new story shows how to build that look from StyleX and plain elements, as a component to copy. Spinner itself is unchanged.

Source of truth

On #8211, the owner decided against any new API for this look (no Spinner prop, no theme role, no glyph swap on touch screens) and asked for a story that composes it from existing APIs instead. This is that story.

Change

ActivityIndicator in Spinner.stories.tsx, with the story "iOS-style activity indicator (composed)":

  • eight capsule spokes 45° apart, the head stepping clockwise every 100 ms, medium 20 pt and large 37 pt, as UIActivityIndicatorView draws it on iOS 26;
  • one opacity animation per spoke, joined by short linear ramps rather than steps(), so WebKit keeps them on the compositor;
  • a named image (role="img" with a label), not a live region; the app announces loading once, itself;
  • the spokes are drawn in CanvasText under forced colors;
  • the code comment names the contrast tradeoff (UIKit's gray reaches 2.74:1 on white) and the theme color to use for 3:1.

Evidence

In real Chrome, against a Storybook built from this branch:

  • light and dark;
  • the head stepping clockwise between frames;
  • forced colors, with the spokes drawn in CanvasText;
  • right to left, still clockwise;
  • the animation unchanged under Reduce Motion, as UIKit's is;
  • both indicators named "Loading".

ESLint (strict) passes. There is no test to run red-first: the change is a story, with no library behavior.

vjeux added 2 commits November 5, 2026 01:43
…g APIs

A story for an app that wants iOS's look: `ActivityIndicator`, eight
capsule spokes drawn with StyleX and plain elements, to copy. As
UIActivityIndicatorView draws it on iOS 26: a bright head stepping
clockwise one spoke every 100 ms (a turn every 0.8 s) and the trail
dimming behind it, medium 20 pt and large 37 pt, in UIKit's secondary
label gray at its images' alphas, light and dark. Each spoke runs one
opacity animation whose holds are joined by short linear ramps rather
than steps(), so WebKit runs it on the compositor. It is a named image,
not a live region (`spec:AST-086` FR2, FR3): the app announces loading
through the shared channel. Spinner itself is unchanged.
…contrast

Storybook's code panel shows only a story's render, so the story's
description names the file that holds `ActivityIndicator`. The color
comment no longer says any theme color works: UIKit's gray reaches 2.74:1
at the brightest spoke on a white page, and the theme's secondary text
color is lighter still (2.25:1); the theme's primary text color reaches
3.64:1 at the same alphas, for an app that needs WCAG's 3:1 for non-text
graphics. No pixel changes.
@vercel

vercel Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 5, 2026 9:57am UTC

Request Review

@astracat-bot

astracat-bot Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 5, 2026, 10:07 AM UTC

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · cc3006a

Storybook · Sandbox · built from this PR's head

API changes: none in this pull request

Committed API report behind this build: cli 9 rows, core 4 rows; run pnpm api:report.

Not run on this PR: add ci:run-visual, ci:run-a11y or ci:run-rtl to run them.


Generated by PR Enrichment workflow | View full report

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI has not run on this head yet, because the pull request is a draft; the required checks run once it is marked ready for review.

The story adds a copyable iOS-style ActivityIndicator without changing Spinner or any public API. It exposes a named image with no live role, so the app keeps ownership of the loading announcement. In Chromium it steps clockwise every 100 ms in light, dark, forced colors and right-to-left, and both indicators are named "Loading".

[Automated review]

@cixzhang
cixzhang marked this pull request as ready for review November 5, 2026 10:13
@cixzhang
cixzhang merged commit 2e0953c into main Nov 5, 2026
104 checks passed
@cixzhang
cixzhang deleted the lane4/spinner-activity-indicator branch November 6, 2026 02:01

This branch was successfully deployed

1 active deployment
Preview — cc3006aa Deployed Nov 5, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants