404 With Site Search

Search-first 404 page: a controlled search field with a submit handler, plus a bordered list of suggested pages with titles, descriptions, and hover arrows.

FREE

A 404 page that treats search as the primary recovery path: a controlled input with a submit handler sits directly under the heading, followed by a bordered list of suggested destinations with titles, descriptions, and hover arrows.

Free block

This block is free. No license or account is required: install it with the CLI and use it in unlimited projects.

Installation

Radix flavor

bash
npx shadcn add "https://ui.beste.co/r/error2"

Base UI flavor

bash
npx shadcn add "https://ui.beste.co/r-base/error2"

This installs the block to components/beste/block/error2.tsx, plus the button and input shadcn/ui primitives it uses for the search form.

Quick start

The installed file exports error2Demo alongside the block: the exact props behind the preview above. Spread it to get a working 404 screen in one line.

tsx
import { Error2, error2Demo } from "@/components/beste/block/error2";

export default function NotFound() {
  return <Error2 {...error2Demo} />;
}

Wire onSearch to your own search route and pass your own destinations:

tsx
"use client";

import { useRouter } from "next/navigation";
import { Error2 } from "@/components/beste/block/error2";

export default function NotFound() {
  const router = useRouter();

  return (
    <Error2
      code="Error 404"
      heading="We could not find that page"
      description="Search the site instead, or jump to one of these pages."
      labels={{
        placeholder: "Search documentation",
        submit: "Search",
        suggestions: "Suggested pages",
      }}
      suggestions={[
        { title: "Getting started", description: "Install and ship", href: "/docs" },
        { title: "Support", description: "Get help from a human", href: "/support" },
      ]}
      onSearch={(query) => router.push(`/search?q=${encodeURIComponent(query)}`)}
    />
  );
}

Props

PropTypeDefaultDescription
codestringSmall uppercase status label above the heading
headingstringMain page heading, rendered as an h1
descriptionstringExplanatory paragraph under the heading
labelsError2Labels{}Search placeholder, submit button text, and suggestion list caption
suggestionsSuggestionLink[][]Rows in the bordered suggestion list
onSearch(query: string) => voidCalled on form submit with the trimmed query
classNamestringExtra classes for the outer <section>
ts
type Error2Labels = {
  placeholder?: string;
  submit?: string;
  suggestions?: string;
};

type SuggestionLink = {
  title: string;
  description?: string;
  href: string;
};

Behavior notes

More Error blocks

View all Error
PRO

error30

Search Led 404

Monochrome 404 that hands the visitor a search field: a display headline with a muted emphasis clause, a rounded search bar with a circular submit seal wired to a callback, and a ruled list of the most travelled routes.

PRO

error13

404 With Site Directory

404 page that doubles as a sitemap: left-aligned messaging over four columns of grouped section links, so visitors on a large site can jump straight to the area they wanted.

FREE

error6

Inline 404 Line

The smallest possible 404: the status code and the message sit on one line separated by a vertical rule, stacking on mobile, with a single outline button underneath.

PRO

error4

404 With Destination Cards

404 page that recovers the visit with a grid of destination cards, each with an icon, title, description, and hover arrow, followed by a centered row of fallback buttons.

PRO

error3

Split 404 With Image

Two-column 404 page with the error code, heading, explanation, buttons, and a small note on one side, and a full-bleed image that scales on hover on the other. The image side can be flipped with a prop.

FREE

error9

404 Did You Mean

Left-aligned 404 for documentation and marketing sites: the requested path is shown struck through in monospace above a did-you-mean box linking to the closest matching page.