terra vidhal

Access Review

Component

About

A role-by-permission access review matrix with inherited grants, change highlighting, search, grouped filters, a guided review and a saved baseline.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Access Review to your project and fits it to your theme.

Code

How Access Review is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

/**
 * PrequelUI Animate — MIT — https://prequeluianimate.terravidhal.me
 */

import {
  AccessReview,
  type AccessGrants,
  type AccessPermission,
  type AccessRole,
} from "@/components/ui/access-review";

const ROLES: AccessRole[] = [
  { id: "owner", name: "Owner", description: "Full control of the workspace and billing.", locked: true },
  { id: "admin", name: "Admin", description: "Runs the workspace day to day." },
  { id: "editor", name: "Editor", description: "Creates and manages project content.", inherits: "viewer" },
  { id: "viewer", name: "Viewer", description: "Reads projects and reports." },
];

const PERMISSIONS: AccessPermission[] = [
  { id: "projects.view", label: "View projects", description: "Open project pages and their activity.", group: "Projects" },
  { id: "projects.create", label: "Create projects", description: "Start a new project from a template.", group: "Projects" },
  { id: "projects.manage", label: "Manage projects", description: "Edit settings, members and milestones.", group: "Projects" },
  { id: "projects.delete", label: "Delete projects", description: "Permanently remove a project and its files.", group: "Projects", critical: true },
  { id: "billing.view", label: "View invoices", description: "Read invoices, receipts and plan details.", group: "Billing" },
  { id: "billing.manage", label: "Manage billing", description: "Change the plan, seats and payment method.", group: "Billing", critical: true },
  { id: "team.view", label: "View members", description: "See the workspace directory and roles.", group: "Team" },
  { id: "team.invite", label: "Invite members", description: "Send workspace invitations by email.", group: "Team" },
  { id: "team.roles", label: "Change roles", description: "Move members between roles and remove access.", group: "Team", critical: true },
  { id: "security.audit", label: "Read audit log", description: "Inspect the workspace activity trail.", group: "Security" },
  { id: "security.keys", label: "Manage API keys", description: "Create, rotate and revoke workspace credentials.", group: "Security", critical: true },
  { id: "security.settings", label: "Security settings", description: "Configure sessions, domains and retention.", group: "Security", critical: true },
];

const GRANTS: AccessGrants = {
  owner: Object.fromEntries(PERMISSIONS.map((permission) => [permission.id, true])),
  admin: {
    "projects.view": true,
    "projects.create": true,
    "projects.manage": true,
    "projects.delete": false,
    "billing.view": true,
    "billing.manage": false,
    "team.view": true,
    "team.invite": true,
    "team.roles": false,
    "security.audit": true,
    "security.keys": true,
    "security.settings": false,
  },
  editor: {
    "projects.view": true,
    "projects.create": true,
    "projects.manage": true,
    "projects.delete": false,
    "billing.view": false,
    "billing.manage": false,
    "team.view": true,
    "team.invite": false,
    "team.roles": false,
    "security.audit": false,
    "security.keys": false,
    "security.settings": false,
  },
  viewer: {
    "projects.view": true,
    "projects.create": false,
    "projects.manage": false,
    "projects.delete": false,
    "billing.view": false,
    "billing.manage": false,
    "team.view": true,
    "team.invite": false,
    "team.roles": false,
    "security.audit": false,
    "security.keys": false,
    "security.settings": false,
  },
};

const SAVED_GRANTS: AccessGrants = {
  ...GRANTS,
  admin: { ...GRANTS.admin, "security.keys": false },
  editor: { ...GRANTS.editor, "projects.manage": false },
  viewer: { ...GRANTS.viewer, "team.view": false },
};

export default function AccessReviewDemo() {
  return (
    <main className="flex min-h-screen w-full items-center justify-center bg-gradient-to-b from-muted/40 via-background to-background px-4 py-6 sm:px-6">
      <AccessReview
        variant="plain"
        roles={ROLES}
        permissions={PERMISSIONS}
        initialGrants={GRANTS}
        savedGrants={SAVED_GRANTS}
        title="Workspace access review"
        defaultGroup="all"
      />
    </main>
  );
}

Dependencies

More by terra vidhal

View all
  • Project Timeline

    Project Timeline

    30
  • Kanban Board

    Kanban Board

    20
  • Gravity Stars Background

    Gravity Stars Background

    20
  • Booking Calendar

    Booking Calendar

    18
  • Notification Center

    Notification Center

    16
  • Audio Waveform

    Audio Waveform

    16
  • Kpi Counter

    Kpi Counter

    16
  • Topographic Lines

    Topographic Lines

    16

Explore more

Part of PrequelUI Animate — browse the full library on 21st.dev.