Functions

Forbidden interrupt and UI

An experimental authorization interrupt renders the forbidden UI. Enable experimental.authInterrupts only in an isolated compatible fixture. Check resource permission before calling it; it does not decide authorization. The fallback component receives no props. Example context: isolated Next.js 16.x candidate; snippet is partial unless it defines a complete convention file. Lifecycle: experimental. Expected behavior / verification: A denied synthetic editor request should yield forbidden UI and status where supported. Verify direct operation denial independently. Prefer explicit 403 in a stable Route Handler. Source: https://nextjs.org/docs/app/api-reference/functions/forbidden Exact installed signature, typecheck and framework execution not run.

Formal Syntax & Structure

nextjs syntaxnextjs
forbidden() from next/navigation; app/forbidden.tsx

Working Example

Example Snippetnextjs
import { forbidden } from 'next/navigation'; export function requireEditor(role: string){if(role !== 'editor') forbidden()}
Next.js Reference