MeDo

AI मोडल जेनरेटर।

जिस डायलॉग की ज़रूरत है उसे बताएं और MeDo पूरा ढांचा जेनरेट करता है — हेडर, स्क्रॉल होने वाला बॉडी और एक्शन फुटर, साथ में फोकस ट्रैपिंग, बंद होने पर फोकस रिस्टोर, body स्क्रॉल लॉक और मोबाइल बॉटम शीट वेरिएंट।

मोडल
मोडल

मोडल का मुश्किल हिस्सा उसके पीछे वाला पेज है

मोडल शैडो वाले एक सेंटर किए डिब्बे जैसा दिखता है, और इसीलिए इसे बार-बार खराब तरीके से बनाया जाता है। विज़ुअल लेयर मामूली है; मुश्किल हिस्सा पूरी तरह कम्पोनेंट के बाहर रहता है। डायलॉग खोलने पर नीचे के डॉक्यूमेंट को फ्रीज़ करना होता है, कीबोर्ड फोकस को पकड़ना होता है ताकि Tab छिपी कंटेंट में न भटके, बाकी पेज को असिस्टिव टेक्नोलॉजी से छिपाना होता है, और फिर फोकस को ठीक उसी एलिमेंट पर लौटाना होता है जिसने इसे खोला था। आखिरी कदम चूक गए तो कीबोर्ड यूज़र चुपचाप डॉक्यूमेंट के शुरू में पहुंच जाता है और उसे पता ही नहीं चलता कि वह कहां है। डायलॉग और उसका फोकस कॉन्ट्रैक्ट साथ जेनरेट करने का मतलब है कि यह स्टेट मशीन पहले रेंडर से ही सही होती है, QA पास के बाद पैच नहीं की जाती।

6 टेम्पलेट

मोडल टेम्पलेट जो आप जेनरेट कर सकते हैं

हर टेम्पलेट एक असली प्रॉम्प्ट है, स्क्रीनशॉट नहीं। इसे किसी भी AI एडिटर में कॉपी करें, या MeDo में चलाकर React + Tailwind कोड सीधे पाएं।

BasicHeader + Footer

Composable Dialog With Focus Management

The base every other dialog extends. The visual layer takes minutes; the focus contract is the part worth generating rather than hand-writing.

Create a modal dialog with three sizes — sm 400px, md 560px, lg 760px — centered over a black backdrop at 50 percent opacity, 16px radius, soft shadow. Compose it from Header, Body and Footer slots: the header holds a title and an icon-only close button with an aria-label, the body scrolls independently at max-height 70vh, and the footer right-aligns Cancel next to a primary action. On open, move focus to the first interactive element, trap Tab and Shift+Tab inside the dialog, and lock body scroll by compensating for the scrollbar width so the page does not shift. Set role="dialog", aria-modal="true" and aria-labelledby pointing at the title, and restore focus to the trigger on close.

MeDo में आज़माएं
ConfirmationDestructive Confirm

Non-Dismissible Delete Dialog

The one dialog that must ignore Escape and backdrop clicks. A stray click outside the box should never be the gesture that deletes an account.

Create a destructive confirmation dialog: a warning icon, a heading naming the exact resource, a body stating what will be lost and whether it is recoverable, and a footer with Cancel on the left and a red Confirm on the right. Ignore both Escape and backdrop clicks so the action requires a deliberate button press. Move initial focus to Cancel rather than Confirm, so a stray Enter keypress cancels instead of destroying. Use role="alertdialog" with aria-describedby on the body text. Add an optional type-to-confirm mode requiring the resource name to be typed before Confirm enables, with the comparison case-sensitive and trimmed.

MeDo में आज़माएं
FormForm Dialog

Scrolling Form With Sticky Actions

A long form in a dialog needs a body that scrolls under a fixed header and footer, plus an unsaved-changes guard. Losing typed input to a misclick is unforgivable.

Create a form dialog with a fixed header, a scrolling body and a sticky footer holding Cancel and Save. Keep the header and footer outside the scroll container so the actions stay reachable in a long form. Add a dirty-state guard: when any field has changed, intercept Escape and backdrop clicks and show a nested confirm-discard step inside the same dialog rather than opening a second overlay. On validation failure, move focus to the first invalid field and scroll it into view inside the body. Set aria-busy while saving, disable Save without removing it from the tab order, and close only after the request resolves.

MeDo में आज़माएं
MobileBottom Sheet

