Barely Designer

Honest Save Button

Buttons

About

A save button that tells the truth. A tactile pill that sinks into its ink lip when pressed. Saving (label hands over to a progress ring), saved, or failed: one short shake, 'Not saved', then 'Retry' with an inline note that your edits are kept. Never a silent reset. One GSAP timeline, gsap.matchMedia() reduced motion, aria-busy and a polite live region, light and dark. Demo UI, dummy data.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Honest Save Button to your project and fits it to your theme.

Code

How Honest Save Button is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import * as React from "react"

import { HonestSaveButton } from "@/components/ui/honest-save-button"

// Demo UI, dummy data. The save is fake: it waits, then succeeds or fails depending on the toggle.
const reduced = () => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches

const paper = "#F4F2EE"
const ink = "#141413"

export default function HonestSaveButtonDemo() {
  const [dark, setDark] = React.useState(false)
  const [outcome, setOutcome] = React.useState<"success" | "failure">("failure")
  const outcomeRef = React.useRef(outcome)
  outcomeRef.current = outcome
  const button = React.useRef<HTMLButtonElement>(null)

  const save = () =>
    new Promise<void>((resolve, reject) => setTimeout(() => (outcomeRef.current === "success" ? resolve() : reject(new Error("Network"))), 700))

  // Autoplay inside 21st's ~3 s capture: a failure run, then the retry succeeds. Skipped under reduced motion.
  React.useEffect(() => {
    if (reduced()) return
    const t = [
      setTimeout(() => button.current?.click(), 300),
      setTimeout(() => setOutcome("success"), 1700),
      setTimeout(() => button.current?.click(), 2600),
    ]
    return () => t.forEach(clearTimeout)
  }, [])

  const quiet = "text-[#595650] dark:text-[#A8A39A]"
  const chip = `h-10 rounded-full px-3 font-mono text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-[#141413] dark:focus-visible:ring-[#F4F2EE] ${quiet} hover:text-[#141413] dark:hover:text-[#F4F2EE]`
  const on = "text-[#141413] underline decoration-1 underline-offset-4 dark:text-[#F4F2EE]"
  const canvas = dark ? ink : paper

  return (
    <div
      className={dark ? "dark" : undefined}
      style={{
        colorScheme: dark ? "dark" : "light",
        position: "relative",
        width: "100%",
        maxWidth: "100%",
        aspectRatio: "4 / 3",
        minHeight: "100%",
        backgroundColor: canvas,
        boxSizing: "border-box",
        // 2px ink frame so 21st's capture can see the full 4:3 canvas
        // (a near-white full-bleed fill is otherwise flagged as blank).
        border: dark ? "2px solid #F4F2EE" : "2px solid #141413",
      }}
    >
      <div
        className="relative flex h-full w-full flex-col items-center justify-center bg-[#F4F2EE] font-mono dark:bg-[#141413]"
        style={{
          width: "100%",
          height: "100%",
          backgroundColor: canvas,
          boxSizing: "border-box",
          padding: "64px 32px 96px",
        }}
      >
        <HonestSaveButton ref={button} onSave={save} />

        <div className="absolute inset-x-8 bottom-8 flex flex-wrap items-center justify-between gap-2">
          <p className={`text-[13px] ${quiet}`}>Demo UI, dummy data</p>
          <div className="flex items-center gap-1">
            <div role="radiogroup" aria-label="Next save" className="flex items-center">
              <span className={`mr-1 text-[13px] ${quiet}`}>Next save:</span>
              {(["success", "failure"] as const).map((o) => (
                <button key={o} type="button" role="radio" aria-checked={outcome === o} onClick={() => setOutcome(o)} className={`${chip} ${outcome === o ? on : ""}`}>
                  {o === "success" ? "succeeds" : "fails"}
                </button>
              ))}
            </div>
            <button type="button" aria-pressed={dark} onClick={() => setDark((d) => !d)} className={chip}>
              {dark ? "light" : "dark"}
            </button>
          </div>
        </div>
      </div>
    </div>
  )
}

Dependencies

More by Barely Designer

View all
  • Car sales Dashboard

    Car sales Dashboard

    27
  • ASCII Heart Login

    ASCII Heart Login

    6
  • NewwsLetterz

    NewwsLetterz

  • Bottom Nav

    Bottom Nav

  • No Green Tick

    No Green Tick

More in Buttons

View all
  • Texture Button

    Texture Button

    122
  • Button

    Button

    172
  • HeroUI Button Group

    HeroUI Button Group

    1
  • Button

    Button

    88
  • Native Button

    Native Button

    7
  • Button

    Button

    74
  • Button Group

    Button Group

    5
  • Button

    Button

    21