suiss/ui · Block
Roles Matrix
A permissions matrix with a checkbox for every permission and role, grouped by area, with a save action.
Roles Matrix is an open-source block from suiss/ui for React. The @esuiss/ui CLI copies its source into your project, so you own the code.
A permissions matrix with a checkbox for every permission and role, grouped by area, and a Save button that enables after a change. The Admin column is fixed. On narrow screens the grid keeps its width and scrolls sideways. Use it when admins need to compare all roles at once rather than edit one at a time.
Installation
CLI
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
Manual
- Install the dependencies:
-
Copy the source into
components/blocks/roles-matrix.tsx:
- Update the import paths to match your project.
Usage
Edit roles for the columns and groups for the rows; each permission has a name and a grants array of 1 or 0 per role, in role order. The first column is always disabled. Replace the Save handler, which only toggles local flags, with your API call.
Notes
Each checkbox is labeled with its group, permission and role, so cells make sense without the visual header row.