# Error 404

> A full-viewport missing route page with a clear recovery action.

URL: https://basaltui.com/templates/not-found · Markdown: https://basaltui.com/templates/not-found.md

- Category: `standalone`
- Height: `36rem`
- Workbench: https://basaltui.com/templates/not-found
- Live preview: https://basaltui.com/view/not-found

## Package Imports

- `@nocoo/basalt/components/badge`
- `@nocoo/basalt/components/button`
- `@nocoo/basalt/components/layer-card`
- `lucide-react`

## What's inside

- **Centered recovery card** (`#not-found-card`): Compact matte LayerCard presenting the 404 code badge, explanation, and home link. Components: [Layer Card](https://basaltui.com/ui/layer-card.md), [Badge](https://basaltui.com/ui/badge.md), [LinkButton](https://basaltui.com/ui/link-button.md).

## Make it yours

1. **Customize error messaging** (`NOT_FOUND_CONFIG`): Edit NOT_FOUND_CONFIG to change status badge text, headline, and recovery copy.
2. **Point recovery link to app root** (`NOT_FOUND_CONFIG`): Set NOT_FOUND_CONFIG.actionHref to your application home or active dashboard route.
3. **Preserve noindex metadata on 404** (`NOT_FOUND_CONFIG`): Pair this route with HTTP 404 status and noindex headers at your edge or router.
4. **Mount styles & providers**: Wrap your application root in `ThemeProvider` and `LinkProvider`, and import `@nocoo/basalt/styles` (or `@nocoo/basalt/styles/tailwind` / `@nocoo/basalt/styles/standalone`) plus `@nocoo/basalt/fonts.css`.

## Source

```tsx
"use client";

import { Badge } from "@nocoo/basalt/components/badge";
import { LinkButton } from "@nocoo/basalt/components/button";
import { LayerCard } from "@nocoo/basalt/components/layer-card";
import { ArrowLeft } from "lucide-react";

export const NOT_FOUND_CONFIG = {
	code: "404",
	title: "Page not found",
	description: "The requested route does not exist or has moved to a new location.",
	actionLabel: "Back to Homepage",
	actionHref: "/",
} as const;

export default function NotFoundTemplate() {
	return (
		<div
			data-basalt-surface-root=""
			className="flex min-h-dvh items-center justify-center bg-basalt-background p-basalt-layout"
		>
			<main className="w-full" style={{ maxWidth: "22rem" }}>
				<LayerCard id="not-found-card" padding="xl" className="text-center">
					<div className="flex flex-col items-center space-y-basalt-card">
						<Badge variant="outline">{NOT_FOUND_CONFIG.code}</Badge>
						<div className="space-y-basalt-space-sm">
							<h1 className="font-basalt-display text-basalt-3xl font-semibold text-basalt-foreground">
								{NOT_FOUND_CONFIG.title}
							</h1>
							<p className="text-basalt-sm leading-basalt-relaxed text-basalt-muted-foreground">
								{NOT_FOUND_CONFIG.description}
							</p>
						</div>
						<LinkButton href={NOT_FOUND_CONFIG.actionHref} variant="outline" size="sm">
							<ArrowLeft className="size-basalt-icon" aria-hidden="true" />
							{NOT_FOUND_CONFIG.actionLabel}
						</LinkButton>
					</div>
				</LayerCard>
			</main>
		</div>
	);
}
```
