Dialog with Password Confirmation
blocks/dialog-05FreeBlock
A dialog with password confirmation block.
Install it
npx shadcn@latest add https://blocks.so/r/dialog-05.jsonSource
1'use client';23import { EyeIcon, EyeOffIcon } from 'lucide-react';4import { type FormEvent, useState } from 'react';5import {6 AlertDialog,7 AlertDialogCancel,8 AlertDialogContent,9 AlertDialogDescription,10 AlertDialogFooter,11 AlertDialogHeader,12 AlertDialogTitle,13 AlertDialogTrigger,14} from '@/components/ui/alert-dialog';15import { Button } from '@/components/ui/button';16import { Input } from '@/components/ui/input';17import { Label } from '@/components/ui/label';1819export default function Dialog05() {20 const [isOpen, setIsOpen] = useState(true);21 const [isVisible, setIsVisible] = useState<boolean>(false);2223 const toggleVisibility = () => setIsVisible((prevState) => !prevState);24 const handleSubmit = (event: FormEvent<HTMLFormElement>) => {25 event.preventDefault();26 setIsOpen(false);27 };2829 return (30 <AlertDialog onOpenChange={setIsOpen} open={isOpen}>31 <AlertDialogTrigger render={<Button variant="destructive" />}>32 Delete Workspace33 </AlertDialogTrigger>34 <AlertDialogContent className="sm:max-w-md">35 <AlertDialogHeader>36 <AlertDialogTitle className="text-balance">37 Delete workspace38 </AlertDialogTitle>39 <AlertDialogDescription className="text-pretty">40 All workspace data will be permanently deleted. There is no coming41 back after you press delete.42 </AlertDialogDescription>43 </AlertDialogHeader>44 <form onSubmit={handleSubmit}>45 <div>46 <Label className="font-medium text-sm" htmlFor="delete-workspace">47 Confirm password48 </Label>49 <div className="relative mt-2">50 <Input51 className="pe-9"52 id="delete-workspace"53 name="delete-workspace"54 placeholder="Password"55 required56 type={isVisible ? 'text' : 'password'}57 />58 <button59 aria-controls="delete-workspace"60 aria-label={isVisible ? 'Hide password' : 'Show password'}61 aria-pressed={isVisible}62 className="absolute inset-y-0 end-0 flex h-full w-9 items-center justify-center rounded-e-md"63 onClick={toggleVisibility}64 type="button"65 >66 {isVisible ? (67 <EyeOffIcon aria-hidden="true" size={16} />68 ) : (69// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from blocks
All 76 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| AI Chat with Voice Inputai-01 | blocks | Blocks | Free | 1 dep | |
| AI Chat with Model Selectionai-02 | blocks | Blocks | Free | 1 dep | |
| AI Chat Compact Interfaceai-03 | blocks | Blocks | Free | 1 dep | |
| AI Chat with File Attachmentsai-04 | blocks | Blocks | Free | 1 dep | |
| AI Elements Chatai-05 | blocks | Blocks | Free | 2 deps | |
| Command Menu with Groupscommand-menu-01 | blocks | Blocks | Free | 1 dep | |
| Command Menu with Keyboard Shortcutscommand-menu-02 | blocks | Blocks | Free | 1 dep | |
| Command Menu with Documentation Searchcommand-menu-03 | blocks | Blocks | Free | 1 dep |
