Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Page History Trail 404 Error Block for React

A full-height 404 page for a design-review tool that shows the trail of pages you visited on a rail-to-rail rule, tags the last good page, and lets you clear and restore the trail.

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

Tell a lost visitor where they have been, with this 404 block for React with Base UI. It's the not-found page of Critlane, a design-review tool: the page's rails run its full height and one band crosses the screen between two rules with a plus mark at each end. In the band the numerals, the heading, one sentence and a Shine Button link back to the last good page ("Back to Comments"), the only colored control, come first. Under them a second ruled band runs from rail to rail with a plus mark at each end, and the trail stands on its rule: four stops (Projects, the Q4 launch board, Export, Comments) as links with their addresses, the last good page tagged "Last good page" in a Badge, and the missing page as a dashed ring. "Clear this trail" empties it and says nothing is kept in this browser; the same button then restores it. On a phone the trail is a vertical list. It's built from Shine Button, Button, Badge and Guides, with a CSS entrance only. For any app where people move through several pages before one goes missing.

FAQ

Where does the trail come from?

In the demo it's typed: TRAIL lists four pages and MISSING the address that failed. A page can't read the browser's history entries, only how many there are, so in your app keep the trail yourself: for example the last few routes your router visited, in memory or in session storage, passed in here. document.referrer gives only the one page before, and only when the browser sends it.

What do Clear this trail and Restore trail do?

Clear hides the trail and shows "Your trail is empty. Nothing is kept in this browser", a polite status line says the same, and the way back changes to "Go to Projects" because the last good page is no longer known. The same button, now labelled Restore trail, puts the typed trail back. Both states share one space, so the band never changes height, and focus stays on the button.

Why is the last good page the way back?

The page before the failure is the one most likely to hold what the visitor was doing: here they went from Export to Comments, then followed a link to a comment thread that has been deleted. So "Back to Comments" is the first control in the tab order, and Comments carries the words "Last good page", not only a filled dot. The missing page is a dashed ring and not a link, since there is nothing to open.

What stays local, and how do I wire the links?

Every link goes to #: point each stop at its real route. Clearing and restoring only change the page's state; nothing is stored and nothing leaves the page. The 404 status is your server's job, so render the page from your framework's not-found route.

Is the trail accessible?

It's an ordered list named "Pages you visited, oldest first", each stop a link with its name and its address, which stays left to right in a right-to-left page. The dots and the hairline are decoration. The missing page is read as "This page, not found" with its address. Clearing the trail is announced in a polite status line.

How does it look on a phone?

The way back stays on the first screen. The trail then becomes a vertical list with a hairline joining the dots, the missing page last, and the Clear button under it. From the md breakpoint the five stops sit in a row along the rule.

  • 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 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.

  • Pro

    A 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

    A 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.

  • Pro

    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.