Scrim UI

Memory Chip UI

A compact inline chip confirming something was saved to memory.

memorychipindicator

Props

Also takes onClick.

Component source

Single-file React + Tailwind component. No dependencies — drop it into any project with Tailwind configured.

memory-chip.tsx
"use client";

import * as React from "react";

/* ------------------------------------------------------------------ */
/* Types                                                               */
/* ------------------------------------------------------------------ */

export type MemoryChipProps = {
  variant?: "saved" | "on";
  label?: string;
  onClick?: () => void;
  className?: string;
};

/* ------------------------------------------------------------------ */
/* Icons                                                               */
/* ------------------------------------------------------------------ */

function CheckIcon(props: React.SVGProps<SVGSVGElement>) {
  return (
    <svg
      viewBox="0 0 24 24"
      fill="none"
      stroke="currentColor"
      strokeWidth="2.5"
      strokeLinecap="round"
      strokeLinejoin="round"
      width="11"
      height="11"
      {...props}
    >
      <path d="M20 6 9 17l-5-5" />
    </svg>
  );
}

/* ------------------------------------------------------------------ */
/* MemoryChip                                                          */
/* ------------------------------------------------------------------ */

export function MemoryChip({
  variant = "saved",
  label,
  onClick,
  className = "",
}: MemoryChipProps) {
  const saved = variant === "saved";
  const text = label ?? (saved ? "Saved to memory" : "Memory on");

  const Comp = onClick ? "button" : "span";
  return (
    <Comp
      {...(onClick ? { type: "button" as const, onClick } : {})}
      className={`inline-flex h-6 max-w-full items-center gap-1.5 rounded-full border px-2.5 text-[11px] font-medium transition-colors ${
        saved
          ? "border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-900/50 dark:bg-emerald-900/25 dark:text-emerald-300"
          : "border-zinc-200 bg-white text-zinc-600 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-300"
      } ${onClick ? "cursor-pointer hover:bg-zinc-50 dark:hover:bg-zinc-700" : ""} ${className}`}
    >
      {saved ? <CheckIcon /> : <span className="h-1.5 w-1.5 shrink-0 rounded-full bg-current" />}
      <span className="truncate">{text}</span>
    </Comp>
  );
}

Usage Guidelines

  • Place the confirmation next to the message that used the memory, so the cause is visible.
  • Keep it quiet — a permanent status chip is enough; avoid flashing or animations.
  • Make it clickable when there is somewhere useful to go (the memory panel).

Common UX Mistakes

  • Confirming every single save — noise teaches users to ignore it.
  • Using the chip with no destination when it is clickable.
  • Showing memory status where the user never asked about it (a marketing-style banner).

Related Components