File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,29 @@ import type { OrganizationCustomPermissionKey, OrganizationCustomRoleKey } from
2
2
import type { CheckAuthorizationWithCustomPermissions } from './session' ;
3
3
import type { Autocomplete } from './utils' ;
4
4
5
+ /**
6
+ * Props for the `<Protect />` component, which restricts access to its children based on authentication and authorization.
7
+ *
8
+ * Use `ProtectProps` to specify the required role, permission, feature, or plan for access.
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * // Require a specific permission
13
+ * <Protect permission="a_permission_key" />
14
+ *
15
+ * // Require a specific role
16
+ * <Protect role="a_role_key" />
17
+ *
18
+ * // Use a custom condition callback
19
+ * <Protect condition={(has) => has({ permission: "a_permission_key" }) } />
20
+ *
21
+ * // Require a specific feature
22
+ * <Protect feature="a_feature_key" />
23
+ *
24
+ * // Require a specific plan
25
+ * <Protect plan=a_plan_key" />
26
+ * ```
27
+ */
5
28
export type ProtectProps =
6
29
| {
7
30
condition ?: never ;
You can’t perform that action at this time.
0 commit comments