Sheet That Slides Up on Phones

A centered card on a phone leaves the buttons floating mid-screen, away from the thumb. Same component, different layout under 640px.

Create a dialog that renders as a centered card above 640px and as a bottom sheet below it: full width, rounded top corners only, sliding up from the bottom edge with a 250ms ease-out transform. Add a drag handle at the top and support swipe-to-dismiss with a velocity threshold, falling back to the close button for keyboard and assistive technology. Cap the sheet height at 90vh with the body scrolling inside, and use dynamic viewport units so the mobile browser chrome does not clip the footer. Keep focus trapping and scroll lock identical in both layouts, and disable the slide animation under prefers-reduced-motion.

MeDo में आज़माएं
PlatformNative Dialog

HTML dialog With showModal

The browser already ships focus trapping, top-layer stacking and Escape handling. Choose this and you delete most of the code the custom overlay needed.

Create a modal built on the native HTML dialog element opened with showModal(), so the browser supplies focus trapping, Escape handling and top-layer stacking with no z-index management. Style the backdrop through the ::backdrop pseudo-element. Add the parts the platform does not give you: body scroll lock on open, an entry and exit animation using allow-discrete and the transition-behavior property, and a close-on-backdrop handler that compares the click target to the dialog element rather than its children. Listen for the close event to restore focus and read returnValue, and use autofocus on the element that should receive focus first.

MeDo में आज़माएं
OverlayCommand Palette

Cmd+K Search Dialog

A modal whose focus stays in the input while arrow keys drive a list elsewhere. Roving focus would break typing, so this one runs on aria-activedescendant.

Create a command palette dialog opened by Cmd+K or Ctrl+K: a search input at the top with results grouped by section below, positioned near the top of the viewport rather than vertically centered. Keep DOM focus in the input at all times and move the visual selection with aria-activedescendant so arrow keys navigate the list without stealing focus from typing. Support Enter to run the highlighted command, Escape to close with focus restored to the previously active element, and a scroll-into-view on the highlighted row. Debounce the query, render an empty state naming what was searched for, and announce the result count through a polite live region.

MeDo में आज़माएं

अपने मोडल को कैसे कस्टमाइज़ करें

बताएं कि कौन से डायलॉग बंद नहीं होने चाहिए

सूचना देने वाले डायलॉग के लिए Escape और बैकड्रॉप क्लिक सही डिफ़ॉल्ट हैं, लेकिन डिस्ट्रक्टिव कन्फर्मेशन और बिना सेव इनपुट वाले मल्टी-स्टेप फॉर्म में ये जोखिम हैं। उन वेरिएंट का नाम लें जिन्हें दोनों को नज़रअंदाज़ करना चाहिए, ताकि डिब्बे के बाहर की एक भटकी क्लिक कोई अकाउंट डिलीट न कर दे।

सिर्फ फोकस ट्रैपिंग नहीं, फोकस रिस्टोर भी मांगें

ज़्यादातर प्रॉम्प्ट ट्रैप तो करा लेते हैं पर वापसी का रास्ता भूल जाते हैं। बताएं कि बंद होने पर फोकस ट्रिगर करने वाले एलिमेंट पर लौटे और डायलॉग खुलते समय वह रेफरेंस सेव करे, जिससे कीबोर्ड यूज़र ठीक वहीं से आगे बढ़ें जहां छोड़ा था।

हर ब्रेकपॉइंट पर सेंटर्ड या बॉटम शीट चुनें

फोन पर सेंटर किया डायलॉग एक्शन बटनों को स्क्रीन के बीच में तैरता छोड़ देता है, अंगूठे से दूर। 640px से नीचे बॉटम शीट मांगें जिसमें प्राइमरी एक्शन पहुंच में हो, और चौड़े व्यूपोर्ट के लिए सेंटर्ड लेआउट बनाए रखें।

मोडल के अंदर से मोडल कभी न खोलें

पहले डायलॉग पर दूसरा डायलॉग रखने से फोकस ट्रैप टूटता है, बैकड्रॉप दोगुना हो जाता है, और Escape किस लेयर को बंद करेगा यह अस्पष्ट रह जाता है। इसके बजाय एक ही डायलॉग में स्टेप-आधारित कंटेंट मांगें, जिससे ओवरले एक ही लेयर रहे और फोकस का मालिक भी एक ही हो।

मोडल कंपोनेंट का उपयोग कौन करता है

