NotFoundPage
A page or a record that is not there, said plainly, with ways out: search, the places people usually look for, and back. Inside the console a missing record says which one and why it may be gone.
import { NotFound, LinkCard } from '@sypnia/ui/react'
On a desktop
Outside the console: search, three places people look for, and a way home.
This page does not exist
The link may be old, or the address has a typo. Search for what you were looking for, or start from one of these.
Code
import { useState } from 'react';
import { AuthLayout, Button, Field, LinkCard, NotFound, Page, PageHeader, SearchInput, Stack, Text, useSypnia } from '@sypnia/ui/react';
// A page that does not exist, said plainly, with ways out: search, the places people usually look for, and back.
// Inside the console a missing record keeps the frame and says which record and why it may be gone.
const en = {
title: 'This page does not exist', body: 'The link may be old, or the address has a typo. Search for what you were looking for, or start from one of these.',
search: 'Search Sypnia', searchHint: 'Projects, tables, settings', places: 'Places people look for',
projects: 'Your projects', projectsText: 'Every project in your organization', docs: 'Documentation', docsText: 'Guides and the API reference',
status: 'Status', statusText: 'Whether every service is working', home: 'Go to my projects', results: (q: string) => `Searching for «${q}»…`,
what: 'The table orders_2024', recordBody: 'It was deleted or renamed, or it belongs to a project you cannot see. Tables deleted in the last 7 days can be restored.',
back: 'Back to tables', restore: 'See deleted tables', page: 'Tables',
};
const es: typeof en = {
title: 'Esta página no existe', body: 'Puede que el enlace sea viejo o que la dirección tenga un error. Busca lo que querías, o empieza desde uno de estos.',
search: 'Buscar en Sypnia', searchHint: 'Proyectos, tablas, ajustes', places: 'Lugares que la gente busca',
projects: 'Tus proyectos', projectsText: 'Todos los proyectos de tu organización', docs: 'Documentación', docsText: 'Guías y la referencia de la API',
status: 'Estado', statusText: 'Si todos los servicios funcionan', home: 'Ir a mis proyectos', results: (q: string) => `Buscando «${q}»…`,
what: 'La tabla orders_2024', recordBody: 'Se borró o se le cambió el nombre, o es de un proyecto que no puedes ver. Las tablas borradas en los últimos 7 días se pueden recuperar.',
back: 'Volver a tablas', restore: 'Ver tablas borradas', page: 'Tablas',
};
export default function NotFoundPage({ variant = 'page' }: { variant?: 'page' | 'record' }) {
const { locale } = useSypnia();
const c = locale.startsWith('es') ? es : en;
const [query, setQuery] = useState('');
const [searched, setSearched] = useState('');
if (variant === 'record') {
return (
<Page>
<PageHeader title={c.page} />
<NotFound what={c.what} backHref="#tables" backLabel={c.back}>
<Stack gap={3}><span>{c.recordBody}</span><div><Button variant="quiet" icon="history" href="#trash">{c.restore}</Button></div></Stack>
</NotFound>
</Page>
);
}
return (
<AuthLayout plain title={c.title} lead={c.body} brandHref="#">
<Stack gap={6}>
<form role="search" onSubmit={(e) => { e.preventDefault(); setSearched(query.trim()); }}>
<Field label={c.search} hint={c.searchHint}><SearchInput name="q" value={query} onChange={(e) => setQuery(e.target.value)} /></Field>
</form>
{searched && <Text size="sm" tone="muted" as="p">{c.results(searched)}</Text>}
<nav aria-label={c.places}>
<Stack gap={2}>
<LinkCard href="#projects" icon="home" title={c.projects}>{c.projectsText}</LinkCard>
<LinkCard href="#docs" icon="book" title={c.docs}>{c.docsText}</LinkCard>
<LinkCard href="#status" icon="uptime" title={c.status}>{c.statusText}</LinkCard>
</Stack>
</nav>
<div><Button variant="primary" icon="arrow-left" href="#projects">{c.home}</Button></div>
</Stack>
</AuthLayout>
);
} On a phone
At 390 px the places become one column of cards.
A record inside the console
The frame stays; the message names the record and says how it may be restored.
Tables
The table orders_2024 does not exist
It was deleted or renamed, or it belongs to a project you cannot see. Tables deleted in the last 7 days can be restored.
When to use it
Use it when
- An address that leads nowhere: an old link, a typo.
- A record that was deleted, renamed or belongs to a project the person cannot see. Say all three, since the app cannot tell which.
Do not use it when
- A joke instead of a way out.
- Telling someone a private record exists: the message is the same whether it was deleted or is not theirs to see.
For everyone
- The title is the page's only h1; the search is a search landmark and the places are a named navigation.
- Every way out is a real link, reachable with Tab in reading order.
Props
| NotFound | Type | Default |
|---|---|---|
whatrequiredWhat was looked for, as the start of a sentence: «The table orders». | string | |
backHref | string | |
backLabel | string |
| LinkCard | Type | Default |
|---|---|---|
hrefrequired | string | |
titlerequired | ReactNode | |
external | boolean | |
icon | "function" | "error" | "replay" | "performance" | "uptime" | "traces" | "rage-click" | "dead-click" | "alert" | "summary" | "watch" | "sleep" | "light" | "suggestion" | "prompt" | "mcp" | "pull-request" | "git-branch" | "fix" | "check" | "open-source" | "self-host" | "sdk" | "engine" | "signals-in" | "web" | "mobile" | "backend" | "cloud" | "data" | "user" | "clock" | "shield" | "lock" | "mail" | "star" | "copy" | "arrow-right" | "arrow-up-right" | "chevron-down" | "plus" | "close" | "play" | "pause" | "search" | "info" | "warning" | "trash" | "menu" | "download" | "upload" | "filter" | "home" | "table" | "key" | "users" | "sun" | "moon" | "globe" | "sign-out" | "link" | "edit" | "calendar" | "chevron-left" | "chevron-right" | "chevron-up" | "minus" | "more" | "sort" | "arrow-left" | "arrow-up" | "arrow-down" | "arrow-down-right" | "arrow-down-left" | "arrow-up-left" | "swap" | "swap-vertical" | "chevrons-up-down" | "chevrons-left" | "chevrons-right" | "chevrons-down" | "chevrons-up" | "enter" | "undo" | "redo" | "refresh" | "expand" | "collapse" | "fullscreen" | "fullscreen-exit" | "move" | "grip" | "more-vertical" | "trend-up" | "trend-down" | "log-in" | "external" | "slash" | "equal" | "check-small" | "close-small" | "success" | "failure" | "help" | "plus-circle" | "minus-circle" | "ban" | "pending" | "dot" | "dot-off" | "bolt" | "flag" | "pin" | "bookmark" | "heart" | "thumbs-up" | "thumbs-down" | "sparkle" | "target" | "idea" | "award" | "crown" | "bell" | "bell-off" | "bug" | "fire" | "leaf" | "file" | "file-text" | "file-code" | "file-plus" | "file-check" | "file-table" | "file-lock" | "files" | "folder" | "folder-open" | "folder-plus" | "archive" | "clipboard" | "clipboard-check" | "paperclip" | "image" | "save" | "cloud-upload" | "cloud-download" | "cloud-off" | "import" | "export" | "share" | "inbox" | "send" | "box" | "layers" | "tag" | "hash" | "at" | "qr-code" | "book" | "book-open" | "notebook" | "rows" | "columns" | "grid" | "list" | "list-ordered" | "list-checks" | "kanban" | "chart-line" | "chart-bar" | "chart-area" | "chart-parts" | "chart-scatter" | "gauge" | "funnel" | "heatmap" | "sparkline" | "percent" | "sum" | "variable" | "braces" | "brackets" | "null" | "primary-key" | "relation" | "index" | "query" | "backup" | "migrate" | "seed" | "csv" | "json" | "bold" | "italic" | "underline" | "strikethrough" | "heading" | "text" | "paragraph" | "quote" | "code" | "align-left" | "align-center" | "align-right" | "indent" | "outdent" | "unlink" | "scissors" | "eraser" | "highlight" | "duplicate" | "paste" | "wand" | "palette" | "brush" | "ruler" | "crop" | "user-plus" | "user-minus" | "user-check" | "user-x" | "user-circle" | "team" | "organization" | "id-card" | "contact" | "role" | "chat" | "chats" | "comment" | "phone" | "video" | "mic" | "mic-off" | "megaphone" | "rss" | "mail-open" | "handshake" | "wave" | "desktop" | "laptop" | "tablet" | "terminal" | "window" | "browser" | "server" | "cpu" | "memory" | "disk" | "network" | "wifi" | "wifi-off" | "plug" | "power" | "container" | "queue" | "cron" | "webhook" | "api" | "route" | "load-balancer" | "dns" | "domain" | "certificate" | "firewall" | "rocket" | "deploy" | "rollback" | "logs" | "test" | "pipeline" | "commit" | "merge" | "fork" | "release" | "environment" | "region" | "robot" | "agent" | "puzzle" | "credit-card" | "wallet" | "receipt" | "invoice" | "cart" | "bag" | "coins" | "dollar" | "gift" | "plan" | "upgrade" | "usage" | "bank" | "history" | "timer" | "hourglass" | "calendar-check" | "calendar-plus" | "map" | "compass" | "translate" | "accessibility" | "keyboard" | "pointer" | "hand" | "print" | "support" | "stop" | "record" | "skip-forward" | "skip-back" | "fast-forward" | "rewind" | "volume" | "mute" | "camera" | "zoom-in" | "zoom-out" | "eye-off" | "sliders" | "settings" | "toggle" | "sidebar-left" | "sidebar-right" | "panel-bottom" | "split" | "layout" | "dashboard" | "cards" | "density" | "dark-mode" | "theme" | "mouse" | "cursor" | "select" | "picture-in-picture" | "scan" | "unlock" | "shield-off" | "shield-alert" | "shield-user" | "password" | "fingerprint" | "two-factor" | "policy" | "incognito" | "verified" | "audit" | "secret" | "p-telemetry" | "p-cases" | "p-agent" | "p-git" | "p-data" | "p-files" | "p-run" | "p-ai" | "p-mail" | "p-domains" | "p-design" | "p-learn" | "p-skills" | "p-app" | "p-ui" |