theme.tsx
app/theme.tsx holds the app’s look (primary color, radius, density, dark mode, icon set, antd tokens) in one APP_THEME object the owner can edit.
app/
├── theme.tsx # APP_THEME
├── layout.tsx # ConfigProvider gets the theme automatically
└── orders/page.tsx # reads tokens with theme.useToken()What it does
manh.run applies APP_THEME to the app’s outermost ConfigProvider, so every antd and pro-components component and every token-based Tailwind class (bg-surface, text-primary) follows it. The owner edits it under Design in the project sidebar; that editor reads and writes this file.
Exports
APP_THEME, a JSON value between the markers /* ft-theme */ and /* /ft-theme */:
colorPrimary: the primary color. Pick one that keeps white text readable (contrast ≥ 4.5:1).borderRadius: corner radius in px.compact:truefor a dense UI.dark:truefor dark mode.icons(optional):"antd"(default) or"lucide".antd(optional):{ token, components }, the same shape as antd’s theme editor, for every other token such asfontFamily.kit(optional): the theme kit the owner picked in the theme editor (clean,minimal,corporate,warm,fresh,nature,rose,luxe,night). A kit writes the page, card, border and text colors intoantd.token, so app code should not set those colors again.
Example
app/theme.tsx
export const APP_THEME: { colorPrimary: string; borderRadius: number; compact: boolean; dark: boolean } =
/* ft-theme */ {"colorPrimary":"#0f766e","borderRadius":8,"compact":false,"dark":false} /* /ft-theme */;app/components/KpiCard.tsx
import { Card, theme } from "antd";
export function KpiCard({ label, value }: { label: string; value: string }) {
const { token } = theme.useToken();
return (
<Card>
<div style={{ color: token.colorTextSecondary }}>{label}</div>
<div style={{ color: token.colorPrimary, fontSize: 24 }}>{value}</div>
</Card>
);
}Good to know
- Keep both
ft-thememarkers and valid JSON, or the owner can no longer edit the theme. - No hex codes in
style. Read colors withtheme.useToken()or token-based Tailwind classes;checkwarnscode.hardcoded-colorandcode.tw-hardcoded-neutral. - A layout
ConfigProviderwithoutthemeinheritsAPP_THEME. A layout that sets its ownthememust readAPP_THEME. - With
icons: "lucide", keep importing icons from@ant-design/iconsby antd name; manh.run swaps in the Lucide twin. Don’t importlucide-react. - Token names antd doesn’t know warn
theme.unknown-token. - Use only icon names that exist in
@ant-design/icons. A made-up name likeLeafOutlinedrenders as ”?” andcheckreportsui.unknown-icon.
Next steps
- Styling: antd, Tailwind, theme — pick a theme kit and use token-based Tailwind classes.
- layout.tsx — where
AppShellreceivesAPP_THEME.
Last updated