SaaS प्रोडक्ट

सब्सक्रिप्शन कैंसल करने के लिए बंद न होने वाला कन्फर्मेशन डायलॉग, जिसमें बॉडी में प्लान का नाम दोहराया जाता है और Confirm बटन लाल होता है; साथ में टीम-मेट को इनवाइट करने के लिए हल्का, बंद होने वाला डायलॉग।

ई-कॉमर्स स्टोर

प्रोडक्ट इमेज, साइज़ सेलेक्टर और Add to cart बटन वाला क्विक-व्यू डायलॉग, जो फोन पर बॉटम शीट के रूप में रेंडर होता है ताकि साइज़ ऑप्शन और कार्ट बटन दोनों अंगूठे की पहुंच में रहें।

डैशबोर्ड या एडमिन टूल

बल्क-डिलीट कन्फर्मेशन जो रिकॉर्ड की सटीक संख्या बताता है और Confirm सक्षम होने से पहले रिसोर्स का नाम टाइप करने की मांग करता है, साथ में एक एडिट डायलॉग जिसका लंबा फॉर्म फिक्स्ड हेडर और फुटर के बीच स्क्रॉल होता है।

कंटेंट या मीडिया साइट

फुल-साइज़ इमेज के लिए लाइटबॉक्स डायलॉग, जिसमें एरो-की नेविगेशन, Escape से बंद करना और उसी थंबनेल पर फोकस लौटना शामिल है जिसने इसे खोला था, जिससे गैलरी में पढ़ने की जगह कभी नहीं खोती।

अलग-अलग वेबसाइटों के लिए मोडल पैटर्न

वही मोडल कंपोनेंट, उस वेबसाइट के प्रकार के हिसाब से ढाला गया जहाँ वह लगेगा।

01 / 06

SaaS Product Dialogs

Two classes of dialog with opposite dismissal rules: invite-a-teammate should close on Escape and backdrop click, cancel-my-subscription should close on neither. Decide that per variant rather than globally, because a single dismissal policy across a product means either annoying dialogs or destroyed data.

मोडल की शैलियाँ और वेरिएंट

जो वेरिएंट बाकी पेज से मेल खाता है उसे चुनें और जेनरेट करें।

01 / 06

Centered Dialog

The default above 640px: a fixed-width card centered over a dimmed backdrop. Cap the height at around 70vh with the body scrolling internally, because a dialog taller than the viewport pushes its own footer out of reach and there is no page scroll left to recover it.

React, Next.js, Vue और Svelte में मोडल

React, Next.js, Vue 3, SvelteKit, Astro या सादा HTML — वही मोडल, जोड़ने के छह तरीके।

01 / 06

React Modal

Render through a portal so the dialog escapes any ancestor with overflow hidden or a transform, both of which would clip it. Store the trigger element on open and focus it again in the cleanup, which is the step most hand-rolled modals skip.

src/components/Modal.tsx

export function Modal({ open, onClose, children }) {
  const trigger = useRef(null)

  useEffect(() => {
    if (!open) return
    trigger.current = document.activeElement
    return () => trigger.current?.focus()
  }, [open])

  if (!open) return null
  return createPortal(
    <div role="dialog" aria-modal="true">{children}</div>,
    document.body
  )
}

अपने मोडल को प्रोजेक्ट में कैसे जोड़ें

मोडल टेम्पलेट चुनने से प्रोडक्शन में भेजने तक, चार चरण।

01~30s

Pick a Dialog Template

Scan the six templates and start from the interaction — a destructive confirm, a scrolling form, a mobile bottom sheet, or a Cmd+K palette.

02~10s

Copy the Prompt

Take the prompt into MeDo, Lovable, Bolt, v0 or Cursor. State whether this dialog may be dismissed by Escape and backdrop click before you run it, since that single decision separates a helpful overlay from one that deletes data on a misclick.

03~1min

Generate and Refine

You get React + Tailwind back with a live preview. Follow up in plain English — "make it a bottom sheet under 640px", "focus Cancel first", "build it on the native dialog element" — rather than rewiring the focus trap yourself.

04~2min

Test It With the Keyboard Only

Open it, Tab to the end and confirm focus cycles instead of escaping into the page, then close it and check focus returned to the trigger. Those two checks catch nearly every modal defect that ships.

मोडल के बारे में सामान्य प्रश्न

AI से मोडल कम्पोनेंट कैसे जेनरेट करें?

