Browse components
Undo Bar
A snackbar for reversible actions: it springs up after a delete while a ring counts down the seconds left to undo. Hovering or focusing it pauses the clock.
Installation
npx shadcn@latest add @glint-ui/undo-barFirst time using @glint-ui? Add the registry to components.json once, or install by URL: npx shadcn@latest add https://glintui.vercel.app/r/undo-bar.json
Usage
import { UndoBar } from "@/components/ui/undo-bar";
<UndoBar
open={!!deleted}
message="Message deleted"
onUndo={restore}
onExpire={commitDelete}
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| duration | number | 5 | Seconds before the action is final. |
| actionLabel | string | "Undo" | Undo button text. |
| open | ReactNode | — | Show the bar; reopening restarts the countdown. |
| message | ReactNode | — | What just happened. |
| onUndo | ReactNode | — | () => void, called on Undo. |
| onExpire | ReactNode | — | () => void, called when time runs out. |
| position | ReactNode | — | "fixed" (default) or "absolute" to stay inside a container. |
| className | string | — | Extra classes for the root element. |