TabletopDOCS
API Reference

Panel

Panel-level configuration: routing, appearance, navigation, chrome and the command palette.

Panel-level configuration: routing, appearance, navigation, chrome and the command palette.

PanelConfig

Tbtop\Admin\Panels\PanelConfig

MethodWhat it does
authStack(): arrayThe panel's auth/app middleware layer a page spreads to add to it, e.g. middleware(PanelConfig $p): array { return [...$p->authStack(), 'throttle:30,1']; }. Access rules belong in Page::can(), which MCP calls also enforce. Excludes SetCurrentPanel/SetAdminLocale — the route layer always applies those. AuthenticateSession follows auth: it reads the user that auth:{guard} resolves, and ends a session whose password hash no longer matches the user's (a reset elsewhere). RequireTwoFactor follows it: while the panel serves a TwoFactorChallengePage subclass, a user with a second factor who has not passed it in this session goes to the challenge. RequireVerifiedEmail comes last: while the panel serves an EmailVerificationPage, a MustVerifyEmail user with an unverified email is sent there.
brand(string $brand): staticBrand name shown in the chrome (sidebar/topbar header); the logo's alt text when a logo is set.
brandLogo(string $url): staticLogo image URL shown in the chrome's logo block instead of the brand name.
brandLogoHeight(string $height): staticRendered logo height as a CSS length in px, rem or em (default '1.5rem').
breadcrumbs(bool $enabled = true): staticWhether pages build and send the breadcrumbs prop.
chrome(string $chrome): staticClass-string of a Chrome subclass that authors the shell (header/sidebar/ footer). Override headerItems()/sidebarItems() and spread the parent to append to the stock shell; override header()/sidebar()/footer() to replace an area outright.
commandPalette(Closure|bool $config = true): staticEnable (default), disable with false, or configure the ⌘K command palette via a closure. The closure receives the CommandPaletteConfig to mutate (->commands([Command::make(...)...])) and returns nothing.
darkMode(bool $enabled = true): staticAllow or disable the dark-mode toggle entirely (default: allowed).
darkModeBrandLogo(string $url): staticLogo image URL used while the panel is in dark mode; falls back to brandLogo().
defaultLocale(string $locale): staticDefault admin UI locale, overriding the first entry of locales().
defaultThemeMode(string $mode): staticInitial theme when the visitor has no saved preference.
density(string $mode): staticShell density: 'compact' tightens control heights, spacing, and the sidebar width.
discoverPages(string $in, string $for): staticAdds a recursive page discovery directory and its Composer-autoloadable namespace; rebuild the page cache after adding pages.
environmentIndicator(Closure|array|bool $indicator = true): staticShow the app environment as a colored header badge and top strip; hidden in production. Pass an array to override per environment (['staging' => 'warning', 'qa' => ['label' => 'QA', 'color' => 'info'], 'local' => false] — listing production shows it), or a Closure returning ['label' => …, 'color' => …] or null, called per request. Colors are the badge names: gray, primary, success, warning, danger, info.
favicon(string $url): staticBrowser-tab icon URL (.ico, .png or .svg) for every page of the panel.
guard(string $guard): staticAuth guard checked by authStack(). Defaults to 'web'.
id(string $id): staticFeeds the route-name namespace (tbtop.{id}.*) — changing it on an existing panel renames every route.
locales(array $locales): staticAdmin UI locales. First entry is the default unless defaultLocale() is set.
maxContentWidth(string $width): staticCenter page content to a Tailwind max-w token (e.g. '7xl').
mcp(array $middleware, string $path = 'mcp'): staticExpose this panel to AI agents over MCP at POST {prefix}/{$path} (needs composer require laravel/mcp). $middleware is the route's whole auth and access stack — it REPLACES the panel's middleware, which does not run for MCP calls: name stateless token auth and repeat the panel's role checks, e.g. ['auth:sanctum', 'abilities:tbtop-mcp', 'role:admin', 'throttle:60,1']. A page's own restriction belongs in Page::can(), which MCP enforces. An empty list throws: it would serve the panel without authentication.
mcpAllowedOrigins(array $origins): staticBrowser origins, besides the origin of app.url, that may call the MCP endpoint (https://agent.example.com). A request whose Origin is neither gets 403; one with no Origin — a desktop or CLI client — is not affected.
mediaGate(?string $ability): staticGate ability every media-manager endpoint (list, show, download, upload, URL import, edit, replace, delete, folders) requires; a user who fails it gets 403. Null, the default, leaves the API open to every user who passes the panel's middleware.
middleware(array $middleware): staticReplaces the default ['web'] app-middleware stack rather than appending to it; authStack() adds auth:{guard}, AuthenticateSession and RequireVerifiedEmail on top at read time.
navigation(string $navigation): staticShell navigation layout: 'sidebar' (default), 'topbar', 'topbar-sidebar' (full-width bar with a sidebar beneath it), or 'rail-sidebar' (a rail of labeled nav-group icons beside a sidebar listing only the active group). The client renders the same chrome blocks; only their arrangement changes. All layouts collapse to a burger drawer on mobile.
navigationGroups(array $groups): staticPer-group nav metadata as a list of NavGroup::make('Content')->icon('file-text') ->collapsible(), matched to a page's nav()['group'] by that label.
navigationItems(array $items): staticExtra always-shown nav entries with no page/gate (e.g. an external link), merged into the built tree alongside page-derived items, grouped by label the same way navigationGroups() matches groups.
notificationsPolling(?int $seconds): staticSeconds between header-bell polls for new notifications. null disables auto-polling (the bell still fetches when opened). Mirrors Filament's databaseNotificationsPolling(); only active when the chrome renders a notifications bell.
pages(array $pages): staticReplaces manual pages; discovery merges them first and removes duplicate classes.
passwordBroker(?string $broker): staticPassword broker from config/auth.php for the auth pages' reset flow; null uses the app default. A guard on a non-default provider needs its own broker.
prefix(string $prefix): staticURL path prefix the panel is mounted under. Defaults to the panel id when unset — see getPrefix().
rootView(string $view): staticBlade root view rendered on first visit (per-panel Vite entry escape hatch).
stylePreset(string $style): staticComponent style from ui.shadcn.com/create (its "Style" choice): 'vega' (default), 'nova', 'maia', 'lyra', 'mira', 'luma', 'sera' or 'rhea'. Shapes sizes, spacing, radii and shadows; colors stay in your CSS tokens. The root Blade's <html> carries CurrentPanel::current()?->stylePresetClass().
unsavedGuard(bool $enabled = true): staticDefault for the unsaved-changes navigation guard on forms.
userMenuItems(array $items): staticCustom profile-dropdown entries rendered alongside the fixed theme/locale/logout controls. Link-only (label/icon/href/newTab) — chrome trees are page-independent (no per-request endpoint for a server closure to resolve against), same constraint as NotificationAction.

Chrome

Tbtop\Admin\Panels\Chrome

MethodWhat it does
footer(S $s): ?NodeNo footer in the stock shell.
header(S $s): ?NodeTopbar content. The shell right-aligns it; align: center keeps items of differing heights on one axis instead of stretching to the tallest.
sidebar(S $s): ?NodeSidebar content: logo on top, nav groups below.

Tbtop\Admin\Navigation\NavGroup

MethodWhat it does
collapsed(bool $collapsed = true): selfStart the group collapsed (implies collapsible).
collapsible(bool $collapsible = true): selfRender the group header as a collapse toggle.
description(Closure|string $description): selfOne muted line under the group's title, in every navigation layout: the rail-sidebar column, the sidebar heading, and the top of a dropdown menu. Pass a Closure for the same request-time translation reason as label().
icon(Closure|string $name, Closure|string $position = 'left'): static$name is a kebab-case Lucide icon name (e.g. 'circle-check') resolved against the client's icon registry; register custom names client-side via registerIcon before using them here. $position is 'left' (default) or 'right', placing the icon relative to the label. Either may be a Closure; a closure-supplied position is validated when it resolves.
label(Closure|string $label): selfTranslated header text shown in the sidebar. Pass a Closure to defer translation to request time — panel config is built once (singleton), so a bare __() there would freeze on the first request's locale.
sections(array $sections): selfNamed sections inside the group, in render order, as key => heading. Pages opt in with nav()['section'] => key; items without a section render first, unheaded. Pass Closure labels for the same request-time translation reason as label().

Tbtop\Admin\Navigation\NavItem

MethodWhat it does
can(array|string|null $gate): selfShow the item only to users the gate allows: an ability, or an ability plus the model class its policy resolves from — the same value a Page::can() returns, so ->can(SomePage::can()) hides a link to a page its user may not open. Null (the default) shows it to everyone.
group(string $group): selfSidebar group heading this item is listed under (nav context only); unset = ungrouped, no heading.
icon(Closure|string $name, Closure|string $position = 'left'): static$name is a kebab-case Lucide icon name (e.g. 'circle-check') resolved against the client's icon registry; register custom names client-side via registerIcon before using them here. $position is 'left' (default) or 'right', placing the icon relative to the label. Either may be a Closure; a closure-supplied position is validated when it resolves.
newTab(bool $newTab = true): selfDeprecated (removed in 1.0): use url()->openUrlInNewTab().
openUrlInNewTab(bool $condition = true): selfOpen url() in a new browser tab instead of navigating in place.
section(string $section): selfSection key within its group, declared on NavGroup::sections() (nav context only). Ignored for ungrouped items and in the user menu.
sort(int $order): selfSort position within its group (nav context only).
url(string $url): selfDestination URL — an internal path or an external link.

CommandPaletteConfig

Tbtop\Admin\CommandPalette\CommandPaletteConfig

MethodWhat it does
commands(array $commands): staticReplaces the custom command list; additive to includeNav()'s auto-listed sidebar destinations, not a substitute for it.
disable(): staticSugar for enable(false); a disabled palette is omitted from the wire entirely.
enable(bool $enabled = true): staticPalette is enabled by default; pass false to disable it (same as disable()).
hotkey(string $spec): staticKeybinding that opens the palette (default ⌘K / Ctrl+K).
includeNav(bool $include = true): staticAuto-list sidebar destinations (default true). false = commands only.
placeholder(string $text): staticPlaceholder text for the palette search input.

Command

Tbtop\Admin\CommandPalette\Command

MethodWhat it does
group(string $group): selfGroup heading the command is listed under.
handler(string $name): selfRun a client handler registered via definePaletteCommand() instead of navigating.
icon(Closure|string $name, Closure|string $position = 'left'): static$name is a kebab-case Lucide icon name (e.g. 'circle-check') resolved against the client's icon registry; register custom names client-side via registerIcon before using them here. $position is 'left' (default) or 'right', placing the icon relative to the label. Either may be a Closure; a closure-supplied position is validated when it resolves.
keywords(array $keywords): selfExtra search terms beyond the label.
openInNewTab(bool $newTab = true): selfDeprecated (removed in 1.0): use url()->openUrlInNewTab().
openUrlInNewTab(bool $condition = true): selfOpen url() in a new browser tab instead of navigating in place. No effect when handler() is used instead of url().
url(string $url): selfNavigate to a URL — an internal path (Inertia visit) or an external link.

On this page