Skip to main content

PermissionGuard

This component is used to protect a route from unauthorized access. It will render the children if the user has the required permissions.

Example

Tsx
<PermissionGuard requires={['UpdateTaxCategory']}>    <Button type="submit">        <Trans>Update</Trans>    </Button></PermissionGuard>
Signature
function PermissionGuard(props: Readonly<PermissionGuardProps>): void

Parameters

props

parameterReadonly<PermissionGuardProps>

The props for the PermissionGuard component.

Signature
interface PermissionGuardProps {    requires: Permission | string | string[] | Permission[];    children: React.ReactNode;}

requires

propertyPermission | string | string[] | Permission[]

The permission(s) required to access the children.

children

propertyReact.ReactNode

The children to render if the user has the required permissions.

Was this chapter helpful?
Report Issue
Edited Feb 2, 2026·Edit this page