Customization

Admin

Brand the admin, arrange its navigation and set up the admin bar.

The admin is the app editors work in, at /admin by default. Everything you change about it sits in the admin object of defineCms(). This page covers how it looks and where things are: branding, navigation, the admin bar on your site, languages and the path. To add your own inputs, see Custom fields. For your own pages and buttons, see Custom pages and actions.

Branding

The admin shows your logo in the top bar and on the login:

tenon.config.ts
export default defineCms({
  // ...
  site: { name: "Acme" },
  admin: {
    logo: { light: "/logo-light.svg", dark: "/logo-dark.svg" },
    icon: "/icon.svg",
  },
});
The wide logo in the top bar and on the login. One image per place works too: { header: "/logo-wide.svg", login: "/logo.svg" }. A place without a logo shows the icon and the name.The square icon, next to the name when there is no logo.The favicon of the admin. Default: icon, then the favicon.svg, .ico or .png in your public folder, then the Tenon icon.
  • The name is site.name, not an admin option. The admin, the admin bar, emails and passkeys show it.
  • { light, dark } follows the admin's theme.
  • The admin links the files and does not bundle them. Put them in your public folder, like public/logo.svg, and use the URL /logo.svg.

The content menu lists every collection, global, the media library and your own pages. nav decides where an entry shows:

cms/collections/posts.ts
export const posts = defineCollection({
  label: "Posts",
  nav: { group: "Blog", icon: "newspaper", order: 1 },
  fields: {
    // ...
  },
});
content is the content menu, the default. settings is a card on the Settings page. main is the top bar, next to Content and Visual Editor. none hides the entry.The section in the menu or on the Settings page. Default: Content in the menu, Site on the Settings page.A Lucide icon name, like newspaper. A typo is a type error.The position, lowest first. Collections default to 10, media to 15, globals to 20 and pages to 30.
  • Equal orders keep the order you define them in. Sections show in the order of their first entry.
  • To move the media library, set admin.media: { label: "Files", nav: { group: "Assets", icon: "images" } }.

The Settings page

Globals that editors rarely open belong on the Settings page. Each one is a card there, grouped by group:

cms/globals/footer.ts
export const footer = defineGlobal({
  label: "Footer",
  nav: { display: "settings", order: 3 },
  fields: {
    // ...
  },
});

The content menu shows Settings under Manage as soon as one entry has display: "settings". The built-in general and seo globals sit there too. See Site settings.

Admin bar

The admin bar is a small bar on your site. Signed-in editors see it on every page, with your logo and name, Edit, the Drafts / Published switch and a button to hide it. Visitors never load it.

  • Edit opens the current page in the visual editor.
  • The bar hides while you scroll down. Your page's CSS does not reach it.
  • In a preview tab, it shows Back to visual editor and an Edit preview switch instead.

admin.adminBar sets where it sits and what it shows:

tenon.config.ts
export default defineCms({
  // ...
  admin: {
    adminBar: {
      position: "bottom-right",
      items: {
        analytics: {
          label: "Analytics",
          icon: "chart-bar",
          href: "https://plausible.io/example.com",
        },
        perspective: false,
      },
    },
  },
});
  • position is one of eight places: top-left, top-center, top-right, center-left, center-right, bottom-left, bottom-center (the default) and bottom-right.
  • false for an item removes it. That works for the built-in items too.
  • adminBar: false turns the bar off.

Items

The key of an item is its id. An item with the id of an existing one replaces it. Each item is one of these:

ItemSet
Linkhref: a path like /about, or an http(s) URL
Dropdownchildren: items by id, one level deep
ButtononClick: browser code that runs on click
Controlmount: browser code that renders the item

Every item has a label, and can have an icon and an order. The built-in items are dashboard (order 10), edit (20) and perspective (30). Items without an order come last.

Items that depend on the page

load runs on the server for every page the bar shows on. It gets the user, their cms, the admin locale and the page url. For a link or dropdown, it returns new values for label, icon, href or children, or null to hide the item:

analytics: {
  label: "Analytics",
  href: "https://plausible.io/example.com",
  load: ({ url, user }) =>
    user.role === "admin"
      ? { href: `https://plausible.io/example.com?page=${encodeURIComponent(new URL(url).pathname)}` }
      : null,
},
  • url comes from the browser. Never trust it, and never fetch it.
  • A load that throws is logged, and its item is left out. The rest of the bar stays.

Buttons and controls

onClick and mount are browser code, from a .client.ts module. For a button or control, load returns any JSON, and the code gets it as ctx.data:

src/admin/bar.client.ts
import type { AdminBarItemContext, Mount } from "tenoncms/admin";

export const copyUrl = () => navigator.clipboard.writeText(location.href);

export const mountGreeting: Mount<AdminBarItemContext<string>> = (el, ctx) => {
  const render = (next: AdminBarItemContext<string>) => (el.textContent = next.data);
  el.style.cssText = "font: 500 12px/1 sans-serif; padding: 4px 8px";
  render(ctx);
  return { update: render, unmount: () => el.replaceChildren() };
};
tenon.config.ts
import { copyUrl, mountGreeting } from "./src/admin/bar.client";

admin: {
  adminBar: {
    items: {
      copy: { label: "Copy URL", icon: "link", onClick: copyUrl },
      greeting: { label: "Greeting", mount: mountGreeting, load: ({ user }) => `Hi ${user.name}` },
    },
  },
},
  • The context also has the bar's state, like perspective and setPerspective(), and tenon.reload() to run load again.
  • The bar sits in a shadow root, so your CSS does not reach it. See Style admin bar items.
  • The bar loads on every page of your site. Its modules MUST NOT import CSS, so keep bar code in its own module.

Languages

The admin is localized (only English and German for now). Each user picks their preferred language under Interface language in the user menu. Without a choice, the admin follows the browser.

Every label and description you write takes one string, or one per language:

label: { en: "Posts", de: "Beiträge" },
  • A missing language shows English, then the first entry.
  • The admin language is separate from the languages of your content. See Localization.
  • Validation messages from the server stay English.

Texts in your own code

Fields, pages and bar items get the admin language as ctx.tenon.locale. translator() from tenoncms/admin reads your own message files:

src/admin/stats.client.ts
import { translator, type Mount, type PageContext } from "tenoncms/admin";
import de from "./locales/de.json";
import en from "./locales/en.json";

export const mountStats: Mount<PageContext> = (el, ctx) => {
  const t = translator({ en, de }, ctx.tenon.locale);
  el.textContent = t("stats.count", { n: 3 });
  // ...
};
  • Keys are dotted paths, and {n} fills a parameter. A missing key shows English, then the key.
  • A language switch calls update(ctx) with the new locale.
  • A server load gets the language as locale.

Admin path

The admin runs at /admin. To serve it somewhere else, like /cms, set admin.path:

tenon.config.ts
export default defineCms({
  // ...
  admin: { path: "/cms" },
});
The path uses letters, digits, - and _. It MUST NOT be / or sit under /_tenon.
  • Invite links, tenon login and the admin bar point to the new path.
  • path MUST be a string or an environment variable, like process.env.ADMIN_PATH ?? "/cms". The build reads it from the file without running it, so a change needs a rebuild.
  • The HTTP API stays at /_tenon, wherever the admin is.
The integration reads the path. Restart the dev server.

Without the admin

admin: false ships no admin. Use it when editors work somewhere else and your site only reads content.

  • The HTTP API under /_tenon works as before.
  • The admin bar, custom fields, pages, actions and tenon login are gone.
  • cms.users.invite() needs a url, because there is no admin page to link to.
  • In TanStack Start, remove tenonAdmin() and the admin route.