Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Session Expired Error Block for React

A full-screen session-ended page for a billing back office: a session ruler from 09:00 to 10:30 UTC with the active time solid and the idle gap hatched, a legend of when you signed in, were last active and were signed out, and a demo control that swaps the cause.

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

Explain why a session ended instead of asking for a password, with this session expired page for React with Base UI. It's the error screen of Chargeroom, a billing back office: a whole screen with the page's rails and one band across it, the words first in the reading order and the drawing first on a wide screen. The heading says the session ended, and a framed figure, ruled by Guides, draws a session ruler from 09:00 to 10:30 UTC: a solid bar for the time you were active, a hatched bar for the idle gap with "30 min idle limit" bracketed under it, a tick where you were signed out, and a legend of when you signed in, were last active and were signed out. A Toggle Group, marked as a demo control, swaps the cause between Idle too long, Signed in elsewhere and Password changed: the bars glide to the new times and a two-sentence explanation changes with them. A Shine Button Sign in again is a link. It's built from Toggle Group, Shine Button and Guides, with CSS only. For any app that signs people out.

FAQ

Why is there no password field?

Because this page explains, and the sign-in screens ask. Sign in again is a link to your sign-in route, where the login blocks live; putting a form here as well would give the visitor two places to sign in and make this page repeat them. The page's job is to say why the session ended, in times the visitor can check.

What is the toggle for, and what stays in the page?

It is a demo control: in a real app the server tells you why the session ended and the page shows that one cause. Pressing an option changes the ruler, the legend and the explanation, and a polite status line says what the new cause is. Nothing is sent or stored; the three causes are the typed constant CAUSES.

How is the ruler drawn?

From the times in each cause, typed as hh:mm in UTC: each is turned into minutes into the day, then into a percentage of the 90-minute axis, and written as a custom property that the bars read. So the bars, the brackets, the end tick and the legend can't disagree with the data. The bars glide when the cause changes, and stay put when reduced motion is on. The ruler is a drawing for the eyes (hidden from assistive technology); the legend and the explanation hold the same times in words.

Does the page move when I change the cause?

No. The three explanations sit in one grid cell, the live one visible and the others invisible and inert, so the space is held for the longest; the legend always has three rows; and the idle bracket keeps its place when it isn't shown.

What is the idle limit in this example?

Thirty minutes, the typed constant IDLE_LIMIT. In the first cause the last activity is at 09:41 and the session ended at 10:11, exactly one idle limit later. Match it to your product's policy, and say it in the sentence the way this page does.

  • Pro

    Invalid Token Error

    Sign-in and identity

    A full-screen invalid-token page for an identity API: three ruled checks (Format failed with the parts drawn, Signature and Expiry not checked), a masked fingerprint to copy, Sign in again, and a Report to security list of exactly what a report would attach.

  • Pro

    401 Unauthorized Error

    Sign-in and identity

    A full-screen 401 page for a reporting workspace: the heading, where the visitor was going, Sign in, and a framed list of other ways in where Single sign-on and Email me a link turn their own row into an email field in place.

  • Pro

    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.

  • Pro

    Expired Link Error

    Sign-in and identity

    A 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

    403 Forbidden Error

    Locked and removed

    A full-screen 403 page for a team wiki: a door drawn as the zero of 403, the heading 'Ask someone who can say yes', the three workspace admins in a framed list with a Copy email button each, and a way back to the wiki.

  • Pro

    Captcha Failed Error

    Sign-in and identity

    A full-screen page for a human check that timed out: a box to tick that escalates to a typed question, with no picture to read, over four accordion rows that show what the check looked at and what to do.