Skip to content
HomeCobalt

Page problem

Takes the place of a page that could not load: what happened in plain words, and the one way on, such as Try again or Sign in again.

Examples

A record that could not load says what happened and offers one way on; Try again reads it again in place, and the record replaces the problem when it comes.
KindsEvery kind of failure in its own plain words, each with one way on; none shows a status code or a server's reason phrase.
Long waitA retry that hangs: after 8 seconds the line under the button says so and offers Retry, which cancels the stuck read and sends a fresh one.
OfflineOffline, Try again asks the server first; while it still cannot be reached the button says Still offline and nothing else changes. Turn the Offline control off and try again.

Usage

Use it when

  • A page has nothing to show because its first read failed: a record that is gone, a session that ended, no network.
  • A whole route's loader or error boundary fails, in a product with a router.

Use something else when

  • A list or a section inside a page failed while the rest loaded. Use Empty instead, with reason="error".
  • The page shows data and a later read failed. Use Banner instead, or a toast, and keep the data.
  • A form could not save. Use Field's error and StateButton instead.

Rules

General

Content

Avoid

Limits

Install

npx shadcn@latest add https://kaanarici.com/r/cobalt/page-problem.json https://kaanarici.com/r/cobalt/long-wait-notice.json https://kaanarici.com/r/cobalt/failure.json https://kaanarici.com/r/cobalt/use-long-wait.json
import { PageProblem, pageProblemLabels, type PageProblemLabels } from "@/components/cobalt/ui/page-problem"
import { LongWaitNotice } from "@/components/cobalt/ui/long-wait-notice"
import { Failure, Unconfirmed, failureOf, failureWords, wordsFor } from "@/lib/cobalt/failure"
import { useLongWait } from "@/lib/cobalt/use-long-wait"