Skill 01 · Storefront Best Practices
Subchapter 1.12
reference/components/search.mdMarkdown4 KBView on GitHub
Search is critical for ecommerce - users with search intent convert at higher rates. Provide fast, relevant product discovery with autocomplete.
Assumed knowledge: AI agents know how to build search inputs with icons and clear buttons. This guide focuses on ecommerce search patterns.
Desktop: Navbar center (between logo and cart) or right side. Always visible, 300-500px width. Part of sticky navbar. Never hide in hamburger menu.
Mobile: Magnifying glass icon in top-right (44x44px minimum). Opens full-screen modal - eliminates distractions, maximizes suggestion space, better typing experience.
Show suggestions after 2-3 characters (not 1). Debounce 300ms to prevent excessive API calls.
Display 5-10 product suggestions:
Backend integration: Fetch from search API. Check with ecommerce platform’s documentation for API reference.
Header: “Search Results for ‘[query]’” + result count (“24 products found”). Search bar visible and pre-filled for refining.
Grid layout: Same as product listings (see product-listing.md). 1-4 columns based on device.
Sorting: Relevance (default, unique to search), Price Low/High, Newest.
Filters: Sidebar (desktop) or drawer (mobile). Category, Price, Brand, Availability with result counts.
No results: “No results for ‘[query]’” with helpful suggestions (check spelling, try broader keywords, browse categories). “Browse All Products” button + links to popular categories.
Loading state: Product card skeletons (6-8 cards), minimum 300ms display to avoid flashing.
Recent searches (user-specific, localStorage): Show 3-5 recent searches when input focused (before typing). Helps re-search without retyping.
Popular searches (site-wide, from backend): Show 5-10 trending terms when focused. Pill/tag styling.
Display both on: Empty input focus (desktop dropdown), mobile modal open.
Full-screen modal pattern:
type="search")Essential features:
role="search", aria-label)