Skip to content

    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.

    Open
    Customize

    Installation

    npx shadcn@latest add @glint-ui/undo-bar

    First 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

    PropTypeDefaultDescription
    durationnumber5Seconds before the action is final.
    actionLabelstring"Undo"Undo button text.
    openReactNode—Show the bar; reopening restarts the countdown.
    messageReactNode—What just happened.
    onUndoReactNode—() => void, called on Undo.
    onExpireReactNode—() => void, called when time runs out.
    positionReactNode—"fixed" (default) or "absolute" to stay inside a container.
    classNamestring—Extra classes for the root element.