Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Search Command 404 Error Block for React

A full-height 404 page for a knitting-pattern library: the display 404, a heading that names the missing address, an inline command list in a framed panel that shows five popular pages and filters ten as you type, and one button to the homepage.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

Turn a dead end into a search, with this 404 page for React with Base UI. It's the not-found page of Purlwise, a knitting-pattern library: the page's two side rails run its full height, and one band crosses the screen between two rules with a plus mark where each meets a rail, holding the content a little above the middle. The display "404" is for the eye and hidden from screen readers; the heading, "That pattern isn't here", says what happened, and one sentence names the missing address in monospace. Under it a Command sits in a framed panel with corner marks from Guides: with nothing typed it lists five popular pages, and typing filters ten pages in two groups, patterns and guides, by what their titles hold. A strip of Kbd hints and a count sits under the list, and the Shine Button leads to the homepage, the only colored control. It's built from Command, Kbd, Shine Button and Guides, with a CSS entrance only. For any site that wants its 404 to help people find the page they meant.

FAQ

What happens when I pick a page, and what stays in the page?

Nothing leaves the page. Pressing Enter on a row, or clicking it, writes "Opening" and the page's title in a polite status message and says nothing navigated; the field and the list stay as they were. To wire it for real, go to the page's path when a row is chosen. Do it in each row's onSelect. Link the rows (and the homepage button) to real addresses too, so they also work without script.

Does this page return a 404?

The block draws the page; the status comes from your server. Answer the request with a real 404 (your framework's not-found handling does this), or search engines will treat the page as a normal one and may keep indexing the dead address. The address in the sentence is typed in the file (MISSING): in your app, read it from the request.

How do I use my own pages?

Edit PAGES. Each page has a group (Patterns or Guides), a label, a path, a popular flag and a value that is unique. The pages flagged popular are the five shown before anything is typed, and they are listed under their own heading. For a large site, filter on your server or search index instead and pass the first few results to the list.

Does the search field take focus when the page loads?

No. Some command libraries focus their field as they mount, which would pull a page's focus and scroll position away from the reader, so the block hands focus back a moment later unless the reader has already moved. Click the field or tab to it and it works as any search field does.

How does it fit on a phone?

The pages' paths and the Escape hint are hidden below the small breakpoint, the panel keeps its height and the list scrolls inside it, and the homepage button spans the width and is on the first screen. Nothing scrolls sideways at 320 pixels.

  • Pro

    A split 404 page for a developer blog host: the failed address in an editable field with its words as chips, and eight typed articles ranked by shared words with one letter of typo allowed, the matched words marked, re-ranking as you edit.

  • Pro

    A full-height 404 page for a documentation host: the headline and a link home at the start, the whole site's sitemap as a keyboard-walkable tree at the end, with a divider between.

  • Pro

    A full-height 404 page for a notes app with only the display numerals, a heading, one sentence that names the missing address as typed text, and one link back to the docs.

  • Pro

    A 404 page for a shipping dashboard that offers three guesses as radio rows, each showing its address with the changed part struck through or underlined and named in a word, and one button that opens the chosen guess.

  • Pro

    A docs search page for a query that finds nothing in the current scope: a large query field over five scopes with live counts, results for the scope you choose, and one button to search everything.

  • Pro

    A full-height 404 page for a kids' language app where three digit tiles drop onto a rule one after the other with a small overshoot, in CSS only, and a button replays the drop.