Skip to content
caliper ui docs

Pro

Roles permissions

A matrix of roles against permissions.

Pro
pnpm dlx shadcn@latest add @caliper/roles-permissions

Roles

What each role can do in the Northwind workspace

Permissions apply to everyone in the role, the moment you save.

PermissionOwner1 memberAdmin2 membersEditor3 membersViewer1 member
Work
View projects
Edit projects
Publish changesMake edits live for customers
Delete projects
People
Invite people
Change roles
Remove people
Billing
View invoices
Change plan

Installs components/ui/roles-permissions.tsxDepends on @radix-ui/react-slot, lucide-reactMotion none in component source

When to use

Use it for

  • Defining who can do what.

Skip it when

  • Few roles.

Installation

terminal
pnpm dlx shadcn@latest add @caliper/roles-permissions

Adds its 4 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.

Usage

Import it from your copy of the source. The example behind the preview comes with the source.

example.tsx
import { RolesPermissions } from "@/components/ui/roles-permissions"

The worked example comes with Pro

The 55-line example behind the preview opens here, ready to copy.

  • 626 Pro parts, blocks and page templates, all with source
  • $149 once, with lifetime updates. No renewal
  • A full refund within 14 days if it is not for you
Checking your licence…

API reference

RolesPermissions

component
PropTypeDefaultDescription
roles *readonly Role[]—
groups *readonly PermissionGroup[]—
value *Readonly<Record<string, readonly string[]>>—The saved matrix: role id to the permission ids it has.
onSave *(next: Readonly<Record<string, readonly string[]>>) => void—
onCreateRole((name: string) => void)—Called with a new role's name. It starts with the permissions of the first editable role.
classNamestring—

Accessibility

It exposes region and status semantics, with aria-label and aria-hidden kept in step with state. Changes that matter are announced through a live region.

KeyBehaviour
EscapeCloses or cancels, then returns focus to where it came from.

Motion

It declares no animation in its component source. Any transition comes from its stylesheet, which uses the duration tokens that collapse to instant under prefers-reduced-motion.

All Team examples