Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Permission Matrix

ProNew

Roles across, permissions down in groups, a checkbox where they meet. A box under each role ticks or clears its column, and a locked role shows why it cannot change.

Installation

pnpm dlx shadcn@latest add @viewport/permission-matrix

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above comes with Truffle Pro.

Props

PropTypeDefault
roles*Role[]—
groups*PermissionGroup[]—
value*Record<string, string[]>

The permissions each role holds, by role id.

—
onValueChange*(value: Record<string, string[]>) => void—
captionstring

A caption for screen readers.

"Permissions by role"
classNamestring—

Accessibility

  • A real table: each box is named with its role and permission.
  • Arrow keys move between boxes like a spreadsheet.
  • The column box shows a mixed state when only some are ticked.
  • The permission column stays in view while the table scrolls sideways.