Feedback

Access Denied Screen

A static "you don't have access" view — no access-code form in it at all.

feedbackfallback

Best used for A hard-denial state after too many failed attempts, or a custom unauthorizedFallback on Protected Route.

Distinct from the access-code entry UI <KnockCodes> renders while locked — this screen means "no more attempts," not "try again."

Loading preview…
Installation

Add this block to your project

CLI

npx shadcn@latest add http://localhost:3000/r/react/access-denied-screen.json

Running this site somewhere other than localhost? Set NEXT_PUBLIC_SITE_URL and this command switches to that host automatically.

Also installs

  • cx (classname helper)
  • Gate Wrapper

Files created (3)

  • components/knock-codes/react/cx.ts
  • components/knock-codes/react/GateWrapper.tsx
  • components/knock-codes/react/AccessDeniedScreen.tsx

No CLI? Copy the files by hand

  1. Open the Code tab in the preview above.
  2. Create each path listed below in your project and paste its contents in.
  3. Do the same for anything listed under “Also installs”, if present.

Props

API reference

PropTypeDefaultDescription
headingstring"Access denied"The main heading.
messageReactNode"You don’t have permission to view this page."Body copy under the heading.
actionReactNodeOptional call to action under the message.
variant"page" | "inline""page"Outer positioning.
Notes

Accessibility

A plain heading + message + optional action — no live region needed since nothing here changes without a full re-render triggered by the parent.

Customization

Not wired to any verification strategy on purpose. Use it as a custom `unauthorizedFallback` on `<ProtectedRoute>`, or anywhere you need a denial state that never accepts another attempt — pass `action` for a "contact us" link or a retry button that resets your own flow.

Compose with

Blocks that pair well with this one

These combine naturally with this block, whether as a shared shell, a shared session, or a common fallback.