@paljs/admin
Introduction
A React admin UI package for Prisma-based applications. Provides a PrismaTable component that automatically generates full CRUD interfaces from your Prisma schema — tables, forms, filtering, sorting, pagination, and relation management.
In v9, the admin package uses React 19, Tailwind CSS 4, HeadlessUI, TanStack React Table, and DND-kit.
Installation
Peer Dependencies
Quick Start
1. Generate Admin Schema
Add admin generation to your paljs.config.ts:
Run prisma generate to create the admin schema and pages.
2. Set Up the Admin Provider
3. Use PrismaTable
Main Components
PrismaTable
The primary component. Renders a full CRUD interface for any Prisma model:
- Data table with sorting, filtering, and pagination
- Create modal with auto-generated form
- Edit page with relation management
- Delete with confirmation
- Connect/disconnect many-to-many relations
DynamicTable
Lower-level table component used by PrismaTable. Handles data fetching, pagination, and CRUD actions:
Settings
Configuration UI for customizing admin field visibility, ordering, and behavior:
The Settings component reads and writes to the admin schema JSON file, letting you:
- Show/hide fields in list and edit views
- Reorder fields
- Set field as read-only
- Configure field display names
Form
Auto-generated form based on Prisma model fields:
Features
Table Features
- Sorting — Click column headers to sort ascending/descending
- Filtering — Filter by any field type (string, number, boolean, enum, date, relations)
- Pagination — Configurable page size with navigation
- Column visibility — Show/hide columns via settings
Form Features
- Auto-generated fields — Text, number, boolean, enum, datetime inputs
- Relation fields — Search and select related records via modal
- Validation — Required field enforcement via react-hook-form
- Create and edit — Same form component for both actions
Relation Management
- One-to-one / Many-to-one — Search modal to select related record
- Many-to-many — Sub-table with connect/disconnect buttons
- Nested editing — Edit related records inline via tabs
Styling
The admin package uses Tailwind CSS 4 for styling. Ensure your project includes Tailwind CSS:
The components use standard Tailwind utility classes and are fully customizable.
GraphQL Integration
PrismaTable uses Apollo Client for data fetching. It expects the following GraphQL operations to be available on your server (generated by @paljs/generator):
findMany{Model}— List recordsfindCount{Model}— Count records for paginationcreateOne{Model}— Create a recordupdateOne{Model}— Update a recorddeleteOne{Model}— Delete a record
Wrap your admin app in an ApolloProvider:
AdminProvider Props
Types
TableParentRecord
Used for relation sub-tables:
AdminSchemaModel
Defines the admin schema for a single model: