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.
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.
Radix flavor
npx shadcn add "https://ui.beste.co/r/error2"Base UI flavor
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.
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.
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:
"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)}`)}
/>
);
}| Prop | Type | Default | Description |
|---|---|---|---|
code | string | – | Small uppercase status label above the heading |
heading | string | – | Main page heading, rendered as an h1 |
description | string | – | Explanatory paragraph under the heading |
labels | Error2Labels | {} | Search placeholder, submit button text, and suggestion list caption |
suggestions | SuggestionLink[] | [] | Rows in the bordered suggestion list |
onSearch | (query: string) => void | – | Called on form submit with the trimmed query |
className | string | – | Extra classes for the outer <section> |
type Error2Labels = {
placeholder?: string;
submit?: string;
suggestions?: string;
};
type SuggestionLink = {
title: string;
description?: string;
href: string;
};event.preventDefault() and passes the trimmed query to onSearch, so nothing navigates by default: routing is entirely up to the caller.onSearch handler the form still submits harmlessly (the optional call is skipped), which keeps the block safe to drop in before search exists.type="search", so browsers render their native clear affordance, and the placeholder doubles as the field's aria-label.labels.submit is set, leaving an input-only search bar for compact layouts.sm breakpoint; suggestion rows are separated by divide-y inside one bordered container and highlight on hover through the named group/error2 group.error30
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.
error13
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.
error6
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.
error4
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.
error3
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.
error9
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.