MeDo

AI सर्च बार जेनरेटर।

बताएं कि लोग क्या खोजते हैं और MeDo पूरा विजेट जेनरेट करता है — debounce की गई क्वेरी, typeahead ड्रॉपडाउन, ऐरो-की नेविगेशन, हाल की सर्च, लोडिंग और नो-रिजल्ट स्टेट्स, और फोकस के लिए cmd+K शॉर्टकट।

सर्च बार
सर्च बार

सर्च बार एकमात्र input है जहां विज़ुअल फोकस और DOM फोकस अलग-अलग होते हैं

पेज पर बाकी हर चीज़ में फोकस और हाइलाइट एक ही जगह रहते हैं। typeahead में यह संभव नहीं: कैरेट को टेक्स्ट फील्ड में रहना पड़ता है ताकि लोग टाइप करते रह सकें, जबकि हाइलाइट सजेशन लिस्ट में नीचे चलता है। सही पैटर्न aria-activedescendant है, जिसमें input DOM फोकस रखता है और id के ज़रिए एक्टिव ऑप्शन की ओर इशारा करता है। जो इम्प्लीमेंटेशन असली फोकस लिस्ट में ले जाते हैं, वे टाइपिंग तुरंत तोड़ देते हैं — यही कारण है कि कई हाथ से बनी सर्च बार माउस से चलती हैं और कीबोर्ड पर बिखर जाती हैं। फील्ड और लिस्ट को एक ही विजेट के रूप में जेनरेट करने का मतलब है कि यह संबंध शुरू से जुड़ा होता है, बग रिपोर्ट के बाद पैच नहीं किया जाता।

6 टेम्पलेट

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

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

BasicInput + Clear

Plain Search Field With Submit

No dropdown, no fetch — just a field that submits to a results page. Start here when the corpus is large enough that suggestions would be guesses rather than shortcuts.

Create a search field: a 40px-tall rounded input inside a real form with role="search", type="search" on the input, enterkeyhint="search" for mobile keyboards, and a visible label or aria-label since a magnifier icon is not an accessible name. Put a 16px magnifier on the left with aria-hidden, and a clear button on the right that appears only once there is text, is a real button with an accessible label, and returns focus to the input after clearing. Enter submits the raw query through the form so search still works with JavaScript disabled. Escape clears the field when it has text. Show a focus-visible ring on the wrapper, not the bare input, so the icon and field read as one control.

MeDo में आज़माएं
ComboboxTypeahead

Debounced Suggestions Listbox

The full combobox: debounce, listbox, aria-activedescendant. The critical rule is that DOM focus never leaves the input, or typing stops working the moment someone presses Arrow Down.

Create a typeahead search bar using the ARIA combobox pattern: aria-expanded, aria-controls and aria-activedescendant on the input, role="listbox" on the panel, role="option" with a unique id on each row. DOM focus must stay in the text field at all times — move the visual highlight by updating aria-activedescendant, never by focusing an option, or typing breaks. Debounce queries at 250ms and cancel in-flight requests so a slow earlier response cannot overwrite a newer one. Arrow Down and Up move the active option and wrap at the ends, Home and End jump to the first and last, Enter selects the active option or submits the raw query when none is active, Escape closes the panel and restores the typed text, and Tab closes and moves on rather than walking the options.

MeDo में आज़माएं
cmd+KCommand Palette

Modal Search Overlay

Search as primary navigation, opened from anywhere with cmd+K. It is a modal dialog, which means a focus trap and focus restoration — the part most palette clones skip.

Create a command-palette search overlay opened by cmd+K and ctrl+K: a centered dialog with a backdrop, using the native dialog element or role="dialog" with aria-modal="true". Trap focus inside it, place initial focus in the input, close on Escape and backdrop click, and return focus to the element that was focused before opening. Ignore the shortcut while the user is typing in another input or a contenteditable region. Inside, run the ARIA combobox pattern with aria-activedescendant, group results under headed sections such as Pages, Docs and Actions, and let Arrow Down and Up move across group boundaries while skipping the group headings. Show a visible cmd+K hint in the trigger and keyboard hints in the dialog footer.

MeDo में आज़माएं
StatesRecent + Empty

Search With Recent Queries and No-Results

Three panels, not one: recent searches on an empty query, skeleton rows in flight, a no-results row with a fallback. Leave any out and the dropdown flickers blank between keystrokes.

Create a search bar that renders three distinct dropdown states rather than one panel that empties. On an empty query, show up to five recent searches from localStorage under a Recent heading, each with a small remove button and a Clear all action. While a request is in flight, keep the previous results visible and overlay three skeleton rows, and swap the magnifier for an inline spinner rather than blanking the panel. On zero matches, show a no-results row naming the query plus a "Search everything" fallback action that submits the raw text. Announce the outcome in an aria-live="polite" region — "8 results available" or "No results" — debounced so intermediate counts are not read out. Arrow keys, Enter and Escape behave identically in all three states.

