Skip to main content
A custom admin page built from AdminLayout, PageHeader, Stat, DataTable and Panel
Most modules do not need this. If a field list is enough, use the generated settings page. Write a custom page for tables, dashboards, editors and anything with its own workflow.

Build it

1

Render a page name from a controller

Put the route in routes/settings.php and declare its permission in module.json, see module.json and settings.
2

Register the page

resources/js/register.ts
3

Write the page

Wrap it in AdminLayout and build from the kit, see the example below.
4

Build the frontend

A small complete example

AdminLayout gives the page the Admin Modern shell: sidebar, topbar and breadcrumbs.

The kit

Import from @/pages/admin-themes/admin-modern/components/. Buttons use am-button with am-button-primary, am-button-quiet, am-button-danger or am-button-critical. A plain <input>, <select> or <textarea> inside Field is styled for you.
The page inherits its look from theme.css. Use its variables instead of fixed colours: --am-ink, --am-muted-ink, --am-surface, --am-hairline, --am-accent, --am-good, --am-warning and --am-critical.Admins change the palette on the Colors page in the admin, and the corner roundness with the ui_corner_radius setting. Both flow through these variables, so anything built from the kit follows along. Hard coded hex colours and pixel radii will not.

The RichTextEditor

@/components/editor/RichTextEditor is the Markdown editor used by News, Blog, the knowledge base and custom pages. It edits and returns Markdown, with a bubble menu, a slash menu, tables, task lists and image upload.
Props: value, onChange, placeholder, label, maxLength, error, disabled, draftKey (keeps a local draft), attachments, actions, minHeight, maxHeight, onEditorReady and onUploadImage. Render saved Markdown on the public side with @/components/MarkdownRenderer.
Only packages in core’s package.json exist. Do not add your own editor or chart library. The module’s package.json is never installed.

Worth reading

GDPRCompliance

Dashboard, tables, filters, dialogs and a RichTextEditor form.

Affiliates

Stats, tables and settings built with Field and Panel.