Streaming Stop Button
One button in one place that becomes stop while the model is generating, then send again.
press to send
Build a send button that becomes a stop button while the model generates. The rule: ONE BUTTON, IN ONE PLACE, changing what it does. A separate stop control that appears next to send moves the target in the middle of the task, and people click the wrong one. Structure: an input row with a fixed circular button at the end. Swap the GLYPH inside it, never the button. The arrow scales out (0.5, opacity 0) as the square scales in, about 160ms. Animating the button itself shifts the thing being aimed at. Use a SQUARE for stop, the transport-control square, not an X. An X reads as dismiss, and dismissing is not what pressing it does. Mount the spinner ring by STATE, so it exists only while generating. Do not leave a rotating element running permanently: in a gallery of components, a permanent animation in every card costs real frames. Stopping is a REAL OUTCOME. Say "stopped early" rather than snapping back to idle, because a half-finished answer is a different state from no answer at all, and the person needs to know which one they have. Accessibility: the aria-label flips between "Send message" and "Stop generating", and the status line is aria-live="polite". A button whose accessible name lies about what it currently does is worse than an unlabelled one. Clear the generation timeout on unmount. Under prefers-reduced-motion, change the glyph with no scale and do not rotate the ring. Both states are still completely obvious. Colors as tokens: accent with on-primary ink for the button, muted ink for the status line, surface and border for the input row. Build the component, not this demo of it. - Ambient motion that IS the component may loop: a drifting background, a marquee, a spinner while something is genuinely loading. - Do not add any timer, interval, loop or script that performs a person's action by itself. No auto-hover, no auto-click, no cycling through states, no pretend submitting, no replaying the interaction on a schedule. - Every state that answers a person waits for a real event from that person. - Placeholder copy and sample content are welcome. Simulated behaviour is not.