MeDo में आज़माएं
FiltersScoped Search

Search With Scope Chips and Filters

A scope chip inside the field narrows the query before it runs. Make Backspace on an empty query remove the chip — anything else and people are hunting for a tiny × with the mouse.

Create a scoped search bar: removable scope chips render inside the input wrapper to the left of the text caret, each a button with an accessible label such as "Remove filter: Invoices". Pressing Backspace with an empty query removes the last chip rather than doing nothing, and typing a known prefix followed by a colon converts it into a chip. Keep the chips out of the input value itself and send them as separate query parameters. Below the field, render filter pills that are toggle buttons with aria-pressed, and re-run the debounced query on every change. Preserve the caret position when a chip is added, keep the ARIA combobox wiring for the suggestion listbox, and reflect the active scope in the aria-live result-count announcement.

MeDo में आज़माएं
Media rowsRich Results

Suggestions With Thumbnails and Prices

Product and media rows where each suggestion carries an image, title and price. Reserve the thumbnail box explicitly, or every keystroke reflows the panel as images resolve.

Create a search bar with rich suggestion rows: each row is a role="option" containing a 40px thumbnail with explicit width and height attributes so the panel does not reflow as images load, a title with the matched substring bolded, and a secondary line with price or category. Because the row holds several elements, give each option an aria-label describing the whole row so a screen reader hears one coherent option rather than fragments. Cap the panel at 320px with internal scroll, and scroll the active option into view with block nearest as aria-activedescendant moves. Keep the last row a "See all results for <query>" action that submits the raw text. Highlight matches by wrapping the substring, never by injecting HTML from the response.

MeDo में आज़माएं

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

debounce अंतराल बताएं

"input को debounce करो" के बजाय "250ms पर debounce करो" कहें। लगभग 150ms से कम पर हर कीस्ट्रोक पर एक रिक्वेस्ट जाती है; करीब 400ms से आगे ड्रॉपडाउन टूटा हुआ महसूस होता है। इसके साथ कैंसिलेशन भी मांगें ताकि कोई धीमी पुरानी रिस्पॉन्स नई को ओवरराइट न कर दे।

तीनों खाली स्टेट अलग-अलग बताएं

खाली क्वेरी, चल रही क्वेरी और शून्य रिजल्ट तीन अलग स्क्रीन हैं। पहली के लिए हाल की सर्च, दूसरी के लिए स्पिनर या skeleton पंक्तियां, और तीसरी के लिए नो-रिजल्ट पंक्ति के साथ फॉलबैक एक्शन मांगें। किसी एक को छोड़ दें तो पैनल खाली झपकता रहेगा।

बताएं कि Enter सबमिट करता है या चुनता है

कोई सजेशन हाइलाइट होने पर Enter उसे चुने; कुछ भी हाइलाइट न होने पर Enter कच्ची क्वेरी को रिजल्ट पेज पर सबमिट करे। दोनों शाखाएं स्पष्ट लिखें, और role="search" वाला असली form मांगें ताकि सबमिट पाथ JavaScript के बिना भी काम करे।

रिजल्ट संख्या अनाउंस करने को कहें

देख सकने वाले यूज़र लिस्ट बढ़ते देखते हैं। स्क्रीन रीडर यूज़र को aria-live="polite" रीजन चाहिए जो "8 रिजल्ट उपलब्ध हैं" जैसा कुछ बोले। लाइव रीजन स्पष्ट रूप से मांगें, और कहें कि उसे भी debounce किया जाए ताकि हर बीच की गिनती न पढ़ी जाए।

सर्च बार कंपोनेंट का उपयोग कौन करता है

डॉक्यूमेंटेशन साइट

एक cmd+K सर्च बार जो पेज के ऊपर खुलती है, हिट्स को सेक्शन के हिसाब से ग्रुप करती है, हर टाइटल के नीचे मैच हुई पंक्ति दिखाती है, और आखिरी पांच क्वेरी रखती है ताकि आधी-याद पेज पर लौटा जा सके।

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

हर पंक्ति में थंबनेल, नाम और कीमत वाले प्रोडक्ट सजेशन, उनके ऊपर कैटेगरी शॉर्टकट, और नीचे एक "… के सभी रिजल्ट देखें" पंक्ति जो कच्ची क्वेरी को पूरे रिजल्ट पेज पर सबमिट करती है।

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

एक ही फील्ड जो कस्टमर, इनवॉइस और सेटिंग्स में खोजती है, रिजल्ट टाइप के अनुसार ग्रुप होते हैं, और input में स्कोप चिप होती है ताकि टाइप करने से पहले किसी एक एंटिटी तक सीमित किया जा सके।

कंटेंट या मीडिया लाइब्रेरी

एक चौड़ी सर्च बार जिसके बगल में फिल्टर पिल हों, क्वेरी चलने के दौरान skeleton पंक्तियां, और नो-रिजल्ट स्टेट जो खाली पैनल दिखाने के बजाय स्पेलिंग सुधार सुझाए।

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

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

