Edit what a role can do. Permissions sit in groups with a header checkbox and a count, dependencies grant and revoke what they need with a note, and a diff under the table feeds your save bar. Compare mode puts other roles beside it.
On this page
- Custom roles
- Role settings
- Comparing roles
- Access reviews
- Admin consoles
Examples
Compare roles
The role you edit comes first after the names; the others are read-only columns with their counts. Scroll sideways on a phone: the names and the header stay put.
A built-in role, read-only
Cells you cannot grant
A person can only hand out what they hold. Return the reason from isDisabled: the cell stays in the tab order with the reason in a tooltip, and a toggle whose dependencies would reach such a cell is refused.
Installation
Installation is part of Pro
Pro components install from a licensed registry. The live preview stays open to everyone.
Props
- catalogrequired
PermissionGroup[]- Groups of { id, label, description?, dependsOn? }. dependsOn lists ids a permission needs; unknown ids are skipped and cycles are safe.
- valuerequired
PermissionId[]- The edited role's set. Controlled.
- onValueChange
(next, change) => void- next is the new set. change is { toggled, granted, alsoGranted, alsoRevoked }: toggled is the permission id, the group id for a group checkbox, or the role id for Start from.
- baseline
PermissionId[]- Default
first value - The saved set, for the row tints, the diff and dirty.
- onDirtyChange
(dirty) => void- Called when the set starts or stops differing from baseline.
- readOnly / readOnlyReason
boolean / string- Default
false - Marks instead of checkboxes, a lock in the header and the reason above the table. Start from is hidden.
- isDisabled
(id) => string|false- The reason a cell cannot change, shown in its tooltip.
- compare
Role[]- Other roles as read-only columns after the edited one, with sticky names and header. Set --pm-max-h for the scroll height (70vh).
- editingLabel
string- Default
"This role" - The edited column's header, also used in every cell label: "Read issues for QA Lead".
- startFrom
Role[]- Roles to copy from. Empty or omitted hides the menu.
- search / onSearchChange
string / (q) => void- Control the filter from outside; uncontrolled by default.
- defaultOpenGroups
string[]- Default
all - Groups open at first. Searching opens every group with a match.
- showDiff
boolean- Default
true - The +N, -M summary with the changed permissions under the table.
- className
string- On the outer element.
| Prop | Type | Default | Description |
|---|---|---|---|
| catalogrequired | PermissionGroup[] | required | Groups of { id, label, description?, dependsOn? }. dependsOn lists ids a permission needs; unknown ids are skipped and cycles are safe. |
| valuerequired | PermissionId[] | required | The edited role's set. Controlled. |
| onValueChange | (next, change) => void | - | next is the new set. change is { toggled, granted, alsoGranted, alsoRevoked }: toggled is the permission id, the group id for a group checkbox, or the role id for Start from. |
| baseline | PermissionId[] | first value | The saved set, for the row tints, the diff and dirty. |
| onDirtyChange | (dirty) => void | - | Called when the set starts or stops differing from baseline. |
| readOnly / readOnlyReason | boolean / string | false | Marks instead of checkboxes, a lock in the header and the reason above the table. Start from is hidden. |
| isDisabled | (id) => string | false | - | The reason a cell cannot change, shown in its tooltip. |
| compare | Role[] | - | Other roles as read-only columns after the edited one, with sticky names and header. Set --pm-max-h for the scroll height (70vh). |
| editingLabel | string | "This role" | The edited column's header, also used in every cell label: "Read issues for QA Lead". |
| startFrom | Role[] | - | Roles to copy from. Empty or omitted hides the menu. |
| search / onSearchChange | string / (q) => void | - | Control the filter from outside; uncontrolled by default. |
| defaultOpenGroups | string[] | all | Groups open at first. Searching opens every group with a match. |
| showDiff | boolean | true | The +N, -M summary with the changed permissions under the table. |
| className | string | - | On the outer element. |
The pure helpers ship with it: applyToggle(catalog, value, id, granted) returns the next set with alsoGranted and alsoRevoked, and diffPermissions(before, after) returns { added, removed }. Use them on the server to check a saved set the same way.
Accessibility
- One table with role="grid" and one tab stop. Arrows move between cells, Home and End go to the ends of a row, Ctrl or Cmd with them to the first and last row, PageUp and PageDown jump ten rows.
- Space toggles the checkbox under focus, or the role's checkbox when the permission name has focus. Enter or Space on a group name folds it.
- Every cell has a label: "Edit any issue for QA Lead", and in compare mode "Edit any issue for Viewer: not granted".
- What a toggle also changed is read out once by a polite live region; changed rows say "added, not saved" or "removed, not saved".
- A cell that cannot change keeps focus with aria-disabled, so its reason can be read.
What it handles
- 01Lists permissions in groups that fold, each with a header checkbox that is mixed when part of the group is on and a count such as 3/14.
- 02Follows dependsOn both ways: granting Edit any issue grants Edit own issues, revoking Read issues revokes everything that needs it, and a note under the row says what else changed.
- 03Tints changed rows green or red against the saved set and sums them up under the table (+3 permissions, -1) for the save bar.
- 04Copies another role's set with Start from, searches labels and descriptions, and shows built-in roles read-only with a lock and the reason.
- 05Turns a cell off with its reason in a tooltip, and refuses a toggle whose dependencies would change a cell that is off.
- 06Compares roles side by side: the edited role first, the others as read-only columns, with the first column and the header sticky while you scroll.
States
- Toggle
- The checkbox and the row tint change colour
- 120ms, colour only
- Dependency note
- The note under the row folds open, and folds shut on the next toggle without one
- 180ms open, 120ms close
- Diff summary
- Folds open on the first change, shut when the set matches the saved one again
- 180ms open, 120ms close
- Fold a group
- Rows appear or go at once
- none
- Reduced motion
- Notes and summary appear at once
- 0ms
| State | What moves | Timing |
|---|---|---|
| Toggle | The checkbox and the row tint change colour | 120ms, colour only |
| Dependency note | The note under the row folds open, and folds shut on the next toggle without one | 180ms open, 120ms close |
| Diff summary | Folds open on the first change, shut when the set matches the saved one again | 180ms open, 120ms close |
| Fold a group | Rows appear or go at once | none |
| Reduced motion | Notes and summary appear at once | 0ms |
Works with
When to use
When to use
- Editing a custom role's permissions with dependencies, a diff and a save bar.
- Comparing what several roles can do side by side, or showing a built-in role read-only.
When not to use
- Giving a person a role: use Role Picker.
- A handful of on and off settings: use Settings.
Using with AI
Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:
- Add the Knowns UI Permission Matrix to my app and wire it to my own data.
- I need editing a custom role's permissions with dependencies, a diff and a save bar. Set that up with the Knowns UI Permission Matrix.
- Which Permission Matrix props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "permission-matrix" }) and search_docs({ query: "permission matrix" }). Pro props, full examples and source come back once your license key is in the MCP config.