Two-step delete
Two-step delete button: the first click arms it and a pixel fuse burns down; a second click inside the window confirms with a burst.
Playground
Change a prop and the component re-renders. Props marked remounts set an initial value, so the component starts over.
<PxConfirm
doneText="Project deleted"
timeout={3}
confirmText="Click again to confirm"
>Delete project</PxConfirm>Installation
pnpm dlx shadcn@latest add @lumesec/px-confirmFirst timeRegister the @lumesec registry once, or install by URL+
Adds @lumesec to your components.json:
pnpm dlx shadcn@latest registry add @lumesec=https://elements.lumesec.ai/r/{name}.jsonOr skip the setup and install by URL:
npx shadcn@latest add https://elements.lumesec.ai/r/px-confirm.jsonUsage
import { PxConfirm } from "@/components/lumesec/px-confirm";
export function Example() {
return (
<PxConfirm doneText="Project deleted" onConfirm={() => console.log("deleted")}>
Delete project
</PxConfirm>
);
}Behaviour
The first click arms it and a pixel fuse burns down along the bottom. A second click inside the window confirms with a burst; Escape, blur or the timeout cancel it.
API reference
Props
Also accepts every prop of <span> (React.ComponentProps<"span">), spread onto the root element.
childrenTypestringDefault"Delete project"Idle label.
timeoutTypenumberDefault3Seconds the armed state lasts before it cancels.
confirmTextTypestringDefault"Click again to confirm"Label while armed.
doneTextTypestringDefault"Deleted"Label shown for 2 s after confirming.
onConfirmType() => voidCalled on the second click inside the window.
onCancelType() => voidCalled when the armed state ends without confirming: Escape, the button losing focus, or the timeout.
Ref
ref points at the root HTMLSpanElement.
Keyboard
| Keys | Action |
|---|---|
| Enter / Space | Arm, then confirm while armed. |
| Escape | Cancel while armed. |
Accessibility
- A native
<button>; its accessible name is the visible label. - The label is an
aria-live="polite"region, so the confirm prompt and the done text are announced. - Moving focus away while armed cancels.
- The fuse is drawn on an
aria-hiddencanvas; the remaining time is not exposed. - Reduced motion: labels swap without rolling and the confirm burst is skipped; the fuse still burns down.
Theming
Styled with Tailwind classes on your shadcn theme tokens, so light and dark follow your theme. The accent comes from --lumesec. See Theming.
This component reads --destructive, --border, --card, --muted-foreground, --lumesec and --lumesec-shine.
Notes
- After confirming, clicks are ignored for 2 s, then the button returns to idle. The root carries
data-state="armed"ordata-state="done"in those states. - The root is a wrapper
spanaround the button, so the sparks can fly past the button's edges.
Related
Was this page helpful?