Skip to Content

Styling

≈ 10 min · you will have an app in your own brand colour, with dark mode and stat cards laid out with Tailwind classes.

Screens are built from antd and pro-components, arranged with Tailwind classes in className, and take their colors and radius from the app theme in app/theme.tsx.

An app has no CSS files. There are three places to change the look, in the order to reach for them: the app theme, antd components and their props, then Tailwind classes for layout.

Components

Every job on a screen already has a component. Data tables use ProTable, record details use ProDescriptions, forms in a dialog use ModalForm or DrawerForm. Totals use StatisticCard, charts come from @ant-design/charts, an AI chat box from @ant-design/x. Icons come from @ant-design/icons.

Other UI libraries are not part of the app: MUI, shadcn, Chakra, styled-components, daisyUI. check reports an error when it meets their imports.

The app theme

app/theme.tsx holds the primary color, radius, density, dark mode and icon set. The app owner edits it in the workspace under Settings › App appearance, with a preview; the agent edits the file directly.

app/theme.tsx
export const APP_THEME = /* ft-theme */ { "colorPrimary": "#0f766e", "borderRadius": 8, "compact": false, "dark": false, "icons": "antd" } /* /ft-theme */;
  • Keep both ft-theme markers and valid JSON: the settings page reads and writes what sits between them.
  • Pick a primary color that keeps white button text readable, for example #1d4ed8, #0f766e, #be123c.
  • Every other antd token (font, input height, table header color) goes in APP_THEME.antd = { token, components }, the same shape as antd’s theme editor. Unknown token names warn theme.unknown-token.
  • icons: "lucide" swaps every antd icon for a thin-stroke one. Code still uses antd icon names.

Don’t wrap pages in your own ConfigProvider theme to change colors. Change APP_THEME and the whole app follows.

Colors in components

Colors, borders and shadows come from tokens, never hard-coded hex. style={{}} is still fine for sizes and layout antd has no prop for.

app/components/stat-badge.tsx
import { theme } from "antd"; export function StatBadge({ value }: { value: number }) { const { token } = theme.useToken(); return ( <span style={{ background: token.colorPrimaryBg, color: token.colorPrimary, padding: "2px 8px", borderRadius: token.borderRadiusSM }}> {value} </span> ); }

A hard-coded color in style warns code.hardcoded-color.

Tailwind classes

Write Tailwind utility classes straight in className: layout, spacing, sizing, responsive (md:), states (hover:). manh.run compiles the classes it finds in .tsx files; the preview and the deployed app use the same CSS.

app/page.tsx
import { ShoppingOutlined } from "@ant-design/icons"; export default function HomePage() { return ( <div className="bg-layout min-h-screen p-6"> <div className="bg-surface border border-line-secondary rounded-ant-lg p-4 flex items-center gap-3"> <span className="size-9 rounded-ant bg-primary-soft text-primary flex items-center justify-center"><ShoppingOutlined /></span> <div> <div className="text-fg font-medium">New orders</div> <div className="text-fg-secondary text-sm">12 orders waiting for confirmation</div> </div> </div> </div> ); }

These color classes follow the theme and switch in dark mode on their own:

  • Backgrounds: bg-surface (card), bg-layout (page), bg-elevated, bg-fill, bg-fill-strong.
  • Text: text-fg, text-fg-secondary, text-fg-tertiary. Borders: border-line, border-line-secondary.
  • Status colors: primary, success, warning, error, info, with a -soft suffix for light backgrounds.
  • Radius: rounded-ant-sm, rounded-ant, rounded-ant-lg. Fonts: font-sans, font-mono.

Precedence: a class beats antd’s own style on the same element, and style={{}} beats the class.

Good to know

  • No import "tailwindcss", plugins, @apply or .css files (code.no-tailwind-import, code.no-css-import).
  • bg-white, text-gray-500, border-slate-200 stay light in dark mode; check warns code.tw-hardcoded-neutral. Use the theme classes above.
  • Tailwind’s reset is off, so a hand-written <button> keeps the browser font. Use antd’s Button or add [font-family:inherit].
  • Use classes to arrange antd components, not to rebuild a table, form or dialog out of divs.

Next steps

Last updated