01 / 06

Documentation Search

A cmd+K palette that groups hits by section and shows the matching line under each title, since a page title alone rarely tells a reader whether the answer is on it. Keep the last five queries — docs search is mostly people returning to a page they half remember.

सर्च बार की शैलियाँ और वेरिएंट

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

01 / 06

Inline Field Search

A permanent bordered input in the header or page body. The most discoverable option and the only one that works without JavaScript, since a real form with role="search" submits on Enter regardless. Give the wrapper the focus ring so the icon and field read as one control.

React, Next.js, Vue और Svelte में सर्च बार

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

01 / 06

React Search Bar

Track the active index as a number and derive aria-activedescendant from it — that is the entire highlight mechanism, with no focus moves. Abort the previous fetch in the effect cleanup so a slow response cannot land after a newer one.

src/components/SearchBar.tsx

const [active, setActive] = useState(-1)
const debounced = useDebounce(query, 250)

<input
  type="search"
  role="combobox"
  aria-expanded={open}
  aria-controls="search-listbox"
  aria-activedescendant={active >= 0 ? `opt-${active}` : undefined}
  onKeyDown={onArrowKeys}
/>

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

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

01~30s

Pick a Search Pattern

Decide whether you need suggestions at all. A plain field posting to a results page is often the honest answer; reach for the typeahead or the cmd+K palette only when search is a primary navigation path.

02~10s

Copy the Prompt

Take the prompt into MeDo, Lovable, Bolt, v0 or Cursor, then set two numbers: the debounce interval and how many suggestions the panel shows. Name what is being searched too, since that decides how a result row is shaped.

03~1min

Generate and Refine

You get React + Tailwind back with a live preview. Follow up in plain English — "add recent searches", "group results by type", "announce the result count politely" — rather than rewriting the keydown handler.

04~2min

Connect Your Index and Ship

Point the query at your real endpoint, then test with the keyboard only: type, Arrow Down, Enter, Escape. If typing stops working after Arrow Down, focus was moved into the list and the highlight needs to go back to aria-activedescendant.

सर्च बार के बारे में सामान्य प्रश्न

AI से सर्च बार कैसे जेनरेट करें?

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

सर्च बार और ऑटोकंप्लीट में क्या अंतर है?

सर्च बार फ्री-टेक्स्ट क्वेरी सबमिट करती है और सजेशन को शॉर्टकट मानती है, इसलिए बिना मैच वाला कुछ टाइप करना भी मान्य है। ऑटोकंप्लीट वैल्यू को एक लिस्ट तक सीमित करता है, इसलिए input तभी कमिट होता है जब कोई ऑप्शन चुना जाए। यह अंतर मार्कअप बदल देता है: सर्च बार role="search" वाले form में आती है, जबकि सीमित ऑटोकंप्लीट एक combobox है जो फॉर्म वैल्यू से बंधा होता है।

क्या AI एक्सेसिबल सर्च बार जेनरेट कर सकता है?

हां, अगर आप पैटर्न का नाम लेकर मांगें। MeDo ARIA combobox पैटर्न लागू करता है — input पर aria-expanded, aria-controls और aria-activedescendant, पैनल पर role="listbox" और role="option", और रिजल्ट संख्या के लिए polite लाइव रीजन। फोकस पूरे समय टेक्स्ट फील्ड में रहता है, और यही टाइपिंग तथा ऐरो कीज़ को साथ काम करने देता है।

सर्च ड्रॉपडाउन में कीबोर्ड नेविगेशन कैसा होना चाहिए?

ऐरो डाउन पहले सजेशन पर जाए और लिस्ट में नीचे बढ़े, ऐरो अप वापस आए और फोकस कच्ची क्वेरी को लौटा सके, Enter हाइलाइट किया आइटम चुने, और Escape पैनल बंद करके टाइप किया गया टेक्स्ट वापस लाए। लंबी लिस्ट के लिए Home और End उपयोगी जोड़ हैं। Tab को ऑप्शन में घूमने के बजाय पैनल बंद कर आगे बढ़ना चाहिए।

क्या input पर type="search" उपयोग करना चाहिए?

हां। कुछ प्लेटफॉर्म पर यह ब्राउज़र का क्लियर अफोर्डेंस देता है, सहायक तकनीक को मंशा बताता है, और मोबाइल कीबोर्ड पर enterkeyhint="search" के साथ मेल खाता है। इसे role="search" वाले असली form में लपेटें ताकि स्क्रिप्ट फेल होने पर भी क्वेरी सबमिट हो, और input को label या aria-label दें क्योंकि अकेला मैग्निफायर आइकन एक्सेसिबल नाम नहीं है।

क्या सर्च बार को cmd+K शॉर्टकट की जरूरत है?

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

अभी अपना सर्च बार जेनरेट करें।

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