بنقرة واحدة
potatocreating-modals
Use when creating or modifying modal dialogs in the web-react application
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Use when creating or modifying modal dialogs in the web-react application
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
| name | potato:creating-modals |
| description | Use when creating or modifying modal dialogs in the web-react application |
This skill documents the correct patterns for creating modal dialogs in the web-react application.
All modals use the Radix UI-based Dialog components from @/components/ui/dialog:
import {
Dialog,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
The dialog component uses the project's theme variables by default:
bg-bg-secondaryborder-bordertext-text-primarytext-text-secondaryThese are baked into the base DialogContent, DialogTitle, and DialogDescription components, so you typically don't need to override them.
<Dialog open={isOpen} onOpenChange={setIsOpen}>
<DialogContent>
<DialogHeader>
<DialogTitle>Modal Title</DialogTitle>
<DialogDescription>
Description text explaining what this modal does.
</DialogDescription>
</DialogHeader>
{/* Modal body content */}
<div className="space-y-4 py-2">{/* Form fields, content, etc. */}</div>
<DialogFooter>
<Button variant="outline" onClick={() => setIsOpen(false)}>
Cancel
</Button>
<Button onClick={handleSubmit}>Confirm</Button>
</DialogFooter>
</DialogContent>
</Dialog>
For destructive actions, use a warning icon and destructive button variant:
import { AlertTriangle } from "lucide-react";
<Dialog open={showDeleteDialog} onOpenChange={setShowDeleteDialog}>
<DialogContent>
<DialogHeader>
<DialogTitle className="flex items-center gap-2">
<AlertTriangle className="h-5 w-5 text-accent-red" />
Delete Item?
</DialogTitle>
<DialogDescription>
Are you sure you want to delete this item? This action cannot be undone.
</DialogDescription>
</DialogHeader>
<DialogFooter>
<Button
variant="outline"
onClick={() => setShowDeleteDialog(false)}
disabled={isDeleting}
>
Cancel
</Button>
<Button
variant="destructive"
onClick={handleDelete}
disabled={isDeleting}
>
{isDeleting ? "Deleting..." : "Delete"}
</Button>
</DialogFooter>
</DialogContent>
</Dialog>;
For modals with form inputs:
<Dialog open={isOpen} onOpenChange={(open) => !open && handleClose()}>
<DialogContent className="sm:max-w-lg">
<DialogHeader>
<DialogTitle>Add Item</DialogTitle>
<DialogDescription>
Fill out the form below to add a new item.
</DialogDescription>
</DialogHeader>
<div className="space-y-4 py-2">
<div className="space-y-2">
<label htmlFor="field-name" className="text-sm text-text-secondary">
Field Label
</label>
<input
id="field-name"
type="text"
value={value}
onChange={(e) => setValue(e.target.value)}
placeholder="Enter value"
disabled={isSubmitting}
className="w-full bg-bg-tertiary border border-border rounded-md px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-accent"
/>
</div>
{error && <p className="text-sm text-accent-red">{error}</p>}
</div>
<DialogFooter>
<Button variant="outline" onClick={handleClose} disabled={isSubmitting}>
Cancel
</Button>
<Button onClick={handleSubmit} disabled={!isValid || isSubmitting}>
{isSubmitting ? (
<>
<Loader2 className="h-4 w-4 mr-1 animate-spin" />
Saving...
</>
) : (
"Save"
)}
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
Use these classes for form inputs inside modals:
className =
"w-full bg-bg-tertiary border border-border rounded-md px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-accent";
Or use the Input component from @/components/ui/input if available.
const [showModal, setShowModal] = useState(false);
// In stores/appStore.ts
addProjectModalOpen: boolean
openAddProjectModal: () => void
closeAddProjectModal: () => void
// Usage
const isOpen = useAppStore((s) => s.addProjectModalOpen)
const closeModal = useAppStore((s) => s.closeAddProjectModal)
When creating a modal:
@/components/ui/dialogDialogContent (theme styles are built-in)DialogHeader with DialogTitle and DialogDescriptionDialogFooter with Cancel and primary action buttonsdisabled prop on buttonsvariant="destructive" for dangerous actionsUse this skill to add comments or notes to an existing task. Comments help track progress, document decisions, or explain issues.
You MUST use this anytime you want to ask the user a question or feel like something is unclear. If you think you want to use the AskUserQuestion tool, first invoke this skill, we may have a different way of asking the user a question.
You MUST use this skill in order to create, update, edit, or build artifacts or files. Artifacts can be of any type but are typically markdown files.
Use this skill to create a new task for tracking work within the current ticket. Tasks help break down work into smaller trackable units.
Use this skill to create a new ticket in the current project. Use this to convert a brainstorm into a formal ticket for tracking development work.
Use this skill to retrieve details of a specific task by its ID. Returns the task's description, status, comments, and other metadata.