PermissionMatrix
A tab per role, each holding a resource by action grid of checkboxes over that role's grants. The value maps each role id to a Permission[] that canAccessWithPermissions reads. A cell granted by a wildcard shows as a locked checked cell. The matrix gates nothing itself: wrap it in <CanAccess> to decide who sees it. In Vue the value is a v-model.
Installation
pnpm dlx shadcn@latest add @chelone/permission-matrixLoading preview…
A tab per role, each holding a resource by action grid of checkboxes over that role's grants. The value maps each role id to a Permission[] that canAccessWithPermissions reads. A cell granted by a wildcard shows as a locked checked cell. The matrix gates nothing itself: wrap it in <CanAccess> to decide who sees it. In Vue the value is a v-model.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| actions | readonly string[] | — | One column per action. Defaults to `list`, `show`, `create`, `edit`, `delete`. |
| className | string | — | |
| onChange | (next: PermissionMatrixValue) => void | — | Called with the whole next value after a click. |
| readOnly | boolean | — | Disables every checkbox. |
| resources | readonly PermissionMatrixEntry[] | — | One row per resource. A string is labelled with the resource label. |
| roles | readonly PermissionMatrixEntry[] | — | One tab per role. A string is its own label. |
| value | PermissionMatrixValue | — | Role id to that role's grants. |