Skip to content
IndexRequest a UIAboutContact

Animated Checkmark Button

A submit button that shrinks into a spinner and finishes by drawing a checkmark.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI CODING TOOL
Create a "Send message" button, 44px tall and 160px wide, with a dark fill and white label. On click enter the working stage: set aria-busy, collapse the width to 44px over 260ms cubic-bezier(.2,.7,.2,1) while the label fades out and a 18px CSS spinner (700ms linear) fades in. After 1 second enter the success stage: replace the spinner with an SVG check mark (path length 24) that draws using stroke-dashoffset from 24 to 0 over 360ms ease-out, and change the fill to a green (#1a7f4b). After 1.6 seconds return to the idle state, expanding the width back. Ignore clicks while not idle. Announce "Message sent" in a polite live region. Show a 2px focus-visible ring. Under prefers-reduced-motion remove width and draw animations and switch stages instantly.

About this pattern

Definition

A button that moves through three visible stages: idle label, working spinner and success check. The final check is drawn like a pen stroke using an SVG path.

Purpose & UX principles

  • Confirms that the action was received and completed, without a separate message.
  • Locks the button while working so it cannot be submitted twice.
  • The result is also announced in a live region so it is not purely visual.

Interaction states

  • Idle, working (aria-busy), success, back to idle after 1.6 seconds, focus-visible.

Motion specification

  • Width collapse: 260ms cubic-bezier(.2,.7,.2,1).
  • Check draw: stroke-dashoffset from 24 to 0 over 360ms ease-out.
  • Reduced motion: stages change instantly and the check appears without drawing.

Responsive behaviour

  • Fixed 44px height; the button shrinks to a 44px circle while working and grows back.
  • Works the same with touch and keyboard.

Code

HTML
<div class="wrap">
  <button class="b" id="b"><span class="l">Send message</span><span class="sp" aria-hidden="true"></span><svg class="ck" viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.500l4.500 4.500L19 7.500"/></svg></button>
  <p class="live" id="live" aria-live="polite"></p>
</div>

Related patterns

Primary & Secondary Button

↗
Primary & Secondary ButtonButtons & Actions

Spinner

↗
SpinnerLoading & Progress

Toast

↗
ToastFeedback & Notifications