लेआउट, साइज़ और बंद होने के नियम एक ही प्रॉम्प्ट में बताएं — जैसे "स्क्रॉल होने वाले बॉडी, Cancel और Confirm एक्शन, और Escape को नज़रअंदाज़ करने वाले डिस्ट्रक्टिव वेरिएंट के साथ 560px का सेंटर्ड डायलॉग"। MeDo फोकस ट्रैपिंग, फोकस रिस्टोर, स्क्रॉल लॉक और डायलॉग सिमैंटिक्स सहित कम्पोनेंट जेनरेट करता है, इसलिए आपको स्टाइल किया div नहीं बल्कि काम करने वाला ओवरले मिलता है।

फोकस ट्रैपिंग क्या है और मोडल को इसकी ज़रूरत क्यों है?

फोकस ट्रैपिंग Tab और Shift+Tab को डायलॉग के अंदर के इंटरैक्टिव एलिमेंट में ही घुमाती रहती है, नीचे के पेज में निकलने नहीं देती। इसके बिना कीबोर्ड यूज़र Confirm बटन के आगे उन लिंक तक पहुंच जाता है जो उसे दिखते नहीं — यह भ्रमित करने वाला है और WCAG की विफलता भी। ट्रैप को हमेशा फोकस रिस्टोर के साथ जोड़ें, जो डायलॉग बंद होने पर फोकस ट्रिगर एलिमेंट पर लौटा दे।

बैकड्रॉप पर क्लिक करने से मोडल बंद होना चाहिए?

सूचना देने वाले और कम जोखिम के डायलॉग के लिए हां — बैकड्रॉप क्लिक और Escape वही पैटर्न हैं जिनकी लोग अपेक्षा करते हैं। डिस्ट्रक्टिव कन्फर्मेशन और बिना सेव इनपुट वाले फॉर्म के लिए नहीं: डिब्बे के बाहर की एक ग़लती से हुई क्लिक डेटा नहीं मिटाए और टाइप किया हुआ नहीं छोड़े। जो भी अपरिवर्तनीय हो, उसके लिए स्पष्ट बटन प्रेस अनिवार्य करें।

क्या कस्टम मोडल की जगह नेटिव HTML <dialog> एलिमेंट इस्तेमाल कर सकते हैं?

अक्सर हां। showModal() के साथ नेटिव <dialog> एलिमेंट आपको फोकस ट्रैपिंग, Escape हैंडलिंग, टॉप-लेयर स्टैकिंग और ::backdrop स्यूडो-एलिमेंट मुफ़्त देता है, बिना z-index मैनेज करने की ज़रूरत। body स्क्रॉल लॉक और एनिमेशन आपको अब भी खुद करना होगा, और पुराने ब्राउज़र के लिए फॉलबैक चाहिए। MeDo को बताएं कि आपको नेटिव एलिमेंट चाहिए और यह व्यवहार दोबारा लिखने की जगह उसी पर बनाएगा।

मोबाइल पर मोडल का व्यवहार कैसा होना चाहिए?

लगभग 640px से नीचे बॉटम शीट आम तौर पर सेंटर्ड कार्ड से बेहतर रहती है: यह प्राइमरी एक्शन को अंगूठे के पास टिकाती है, फॉर्म फ़ील्ड के लिए पूरी चौड़ाई देती है और उस प्लेटफ़ॉर्म कन्वेंशन से मेल खाती है जिसे यूज़र पहले से जानते हैं। MeDo दोनों लेआउट एक ही कम्पोनेंट में जेनरेट कर सकता है और आपके बताए ब्रेकपॉइंट पर स्विच कर सकता है।

क्या मोडल को role="dialog" और aria-modal चाहिए?

हां, जब तक आप नेटिव <dialog> एलिमेंट इस्तेमाल नहीं कर रहे, जो सिमैंटिक्स खुद देता है। कस्टम ओवरले के लिए role="dialog", aria-modal="true", और दिखाई देने वाले टाइटल की ओर इशारा करने वाला aria-labelledby चाहिए, या जब कोई दिखने वाला हेडिंग न हो तो aria-label। aria-modal के बिना स्क्रीन रीडर ओवरले के पीछे वाले पेज को ब्राउज़ करने लायक कंटेंट के रूप में दिखाते रहते हैं।

अभी अपना मोडल जेनरेट करें।

कोई भी प्रॉम्प्ट आज़माएं — मुफ्त, कोई साइन अप नहीं।