shadcn.io is not affiliated with official shadcn/ui
Redirect Countdown Error Block for React
A full-screen page for an address that moved: eight ticks that empty one per second over the old address struck through the new one, a Stay here that cancels the redirect and a Go now, with nothing ever navigating.
Installation
Overview
Tell people a page moved, and let them stay, with this redirect countdown page for React with Base UI. It's the screen Linkbloom, a link-in-bio builder, shows at an old address: 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. Over the heading, eight ticks, one for each second, empty one by one with the seconds remaining beside them; under it, a list shows the old address struck through over the new one. The countdown starts when the page loads, stops at zero and never navigates: the Shine Button Go now doesn't wait, and a ghost Button Stay here cancels the redirect for good, then offers to run it again so the demo can be seen twice. A polite status line says what happened. The rules come from Guides, and the ticks change with a CSS transition only. For moved pages, renamed accounts and domain changes.
FAQ
Why does this countdown start by itself?
A redirect that waits for the visitor to ask would be a button, not a redirect. This one is bounded (eight seconds, then it stops), it can be cancelled with Stay here, and it never takes anyone away from the page without their having seen why. That is the spirit of WCAG 2.2.1 (Timing Adjustable): let the visitor stop or extend a time limit. The only timer is one second long at a time and is cleared when you press Stay here or leave the page.
What does it do at zero?
Nothing navigates. At zero, or when you press Go now, a polite status line says what a real page would do ("You would be taken to /profile now") and that this demo stayed where it was. To wire it for real, call your router at that point in goNow and in the effect that ends the countdown, and keep Stay here working.
What does Stay here do?
It stops the countdown where it is, keeps the ticks as they were, and says "Redirect cancelled" with the seconds that were left. The same button then reads "Run the countdown again", which starts from eight. In a real page you may not want the second half: remove it and the visitor stays for good.
Does a screen reader hear every second?
No. The ticks and the seconds beside them are decoration (hidden from assistive technology), because a number that changes every second would be read out every second. The polite status line speaks only when the state changes: when it starts, when you cancel, when it ends. Reduced motion changes only the ticks: they switch without a transition, and the countdown keeps counting because it carries information.
Should an old address redirect from the page or from the server?
From the server, with a 301 or 308, whenever the visitor doesn't need to know. A page with a countdown is for the cases where the change is worth explaining (a renamed account, a new domain); the server should still answer it with the right status. A component can't send that status.
Related
- Pro
Email Verified Redirect Success
Account lifecycleA verification confirmation page with a five-second redirect you can pause: what happened, a countdown with a draining bar and a Pause the redirect toggle, and one button that goes to the forum right away.
- Pro
Expired Link Error
Sign-in and identityA full-screen page for an expired password-reset link: the link's life drawn on a time axis, the facts in words, and an Email me a new link button that hands its place to a 30-second cooldown.
- 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.
- Pro
Planned Maintenance Progress Error
MaintenanceA full-height maintenance page for an online bank that shows a five-segment progress bar with the window's start and expected return, and a Check again button that reports a typed result.
- Pro
Connection Fallback Error
NetworkA full-screen page for a live connection that dropped and fell back: three signal bars, three transport rows with a shape and a word each, Reconnect now as a short scripted attempt, and a Keep using polling toggle.
- Pro
Database Backoff Schedule Error
Server and outagesA full-screen page for a database that refuses connections: Retry now and a switch that retries by itself on a press-started countdown, four pool cells and the backoff schedule drawn to scale.