Docs / Inlay / Customising the Admin

Customising the admin

All admin options live under admin in config/inlay.php:

'admin' => [
    'prefix' => 'admin/content',
    'middleware' => ['web', 'auth'],
    'ability' => 'manage-content',
    'layout' => 'layouts.admin',
],

Prefix and middleware

prefix is the admin's URL prefix (inlay by default). middleware guards it; the default ['web'] leaves the admin public. Inlay::adminRoutes() also registers your middleware (minus web) as Livewire persistent middleware, so it re-runs on every admin action, not only the first page load.

Ability

ability names a Gate ability that every admin screen checks itself, on the first load and on every Livewire action after it. It receives the Page where there is one:

Gate::define('manage-content', fn (User $user, ?Page $page = null) => $user->is_editor);

null leaves access to the middleware alone. Set it whenever you mount Inlay's components on your own routes: Livewire only re-runs the middleware Inlay registers for its own routes. inlay:install sets it to inlay.manage-pages, and inlay:doctor fails when it's missing, undefined, or lets guests through.

Your layout, Inlay's screens

Point layout at a Blade component that renders $slot (and optionally $title). Inlay's pages, editor and settings render inside it, on Inlay's routes. 'layouts.admin' is resources/views/components/layouts/admin.blade.php.

The editor fills the height of the element around it, so give the layout's content area a height - for example a flex column with min-height: 100dvh.

Your routes, Inlay's components

Mount the components yourself, wrapped in <x-inlay::frame>, which loads Inlay's CSS and JavaScript and scopes its styles:

<x-layouts.admin>
    <x-inlay::frame>
        <livewire:inlay::page-editor :page="$page" />
    </x-inlay::frame>
</x-layouts.admin>

Available components: inlay::page-index, inlay::page-create, inlay::page-editor and inlay::site-settings-editor.

Keep Inlay::adminRoutes() registered - the editor's preview and the admin assets are served from it.

Inlay::adminUrlsUsing(fn (string $screen, mixed ...$params) => match ($screen) {
    'pages.edit' => route('admin.content.edit', $params[0]),
    default => null,
});

The resolver receives the screen - pages.index, pages.create, pages.edit (with the Page) or settings (with the group handle) - and returns a URL, or null to keep Inlay's own route.

Colours and fonts

Override the --inlay-* custom properties on .inlay to match your brand. Scoping them to .inlay makes them win over Inlay's own defaults whichever stylesheet loads first:

.inlay {
    --inlay-accent: #334735;
    --inlay-bg: #f8fafc;
    --inlay-font: "Almarai", sans-serif;
}
Variable Default Used for
--inlay-bg #faf9f7 Page background
--inlay-surface #ffffff Panels, cards, inputs
--inlay-border #e7e3dd Borders
--inlay-border-strong #d6d1c9 Stronger borders
--inlay-text #1c1a17 Body text
--inlay-text-muted #6b6459 Secondary text
--inlay-text-faint #8a8377 Hints and placeholders
--inlay-accent #16140f Primary buttons and highlights
--inlay-accent-contrast #ffffff Text on the accent colour
--inlay-focus #2f5fd6 Focus rings
--inlay-danger #a4362b Destructive actions and errors
--inlay-draft #a8792a Draft status
--inlay-published #2f6b4f Published status
--inlay-radius 6px Controls: buttons, inputs, badges
--inlay-radius-lg 14px Containers: preview frame, drawers, cards
--inlay-shadow-sm 0 1px 2px rgba(20, 18, 14, 0.06) Small shadows
--inlay-shadow-md 0 8px 24px -8px rgba(20, 18, 14, 0.18) Raised surfaces
--inlay-font system UI stack Admin font
--inlay-font-mono system monospace stack Code

Theme from the installer

On a Tailwind CSS project, inlay:install copies --font-sans and your brand colour (--color-brand, --color-primary or --color-accent, whichever it finds first) from the @theme block in resources/css/app.css into an .inlay { ... } block of --inlay-* variables at the bottom of the same file. It applies where the admin renders inside your own layout, and it's ordinary CSS to adjust from there.

Your own field UI

Replace the editor's UI for any field type with a Blade view of your own - a media library picker for images, a brand-styled colour select - without forking Inlay:

// config/inlay.php
'admin' => [
    'fields' => [
        'image' => 'admin.fields.media-picker',
    ],
],

Keys are field types: text, textarea, richtext, number, toggle, select, image, link, repeater, group and blocks. The view replaces that type everywhere: section settings, blocks, repeater items and site settings. It receives:

Variable What it is
$field The Setting: name, label, help, required, options and so on
$modelPath The wire:model path for the value, e.g. editingProps.photo
$editingProps Every value being edited, for reading the current one

Bind the value with wire:model on $modelPath, and the editor saves it like any other field:

{{-- resources/views/admin/fields/brand-text.blade.php --}}
<label class="inlay-field__label" for="{{ $modelPath }}">{{ $field->label }}</label>
<input id="{{ $modelPath }}" type="text" wire:model.live.debounce.400ms="{{ $modelPath }}" class="inlay-input">

An image view uploads through imageUploads instead, at the same path without the editingProps. prefix, and can clear the value with clearField:

@php($path = Str::after($modelPath, 'editingProps.'))

<input type="file" accept="image/*" wire:model="imageUploads.{{ $path }}">

@unless ($field->required)
    <button type="button" wire:click="clearField('{{ $path }}')">Remove</button>
@endunless

Inlay's own views in resources/views/fields are the reference for every type.

Buttons in the editor header

Add your own buttons or links beside Publish - "View live page", a help link - with a view that receives the $page:

'admin' => [
    'editor_actions' => 'admin.inlay.editor-actions',
],
{{-- resources/views/admin/inlay/editor-actions.blade.php --}}
@if ($url = \WeArePixel\Inlay\Facades\Inlay::url($page))
    <a href="{{ $url }}" target="_blank" class="inlay-button inlay-button--ghost">View live page</a>
@endif

Wording

Every label, button and message in the admin is in a translation file. Publish it to rename anything, or to translate the editor:

php artisan vendor:publish --tag=inlay-lang

Then edit lang/vendor/inlay/en/admin.php, or add another locale beside it. Laravel merges your file over Inlay's, so it only needs the keys you change:

// lang/vendor/inlay/en/admin.php
return [
    'editor' => [
        'publish' => 'Go live',
    ],
];

A few strings wrap code or a URL in markup, so they're output as HTML: create.path_help, create.will_publish_at, page_settings.publishes_at, picker.none_registered, picker.no_results, route_conflict.body and preview.fallback_notice. Keep their :placeholders in lower case, as written, and escape any & or < of your own.

Overriding Inlay's views

As a last resort, publish every admin view and change them directly:

php artisan vendor:publish --tag=inlay-views

Laravel uses resources/views/vendor/inlay in place of Inlay's own. Published views don't get Inlay's fixes and changes when you upgrade, so prefer the field views, editor actions and CSS variables above, and publish only the files you change.

Discovery Call

One call.
We'll both know.

20 minutes to walk through your project, ask the hard questions, and work out honestly if we're the right team for it.

  • One call per day - it gets our full attention
  • Australia's only Laravel Premier Partner
  • Trusted by Chemist Warehouse, HelloFresh and Youfoodz
  • Senior engineers only - no juniors on your project
  • Brisbane-based, onshore team

Press Esc to close  ·  B to reopen