Skip to content

React 404 Page

NotFound is a React 404 page block: a large code whose zeros are glass rings, a plain explanation, a slot for your own search field, a main action and suggested links. It is also usable for 403 and 500 pages.

npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/not-found-page.json

Error 404

This page has drifted off

The address may be mistyped, or the page may have moved. Search for what you need, or pick up from one of these.

Back to home

The search slot takes any node: an Input, a Combobox or a command palette trigger. The block does not search for you. Remember to answer with HTTP status 404 from your router.

Error 404

This page has drifted off

The address may be mistyped, or the page may have moved. Search for what you need, or pick up from one of these.

Back to home

Files to copy

7 folders · 11 files · 4 packages
From theme/src/
  • blocks/not-found-page.tsx
  • components/button/
  • components/spinner/
  • hooks/{use-latest.ts, use-magnetic.ts, use-media-query.ts, use-preferences.ts}
  • motion/{gate.ts, tokens.ts}
  • lib/{cn.ts, form.ts, heading.ts, state-light.tsx}
  • styles/
shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/not-found-page.jsonRegistry item: not-found-page. The styles need the Tailwind v4 glass UI setup.
The examples also use
  • components/input/
  • lib/field-size.ts
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/input.json
Packages
pnpm add @base-ui/react clsx motion tailwind-merge

A custom status code and your own wording

code takes any short string (each 0 becomes a ring), and labels replaces every sentence, so the same block serves a 403 or a 500.

Error 403

You need permission for this page

Sign in with an account that has access, or ask the owner to invite you.

Props

PropTypeDefaultDescription
codestring"404"The big code (string). Each 0 is drawn as a glass ring. It is decorative: labels.codeLabel is what is read aloud.
actionNotFoundActionNoneThe main way out, usually back home (NotFoundAction).
searchReactNodeNoneA slot for your search field (ReactNode), shown under the text: a Input, a Combobox or a command palette trigger. The block does not search for you.
linksNotFoundLink[][]Suggested destinations (NotFoundLink[]).
headingLevelHeadingLevelOption2Level of the heading (1 to 6); "none" renders plain text. A 404 page's heading is its h1, so a real page passes headingLevel={1}.
labelsPartial<NotFoundLabels>defaultNotFoundLabelsEvery other string, for translation: labels={{ title: "…" }}; omitted keys keep the English of defaultNotFoundLabels. All 4 keys of NotFoundLabels are listed in the key table under the props table.
classNamestringNoneAdds extra classes to the section (string).
NotFoundLabels keys and English defaults (4)
Pass any key in labels; the rest keep the defaults of defaultNotFoundLabels.
KeyEnglish default
titleThis page has drifted off
descriptionThe address may be mistyped, or the page may have moved. Search for what you need, or pick up from one of these.
codeLabelError 404
linksTitlePopular places

Keyboard

KeysAction
TabThe main action, your search field, then the suggested links in order.
EnterFollow a link or press the action.

Accessibility

  • A <section> named by its heading. A 404 page's heading is its h1: pass headingLevel={1}.
  • The large code is aria-hidden; labels.codeLabel ('Error 404') is read instead.
  • Suggested links are a labelled list of real anchors with 44 px targets. The zeros are glass surfaces (keep to two or three), and nothing loops.
  • Digits settle on a spring and the rings drop in once. Reduced motion removes the movement.

All exports on this page

  • NotFound — A 404 page: a large code whose zeros are glass rings, a plain heading and explanation, a slot for your search field, a way back.
  • defaultNotFoundLabels — The English NotFoundLabels used when labels is omitted; a partial labels prop is merged over it.

When to use the 404 page

  • Use NotFound as the not-found route of an app or a marketing site, with a main action back home, three or four suggested links and your search field in the search slot.
  • Use the search slot for an Input, a Combobox or a command-palette trigger; the block does not search by itself, so it never promises a result it cannot give.
  • Use code="403" or "500" with labels for the title and description to reuse the block for other error pages without a second component.
  • Skip it as an inline empty state inside a list; EmptyState is the right component for 'no results', while NotFound is a whole page.
  • Pair it with AnnouncementBanner and SiteFooter, and have your router answer with HTTP status 404, because the block only draws the page.

Frequently asked questions

20 blocks pages in all: browse them on All blocks.

By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .