← @mortar-kit/admin

AdminPropsinterface

import { AdminProps } from '@mortar-kit/admin'

interface AdminProps

Properties

bricks: readonly AnyBrick[]

The bricks this site defines.

collections: readonly AnyCollection[]

The site's collections, in the order the sidebar lists them.

content: Content

Reads and writes. Reads should be uncached, so the admin always shows what is saved (the app's server functions, or createContent in tests).

previewUrl: string

URL of the app route that renders <PreviewPage> from @mortar-kit/admin/preview.

location?: AdminLocation

Where the admin is, when the app keeps it (e.g. in the URL). Without it the admin keeps it itself.

onNavigate?: (to: AdminLocation) => void

With location: called to go somewhere; the app updates location (or doesn't, e.g. when its guard says no).

onDirtyChange?: (dirty: boolean) => void

Whether the open document has unsaved changes; see EditorProps.onDirtyChange.

resolveLink?: (url: URL) => { collection: string; slug: string } | undefined

Maps a URL of the site to the document it shows, e.g. /posts/hello to { collection: 'posts', slug: 'hello' }. ⌘/Ctrl-clicking a link in the preview opens that document in the admin; a link it doesn't map opens in a new tab. Default: the collections' url patterns (resolveUrl).

user?: AdminUser | null

The signed-in user (auth.user() from @mortar-kit/auth): shown at the foot of the rail, with Sign out.

signOutUrl?: string

Where Sign out posts. Default /admin/auth/sign-out.