Source Code

<section class="sbc-hero">
  <div class="sbc-inner">
    <div class="sbc-logo">Findly</div>

    <div class="sbc-searchwrap">
      <svg class="sbc-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m21 21-4.3-4.3"/></svg>
      <input class="sbc-input" id="sbcInput" type="text" placeholder="Search docs, guides, and API references" aria-label="Search" autocomplete="off">
      <button class="sbc-clear" id="sbcClear" aria-label="Clear search" type="button">✕</button>
    </div>

    <div class="sbc-chips" id="sbcChips">
      <button class="sbc-chip" type="button">Getting started</button>
      <button class="sbc-chip" type="button">Authentication</button>
      <button class="sbc-chip" type="button">Webhooks</button>
      <button class="sbc-chip" type="button">Rate limits</button>
      <button class="sbc-chip" type="button">Pricing</button>
    </div>
  </div>
</section>

Search-Engine-Style Hero — Free HTML CSS JS Snippet

Search-Engine-Style Hero · Heroes · Plain HTML, CSS & JS · Live preview

What's included

Features

Search as the whole hero
No competing headline or CTA — the input is the primary action.
Real focus state
A genuine border and box-shadow glow on focus, not a static screenshot.
Working clear button
Appears only once there's real text, tracked with an input listener.
Functional suggestion chips
Clicking a chip fills and focuses the input like a typed query.
Pill-shaped input
Heavy padding and full border-radius read as one confident action.
Zero visual clutter
Generous whitespace keeps attention on a single decision.
Accessible labeling
aria-label on the input and clear button for screen readers.
Responsive sizing
Padding and font size scale down under 480px.

About this UI Snippet

Search-Engine-Style Hero — One Big Input as the Whole Homepage

Screenshot of the Search-Engine-Style Hero snippet rendered live

Most marketing heroes lead with a headline and a CTA button. This one leads with a search box — the search-engine-homepage pattern, where the input itself is the primary and only interactive element, and everything else (a logo, a handful of suggestion chips) exists to support it. It's the right hero for a docs site, an internal tool, or any product whose entire value proposition is "find the thing fast."

Minimalism as a design decision, not an oversight

There's no headline, no subheading, no CTA button competing for attention — just a logo mark and one large pill-shaped input, centered in the viewport with generous surrounding whitespace. This isn't a stripped-down placeholder; it's a deliberate echo of the search-engine homepage pattern (Google, Algolia's own doc search, Kagi), which works because it removes every decision except "type and go."

A real, working input, not a static mockup

The input has a genuine focus ring (border-color shift plus a soft box-shadow glow) and a clear button that only appears once there's actual text in the field — tracked with a real input event listener, not just CSS :placeholder-shown tricks. Clicking the clear button empties the field, hides itself again, and returns focus to the input, the same round-trip a real search UI needs.

Suggestion chips that actually populate the field

Below the input, a row of topic chips (Getting started, Authentication, Webhooks...) are real buttons wired with click handlers that set the input's value to the chip's label and refocus the field — clicking a chip functions exactly like typing that query yourself, including making the clear button appear. This is the same pattern search and docs sites use for zero-effort query suggestions.

Why a pill shape and heavy padding

The border-radius: 999px pill shape and generous 17px vertical padding are deliberate: a search input this size reads as a single confident action rather than a form field to fill out, and the large touch target matters as much on mobile as it does for visual weight on desktop.

Customizing it

Wire the input event or a submit trigger (Enter key, or add a submit button) to your actual search endpoint or client-side search index. Replace the suggestion chips with your product's real popular queries or categories. Swap the logo for your wordmark, and adjust the accent color used in the focus ring and chip-hover state to match your brand.

Build with AI

Build, Understand, Optimize, and Extend It With AI

You don't have to guess whether the clear-button logic is solid. Paste this snippet's HTML, CSS, and JS into an AI coding assistant like Claude and ask it to explain how the has-value class toggling keeps the clear button's visibility genuinely tied to the input's real content instead of relying on a CSS-only pseudo-class trick, and why removing the competing headline and CTA is a deliberate design choice for a search-first product rather than an unfinished hero. The same assistant can help you wire it up for real — ask it to add a debounced fetch call to a search API as the user types, or to implement keyboard navigation (arrow keys, Enter) across a dropdown of live results appearing beneath the input. It's also useful for extending the pattern: ask it to add recent-search memory via localStorage, or make the suggestion chips dynamically ranked by click frequency. Treat the code less like a finished artifact and more like a starting point for a conversation.

