Dashral Pro is on the wayGet 30% off at launch

Dashral

404 page

Page not found, with a search across the pages people likely wanted, a way back and home, popular pages and a report link.

$ pnpm dlx shadcn@latest add @dashral/not-found

When to use

  • A 404 that helps: a search across the pages people likely wanted, a way back, popular pages and a report link.
  • Any site or app's not-found page.

When not to use

  • Pages that exist but the person can't open: say they need access, not that the page is missing.
  • Errors on your side: a 500 page says it's yours to fix, not theirs.

Usage

404 page with your own data: every prop has the sample as its default, so pass only what you have.

example.tsx
import { NotFound } from "@/components/dashral/blocks/not-found"

<NotFound
  pages={searchablePages}
  homeHref="/"
  onOpen={(page) => router.push(page.href)}
  onReport={(path) => api.feedback.brokenLink(path)}
/>

API reference

NotFound

A "page not found" page that helps people on: the code, what happened, a search across the pages they likely wanted, a way back and home, the most visited pages, and a way to report a broken link. Use it as app/not-found.tsx; every part comes from props.

PropTypeDefault
codestring"404"
titleReact.ReactNodesample
descriptionReact.ReactNodesample
pagesNotFoundPage[]

The popular pages, as cards (and searched); none hides them.

sample
moreNotFoundPage[]

More pages, searched only.

sample
homeHrefstring"#"
onOpen(page: NotFoundPage) => void

Enter in the search, with the first match: go there with your router (it follows the link without it).

—
onReport((url: string) => Promise<void> | void) | null

"Report a broken link", with the address that wasn't found (a throw takes the thanks back); null hides it.

sample

type NotFoundPage

A page to search and jump to; the popular ones show as cards, with an icon.

PropTypeDefault
titlestring—
descriptionstring—
hrefstring—
iconReact.ComponentType<{ className?: string; "aria-hidden"?: boolean }>—