Overview
Reference usage
Authorization presentation gate for controls and sections that stay visible when the current user is missing an application scope or permission.
Usage
A denied section is a neutral disc with a lock, a title in the person's words, the reason, the missing scope small and monospaced on its own line ("requires hooks:read"), and an actions snippet. It has two layouts. layout="inline" (the default) is a compact bordered card that replaces one region while the rest of the page stays readable. layout="page" has no card, grows the disc to 48px and centres in the region it fills, for a page with nothing readable; give it headingLevel={1}. A gate has no primary action: give its actions the secondary button variant.
When to use
- Showing a mutating action that the current user cannot activate because an application authorization scope is missing.
- Replacing a panel, tab, or administrative section with a lock state that names the missing scope or permission.
- Checking browser permissions, media capabilities, or feature support — use capability-gate instead.
- Resolving roles, scopes, or policies — compute granted in application code and pass the boolean in.
Examples
Disabled action
Keeps an unauthorized action visible with an accessible scope reason.
Forbidden page
The full-page layout for a page with nothing readable: what is blocked, the missing scope on its own line, and where to look.
Locked section
Replaces a protected region with a scope-required placeholder.
Props
Name | Type | Default | Description |
|---|---|---|---|
granted required | boolean | Whether the consumer-authorized action or section is available. | |
variant | 'inline' | 'section' | 'inline' | Presentation mode. |
reason required | text | Human-readable explanation shown to users and wired to assistive technology. | |
requirement | text | Named scope, permission, or policy requirement. A section gate shows it small and monospaced on its own line, as "requires <requirement>". | |
title | text | 'Section locked' | Heading of a denied 'section' gate, in the person's words, such as "Your sign-in can't
open Hooks". Ignored by the inline variant. |
headingLevel | 123456 | 3 | Heading level of the section title. |
layout | 'inline' | 'page' | 'inline' | Layout of a denied 'section' gate. Ignored by the inline variant. |
children | snippet | Gated content. Rendered untouched when access is granted. | |
actions | snippet | Actions rendered under a denied 'section' gate, such as "See your scopes" or "Back to
Home". Give them the secondary button variant: a gate has no primary action. |