Skip to content

Customization

The shell lives in @dashild/admin; the app owns the panel configuration, auth, and any custom components.

src/dashild/panel.ts
import { definePanel } from "@dashild/core";
export const panel = definePanel({
title: "Acme",
path: "/admin",
locale: "en",
brand: { name: "Acme" },
theme: { defaultMode: "dark", toggle: true, primary: "zinc" },
sidebar: { collapsible: "icon" },
maxContentWidth: "xl",
resources: [customerResource],
auth: { getCurrentUser, signOut },
});

primary accepts a shadcn/Tailwind palette (zinc, slate, blue, emerald, and so on). locale switches built-in labels, server validation messages, and the browser-side messages of the form. theme.defaultMode accepts light, dark, or system; system follows prefers-color-scheme and reacts to changes.

brand.logo replaces the panel mark in the sidebar. Without a logo, the shell renders the Dashild mark, which inherits the theme’s text color. brand.name is accepted in panel metadata but is not currently rendered by the generated sign-in pages. domain is declared metadata only: Next routes by host, so Dashild does not use it to route requests.

theme.toggle: true shows the switch only when the route also passes a themeAction server action. The route generated by dashild init wires it: it reads the dashild_theme cookie for the initial mode and passes toggleTheme, which cycles light → dark → system and writes the cookie.

On a manual install without that wiring, the switch is hidden. Add an action like the generated one and pass it to AdminPage:

src/app/admin/[[...dashild]]/page.tsx
const store = await cookies();
const cookieTheme = store.get("dashild_theme")?.value;
const theme: ThemeMode =
cookieTheme === "light" || cookieTheme === "dark" || cookieTheme === "system"
? cookieTheme
: panel.theme?.defaultMode ?? DEFAULT_THEME_MODE;
<AdminPage
// ...
theme={theme}
themeToggle={panel.theme?.toggle ?? false}
themeAction={toggleTheme}
/>;

DEFAULT_THEME_MODE is dark. With system, the server cannot know the user’s preference, so the dark class is applied on the client after hydration.

Cells and fields are React components registered on the client:

src/dashild/registry.tsx
"use client";
import {
registerCell,
registerField,
registeredCells,
registeredFields,
} from "@dashild/core";
import { RegistryProvider, type Registry } from "@dashild/admin";
import { AvatarCell } from "../../components/dashild/avatar-cell";
import { EmailField } from "../../components/dashild/email-field";
registerCell("avatar", AvatarCell);
registerField("email", EmailField);
export function AppRegistryProvider({
children,
}: {
children: React.ReactNode;
}) {
return (
<RegistryProvider
cells={registeredCells() as Registry["cells"]}
fields={registeredFields() as Registry["fields"]}
>
{children}
</RegistryProvider>
);
}

The casts are required: registeredCells() returns the loose renderer type kept in @dashild/core so it does not depend on React types.

dashild init generates this file with the registration calls commented out; edit it to add yours. Wrap AdminPage with AppRegistryProvider (the generated route does this), then reference the components from a resource:

table: { columns: [{ field: "name", cell: "avatar" }] }
form: { fields: [{ field: "email", component: "email" }] }

The renderer props are CellRendererProps and FieldRendererProps from @dashild/admin.

dashild ui:add avatar-cell email-field copies both templates into components/dashild/ and prints the exact registration call, for example registerCell("avatar", AvatarCell). Options: --dir, --force, --dry-run, --cwd. Unknown names are reported and do not change the exit code.

Tailwind must scan the package build:

@source "../../node_modules/@dashild/admin/dist";

The theme variables come from shadcn. Define a real font stack in --font-sans; the generated globals.css does this for you.

The shell already resolves 19 icon names: users, user, building, organization, file-text, settings, database, folder, chart, layout-dashboard, package, shopping-cart, tag, calendar, mail, briefcase, credit-card, truck, and layers.

src/dashild/icons.tsx mounts an IconProvider that adds your extra icons; it does not replace the built-in set. For an unknown resource icon the shell always falls back to a generic table icon, and logs a warning only in development. Action icons have no fallback: an unknown name renders no icon.

If you want to remove the panel glue, run:

Terminal window
pnpm dashild eject --dry-run
pnpm dashild eject --yes

It removes panel.ts, policies.ts, actions/index.ts, icons.tsx, runtime.ts, server.ts, registry.tsx, the mount route, and the dashild script. It keeps resources, the auth files, the Prisma generator, and dependencies, and lists them so you can remove them yourself. Some auth files (email.ts, the password pages and forms) are kept but are not listed. Without --yes it only prints the plan.