BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/karrix/unsave-popup-demo

unsave-popup-demo

karrix/unsave-popup-demo
FreeExample

Example of the kl-ui unsave-popup component.

Install it

npx shadcn@latest add https://karrix.dev/r/unsave-popup-demo.json

Source

registry/kl-ui/unsave-popup/unsave-popup-demo.tsxkarrix.dev/r/unsave-popup-demo.json
1import { Label } from "@/components/ui/label";
2import { X, Info } from "lucide-react";
3import { Input } from "@/components/ui/input";
4import { useState, useCallback, useMemo } from "react";
5import { Button } from "@/components/ui/button";
6import { UnsavePopup } from "@/components/kl-ui/unsave-popup";
7import { cn } from "@/lib/utils";
8
9export function UnsavePopupDemo() {
10 const [value, setValue] = useState("");
11 const [showPopup, setShowPopup] = useState(false);
12 const [shouldBlockNav, setShouldBlockNav] = useState(false);
13 const [closeForm, setCloseForm] = useState(false);
14 const [isSaved, setIsSaved] = useState(false);
15
16 const handleInputChange = useCallback(
17 (e: React.ChangeEvent<HTMLInputElement>) => {
18 setValue(e.target.value);
19 setShowPopup(true);
20 setIsSaved(false);
21 },
22 []
23 );
24
25 const handleSave = useCallback(async () => {
26 await new Promise((resolve) => setTimeout(resolve, 1000));
27 setShowPopup(false);
28 setIsSaved(true);
29 }, []);
30
31 const handleReset = useCallback(() => {
32 setValue("");
33 setShowPopup(false);
34 setShouldBlockNav(false);
35 }, []);
36
37 const handleCloseFormClick = useCallback(() => {
38 if (value && !isSaved) {
39 setShouldBlockNav(true);
40 setTimeout(() => setShouldBlockNav(false), 100);
41 return;
42 }
43 setCloseForm(true);
44 }, [value, isSaved]);
45
46 const shouldBlockFn = useCallback(() => shouldBlockNav, [shouldBlockNav]);
47
48 const formContent = useMemo(
49 () => (
50 <div className="grid w-full max-w-sm items-center gap-1.5">
51 <Label htmlFor="name" className="font-medium">
52 Name
53 </Label>
54 <Input
55 placeholder="Type anything to trigger it..."
56 value={value}
57 className="text-sm"
58 onChange={handleInputChange}
59 />
60 </div>
61 ),
62 [value, handleInputChange]
63 );
64
65 const popupContent = useMemo(
66 () => (
67 <>
68 <Info className="h-4 w-4" /> Try to press the &quot;x&quot; to close it!
69 </>
70 ),
71 []
72 );
73
74 return (
75 <>
76 {!closeForm && (
77 <div
78 key="preview"
79 className="flex flex-col h-full items-center justify-center p-2"
80 >
81 <div
82 className={cn(
83 "flex items-center justify-center p-4 gap-2 border border-gray-200",
84 "rounded-lg w-full max-w-[500px] h-[300px] shadow-md relative"
85 )}
86 >
87 {formContent}
88 <div className="absolute top-1 right-1">
89// … truncated

What it pulls in

Other registry items

  • https://karrix.dev/r/unsave-popup

Files it writes

  • registry/kl-ui/unsave-popup/unsave-popup-demo.tsx

Facts

Registry
karrix
Type
registry:example
Access
Free
Files written
1
Licence
MIT
In the index
at or before 2026-08-11
Last confirmed
today

Go to the source

Docs on karrix karrix.dev KarrixLee/KL-ui on GitHub Raw registry item This item as JSON

More from karrix

All 4 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
info-card-demoinfo-card-demokarrixExamplesFreeno deps

Also from Kynth Studios

Built for the same person as BlockDex

SkillWorks

Claude Code skills and plugins, scored

skillworks.kynth.studio

RuleStack

AGENTS.md gallery and agent-config comparison

rulestack.kynth.studio

ToolDrift

What the AI coding tools changed last night

tooldrift.kynth.studio

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex