shadcn.io is not affiliated with official shadcn/ui
Split Sitemap 404 Error Block for React
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.
Installation
Overview
Show a lost visitor the shape of your whole site, with this split 404 block for React with Base UI. It's the not-found page of Docmeadow, a documentation host: the page's rails run its full height and one band crosses the screen between two rules, with a divider running down between its two halves and a plus mark wherever lines meet. At the start are the numerals, the heading, one sentence and a Shine Button link home, the only colored control. At the end, in a framed panel, is the sitemap: the catalog's Tree View with three sections (Guides, Reference, Company) and twelve pages, the first section open. The arrow keys walk it, the side arrows open and close a section, Home and End jump to the first and last row and Enter picks a page. Picking one only says which page would open, in a polite line under the panel, because nothing navigates in this demo. The panel keeps its height and scrolls inside when more sections are open; on a phone it sits under the copy. It's built from Tree View, Shine Button and Guides. For documentation sites, help centres and any site with a few dozen pages.
FAQ
How do I fill the sitemap with my pages?
Edit SECTIONS: each section has an id, a name and its docs, and each page an id, a name and a path. The tree is built from them, and the count in the panel's heading is derived, so it always matches. Generate the array from your routes or your CMS at build time; the tree handles a few dozen rows comfortably. For hundreds, search is the better way out of a 404, and error-404-search is the block for it.
How do I use the tree with a keyboard?
Tab goes to the tree once. Then Up and Down move between visible rows, Right opens a closed section and moves into an open one, Left closes it or moves back to its section, Home and End jump to the first and last row, and Enter picks a page. The tree is named "Docmeadow sitemap" for screen readers, and each page's link text is the row's name. The links inside the rows are kept out of the tab order, since the tree is walked by key.
What does picking a page do, and how do I wire it?
In the demo it only updates the line under the panel ("Would open Quickstart at /guides/quickstart. Nothing navigates in this demo."). In your app give each leaf's link its real href and navigate in onSelectionChange, with your router's push; a click on the link itself also works. Keep the 404 status on your server: render this page from your framework's not-found route.
Does the page move when I open sections?
No. The tree sits in a fixed-height panel (h-64) that scrolls on its own, so opening every section never changes the page's height or moves the headline, which is centered in the band. With one section open the panel just fits.
Related
- Pro
Search Command 404 Error
Not foundA 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.
- 404Pro
Illustrated Filing Drawer 404 Error
Not foundA full-height 404 page for a bookkeeping app whose picture is the way back: a drawn filing drawer with three folders that are links and one dashed slot for the missing page.
- 404Pro
Minimal 404 Error
Not foundA 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.
- 404404404Pro
Echoing Numerals 404 Error
Not foundA full-height 404 page for a podcast player where the numerals echo in stacked rows that fade upward, over a framed row of three whole-cell links: go back, browse the library, contact support.
- Pro
JSON-LD 404 Error
Not foundA full-height 404 page for a hiking-routes site with a search form, three quick links and, beside it, the page source search engines read: the 404 response line, a noindex tag and JSON-LD with a SearchAction.
- 404Pro
Animated Drop-In 404 Error
Not foundA 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.