Installation
Dependencies
This component requires the following dependencies:alert-dialog- shadcn/ui alert dialog componentbutton- shadcn/ui button componentinput- shadcn/ui input componentlabel- shadcn/ui label componentlucide-react- Icon library (EyeIcon, EyeOffIcon)
Usage
Features
- Multiple fields - Email (disabled) and password inputs
- Password toggle - Show/hide password functionality
- Disabled email - Pre-filled, non-editable email field
- Form validation - Required password field
- Accessible controls - Proper ARIA attributes for visibility toggle
- Destructive action - Uses destructive button styling
- Form submission - Handles submit event with validation
- Large dialog - Uses
sm:max-w-lgfor comfortable form layout
Component Structure
The component includes:AlertDialogwith controlled stateAlertDialogTriggerwith destructive variantAlertDialogContentwith large widthAlertDialogHeaderwith warning title and instructions- Form with
space-y-4for field spacing:- Email input (disabled)
- Password input with visibility toggle:
- Eye/EyeOff icon button
- Dynamic type attribute (text/password)
- ARIA attributes for accessibility
AlertDialogFooterwith Cancel and Deactivate buttons- State management for:
- Dialog open/close
- Password visibility
- Form submit handler
The email field is disabled to prevent changes, showing the account being affected. The password visibility toggle uses proper ARIA attributes (
aria-label, aria-pressed, aria-controls) for screen reader support.