Prodular UI

Permissions matrix

Pro

Roles across, permissions down, a level in every cell: no access, read, write or admin. Granting a permission adds what it requires, removing one takes away what depends on it, and roles and groups change in bulk.

npx prodular-ui add permissions-matrix

Part of Prodular UI Pro. Preview and read the docs freely, install with a license. See pricing

Edit roles

Owner is locked. Give Approver write on Refunds and it also gets write on Invoices; remove Bills from Accountant and Payouts goes with it. Changed cells are marked until you save.

Permissions by role
Permission
Owner1 member
Admin2 members
Accountant4 members
Approver3 members
AuditorCustom1 member
Invoices and customers
InvoicesAdmin
CustomersAdmin
Refunds and credit notesWrite
Payments
BillsAdmin
PayoutsWrite
Bank accountsAdmin
Workspace
Members and rolesAdmin
AI and agentsAdmin
Audit logRead

Read only

readOnly shows the same matrix without controls, for people who can see roles but not change them.

Permissions by role
Permission
Member
Guest
Projects
View projectsReadRead
Edit tasksWrite–
Share outside the workspace––

Anatomy

<PermissionsMatrix  groups={groups}  roles={roles}  value={value}  onValueChange={setValue}  initialValue={saved}  onSave={save}/>

Guidance

Use it when

  • Role based access for a workspace or an organization: the settings page where admins define what each role can do.
  • levels per permission when not every level makes sense, like an audit log that is only none or read.
  • requires for real dependencies, so a role can never hold a permission that would not work without another.

Avoid

  • Assigning roles to people. Use the members list with a role select.
  • More than about eight roles. Add a role filter or split the matrix by product area.
  • Per-record sharing. Use a share dialog on the record.

Rules for AI agents

Published in llms-full.txt, the registry and the MCP server, so coding agents follow them when they build with this component.

  • Describe permissions as groups of { id, label, description?, levels?, requires? } and roles as { id, label, members?, locked?, custom? }.
  • Keep value as { [roleId]: { [permissionId]: level } } and pass onValueChange. Missing entries mean none.
  • Pass the saved value as initialValue and an async onSave to get change markers and the Save bar; throw from onSave to show an error.
  • Mark built-in owner roles locked: they show every permission at its highest level and cannot be edited.
  • Use setPermission(value, groups, role, permission, level) on the server too, so dependency rules hold however permissions change.
  • Cells are a grid: arrow keys move, Enter opens the level menu. Every cell's accessible name includes the permission, the role and the level.

API

PermissionsMatrix

PropTypeDefaultDescription
groupsPermissionGroup[]Groups of permissions with levels and requirements.
rolesPermissionRole[]Columns, in order.
value / onValueChangePermissionValue / (value) => voidLevels by role and permission.
readOnlybooleantrue without onValueChangeHides the controls.
initialValue / onSavePermissionValue / (value) => Promise<void>Change markers, Discard and Save.

setPermission

PropTypeDefaultDescription
(value, groups, role, permission, level){ value, changes }Applies one change with its dependencies.

diffPermissions

PropTypeDefaultDescription
(before, after, roles, groups){ role, permission, from, to }[]Every changed cell, for review or an audit entry.

Installation

The Prodular UI CLI adds the source to components/ui with everything it depends on. In a project that already uses shadcn/ui, the shadcn CLI installs it from the Prodular registry too. See Installation for the first setup.

npx prodular-ui add permissions-matrix# or, with the registry in components.jsonnpx shadcn@latest add @prodular/permissions-matrix