Components Reference
All CMS React components with their props and descriptions.
Components Reference
The CMS is built from composable React components organized by function. Every component reads metadata from the schema registry and adapts its behavior based on the current role.
Layout
Sidebar
The main navigation sidebar. Reads the schema registry to build a collapsible feature-grouped table list.
interface SidebarProps {
// No props — reads schema registry directly
}| Behavior | Description |
|---|---|
| Feature grouping | Tables grouped by feature with collapsible sections |
| Feature icons | Each feature gets a contextual icon (e.g., Calculator for accounting) |
| Active state | Current table highlighted with primary color |
| Internal filter | Tables with internal: true are hidden |
| Footer stats | Shows total feature and table counts |
Header
Top bar with tagline and role switcher.
interface HeaderProps {
// No props — renders tagline and RoleSwitcher
}RoleSwitcher
Dropdown to switch between owner, admin, and member roles. Available in demo mode. In live mode, the role is read from the authenticated session.
// Uses RoleContext internally
// Provides: role, setRole, sessionTable
DataTable
Standard browse table with clickable rows and sortable columns.
interface DataTableProps {
data: Record[];
columns: ColumnDef[];
onRowClick?: (row: Record) => void;
}| Prop | Description |
|---|---|
data | Array of records to display |
columns | Column definitions (built by ColumnFactory) |
onRowClick | Handler when a row is clicked (navigates to detail view) |
SpreadsheetTable
Excel/Google Sheets-like editable table with cell selection and keyboard navigation.
interface SpreadsheetTableProps {
data: Record[];
columns: ColumnDef[];
onCellEdit: (recordId: string, field: string, value: unknown) => Promise<void>;
editableFields: Set<string>;
onFKSearch: (targetTable: string, query: string) => Promise<FKOption[]>;
}| Prop | Description |
|---|---|
data | Array of records to display |
columns | Column definitions |
onCellEdit | Called when a cell value is saved (auto-saves on blur/Enter) |
editableFields | Set of field names that can be edited (from guards) |
onFKSearch | Async function for FK typeahead search |
Toolbar
Search bar, view selector, view mode toggle, and refresh button.
interface ToolbarProps {
table: TableMeta;
search: string;
onSearchChange: (search: string) => void;
onRefresh: () => void;
selectedView?: string;
onViewChange: (view: string | undefined) => void;
viewMode: "table" | "dataTable";
onViewModeChange: (mode: "table" | "dataTable") => void;
}| Prop | Description |
|---|---|
table | Table metadata (used to build view dropdown) |
search | Current search query |
onSearchChange | Handler for search input changes |
onRefresh | Refreshes the table data |
selectedView | Currently selected view name (undefined = all fields) |
onViewChange | Handler for view selection changes |
viewMode | Current view mode |
onViewModeChange | Handler for toggling between Table and Data Table |
Pagination
Page navigation controls with range indicator.
interface PaginationProps {
page: number;
pageSize: number;
total: number;
onPageChange: (page: number) => void;
}| Prop | Description |
|---|---|
page | Current page number (1-indexed) |
pageSize | Records per page |
total | Total record count |
onPageChange | Handler for page changes |
RowActions
Three-dot dropdown menu on each table row with view, edit, delete, and custom actions.
interface RowActionsProps {
table: TableMeta;
record: Record;
onDelete?: (id: string) => void;
onAction?: (action: ActionMeta, record: Record) => void;
}| Prop | Description |
|---|---|
table | Table metadata (used for CRUD access checks and action filtering) |
record | The row's record data |
onDelete | Handler for delete action |
onAction | Handler for custom action selection |
ColumnFactory
Utility function (not a component) that builds column definitions from table metadata.
function buildColumns(
table: TableMeta,
role: Role,
options?: { viewFields?: string[] }
): ColumnDef[];Generates columns with appropriate formatters for each field type: dates, money, booleans, enums, FK references, masked values, and plain text. Respects view field projections when provided.
Record
RecordDetail
Grouped field display for a single record. Auto-groups fields by category (Identity, Contact, Financial, References, Settings, Dates, Audit).
interface RecordDetailProps {
table: TableMeta;
record: Record;
role: Role;
}| Prop | Description |
|---|---|
table | Table metadata (columns, masking, validation) |
record | The record data to display |
role | Current user role (affects masking) |
FieldDisplay
Renders a single field value with appropriate formatting: masking, booleans, enums, FK links, dates, money, percentages, and numbers.
interface FieldDisplayProps {
column: ColumnMeta;
value: unknown;
role: Role;
masking?: Record<string, MaskingRule>;
validation?: Record<string, ValidationRule>;
}| Prop | Description |
|---|---|
column | Column metadata (type, mode, name) |
value | The raw value to display |
role | Current role (for masking checks) |
masking | Masking rules for the table |
validation | Validation rules (used for enum detection) |
ActionBar
Card displaying available actions as buttons for the current record.
interface ActionBarProps {
table: TableMeta;
record: Record;
onAction: (action: ActionMeta) => void;
}| Prop | Description |
|---|---|
table | Table metadata |
record | Current record (used for access condition evaluation) |
onAction | Handler when an action button is clicked |
RelatedRecords
Card showing incoming FK relationships with record counts. Lists tables that reference the current record.
interface RelatedRecordsProps {
table: TableMeta;
recordId: string;
}| Prop | Description |
|---|---|
table | Table metadata (used to discover incoming FK relationships) |
recordId | Current record ID (used to count related records) |
Form
AutoForm
Auto-generated create/edit form built from the table's guard configuration.
interface AutoFormProps {
table: TableMeta;
mode: "create" | "edit";
initialData?: Record;
onSubmit: (data: Record) => Promise<void>;
onCancel: () => void;
}| Prop | Description |
|---|---|
table | Table metadata (guards, columns, validation) |
mode | "create" uses createable fields, "edit" uses updatable fields |
initialData | Pre-filled values for edit mode |
onSubmit | Handler for form submission |
onCancel | Handler for cancel button |
Features:
- Fields determined from guards (createable for create, updatable for edit)
- Immutable fields shown as disabled with lock icon
- Protected fields shown as disabled with "Updated via actions only" note
- Client-side validation from schema rules
- Boolean fields grouped in a "Settings" section
- Required fields marked with red asterisk
FieldInput
Single form input that adapts to the column type and validation rules.
interface FieldInputProps {
column: ColumnMeta;
validation?: ValidationRule;
value: unknown;
onChange: (value: unknown) => void;
error?: string;
disabled?: boolean;
}| Prop | Description |
|---|---|
column | Column metadata (determines input type) |
validation | Validation rules (enum values, min/max, email) |
value | Current field value |
onChange | Handler for value changes |
error | Error message to display |
disabled | Whether the input is disabled |
Renders as: text input, number input, email input, URL input, date picker, select dropdown (for enums), textarea (for long text), or checkbox (for booleans).
Actions
ActionDialog
Modal dialog for executing a custom action with auto-generated input fields.
interface ActionDialogProps {
action: ActionMeta;
record: Record;
tableName: string;
onClose: () => void;
onExecute: (input: Record) => Promise<void>;
}| Prop | Description |
|---|---|
action | Action metadata (name, description, inputFields, sideEffects) |
record | The record the action applies to |
tableName | Table name (for context) |
onClose | Handler to close the dialog |
onExecute | Handler to execute the action with form data |
Features:
- Auto-generates input fields from action schema
- Destructive actions get red styling and warning icon
- File response actions get download icon
- Side effects warning banner for
sideEffects: "sync" - Loading state during execution
- Error display on failure
Next Steps
- Schema Format Reference — TypeScript types consumed by these components
- Table Views — How DataTable and SpreadsheetTable are used
- Inline Editing — SpreadsheetTable editing details