404 page that counts down to an automatic redirect and calls onRedirect once it reaches zero, with a cancel button that stops the timer and a manual go-now link.
A 404 page that does not wait for the visitor to act: a live countdown runs under the message and fires onRedirect when it reaches zero, with a cancel button that stops the timer for anyone who would rather stay.
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/error8"Base UI flavor
npx shadcn add "https://ui.beste.co/r-base/error8"This installs the block to components/beste/block/error8.tsx, plus the button shadcn/ui primitive it uses for the manual and cancel actions.
The installed file exports error8Demo alongside the block: the exact props behind the preview above. Spread it and the countdown runs immediately.
import { Error8, error8Demo } from "@/components/beste/block/error8";
export default function NotFound() {
return <Error8 {...error8Demo} />;
}Navigation is the caller's job, so wire onRedirect to your router:
"use client";
import { useRouter } from "next/navigation";
import { Error8 } from "@/components/beste/block/error8";
export default function NotFound() {
const router = useRouter();
return (
<Error8
code="404"
heading="This page does not exist"
description="We will take you somewhere useful unless you would rather stay."
seconds={10}
labels={{
redirect: "Redirecting to the homepage in",
seconds: "seconds",
cancel: "Stay on this page",
canceled: "Automatic redirect canceled.",
}}
action={{ label: "Go now", href: "/" }}
onRedirect={() => router.push("/")}
/>
);
}| 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 |
seconds | number | – | Starting value of the countdown |
labels | Error8Labels | {} | Countdown sentence, unit word, cancel button text, and canceled message |
action | ActionLink | – | Manual link button beside the cancel button |
onRedirect | () => void | – | Called once when the countdown reaches zero |
className | string | – | Extra classes for the outer <section> |
type Error8Labels = {
redirect?: string;
seconds?: string;
cancel?: string;
canceled?: string;
};
type ActionLink = {
label: string;
href: string;
};onRedirect, so the caller decides between router.push, window.location, or nothing at all, and the preview above stays put.onRedirect fires exactly once. A ref guards the call, so re-renders and a handler whose identity changes cannot trigger a second redirect.seconds (or 0) disables the redirect entirely: the guard skips the call and the countdown never starts.labels.canceled, and removes the cancel button, leaving only the manual action link.aria-live="polite", so screen readers hear the remaining time without the page stealing focus every second.error2
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.
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.
error25
Too-many-requests page with a square eyebrow and status code, an accent headline, three bordered usage cells, and a live cooldown counter that swaps itself for a retry seal button when it reaches zero.
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.
error5
Card-style 404 panel that echoes the requested URL in monospace, pairs a browser-history back button with link actions, and closes with a support and status link row.
error1
Minimal centered 404 page with a large error code, a heading, a short explanation, two call-to-action buttons, and a divided row of popular page links underneath.