Prompt to recreate it

Copy this into your AI assistant of choice to build the effect from scratch, or as a jumping-off point for your own variant:

text
Build a minimal, search-engine-homepage-style hero in plain HTML, CSS, and JavaScript — no framework, no search library.

Requirements:
- A centered, vertically-stacked hero with a small logo/wordmark above one large, pill-shaped (fully rounded) search input as the clear visual centerpiece — no competing headline or call-to-action button, since the search input itself is the primary action.
- The input needs a real, working focus state (a visible border color change plus a soft glow via box-shadow) — not just a static screenshot-style appearance.
- Add a small circular clear button positioned inside the input on the right side that is hidden by default and only becomes visible once the input actually contains text, tracked with a real input event listener (not a CSS-only trick). Clicking it must empty the input, hide itself again, and refocus the input.
- Below the input, add a row of five small pill-shaped suggestion chip buttons with short topic labels. Clicking any chip must set the input's value to that chip's label text and refocus the input — functioning exactly as if the user had typed that query themselves, including making the clear button appear.
- Keep the whole layout minimal with generous whitespace, and make it responsive so the input and logo scale down cleanly on narrow screens.

Want to tighten it up first? Run this prompt through the AI Prompt Studio to score it across 8 quality dimensions, catch anti-patterns, and tune the wording for Claude, ChatGPT, or Gemini before you paste it in.

Step by step

How to Use

  1. 1
    Paste the HTML, CSS, and JSA minimal hero renders — a logo, a large pill-shaped search input, and suggestion chips.
  2. 2
    Click into the inputA focus ring appears around the field.
  3. 3
    Type a queryA clear button fades in on the right; clicking it empties the field and refocuses it.
  4. 4
    Click a suggestion chipThe input fills with that chip's text and refocuses, exactly as if you'd typed it.
  5. 5
    Wire up real searchConnect the input event (or an Enter/submit trigger) to your search endpoint or index.
  6. 6
    Customize the chipsReplace the five suggestions with your product's real popular queries.

Real-world uses

Common Use Cases

Documentation site homepages
Lead with search instead of a marketing pitch when users arrive to find something specific.
Internal tools and knowledge bases
Pair with a search box used elsewhere in the app for consistency.
Search products and directories
The obvious hero pattern when search is the entire product.
API reference and developer portals
Chips can surface top endpoints or guides instead of marketing links.
Help centers and support portals
Reduce ticket volume by making self-serve search the first thing visitors see.
Learning minimal, single-action hero design
A reference for stripping a hero down to one clear interaction.
Related: Hero with 3D Tilting Product Mockup
See the Hero with 3D Tilting Product Mockup for a related heroes pattern worth pairing with this one.

Got questions?

Frequently Asked Questions

An input event listener checks input.value.length on every keystroke and toggles a has-value class on the wrapping element. The CSS only displays .sbc-clear when that class is present, so the button genuinely tracks the field's real content rather than relying on a CSS-only :placeholder-shown trick, which wouldn't reset correctly after the field is cleared programmatically.

Each chip has its own click handler that sets the input's value to the chip's text content and calls input.focus(). This also triggers the same has-value state update as manual typing would (the code calls the same sync function), so the clear button appears immediately, exactly matching the behavior of typing the query yourself.

No — it handles the input's visual and interaction states (focus, clear, chip-fill) but doesn't call any search API or filter any data, since that depends entirely on your backend or search index. Wire a submit handler (Enter keypress, or add a submit button) to your real search endpoint or a client-side library like Fuse.js or Algolia's InstantSearch.

A fully rounded, heavily padded input reads as a single confident action rather than one field among many in a form — the search-engine-homepage convention. It also gives a larger, easier touch target on mobile, which matters when the input is the hero's only interactive element.

Hold the query string in state. The input's onChange updates it and derives the has-value condition directly from the string's length (no separate class-toggling needed). Each chip's onClick sets the same state value. Bind the clear button's visibility to query.length > 0. Click JSX, Vue, or Angular in the export panel for the converted component.