components/
The app/components/ folder holds UI components used on two or more pages, run in the browser.
app/
├── components/
│ ├── StatusTag.tsx # status label
│ └── MoneyCell.tsx # money cell for tables
└── orders/
└── page.tsx # import { StatusTag } from "app/components/StatusTag"What it does
UI that two or more pages share (a status tag, a customer card, a product picker) goes here. A component only one page uses stays inside that page.tsx.
Every file here is .tsx and runs in the browser, like a page. Name the file after the component, in PascalCase: the StatusTag component lives in StatusTag.tsx.
Exports
React components, named or default. Import them as app/components/<Name>.
Example
app/components/StatusTag.tsx
import { Tag } from "antd";
import { OrderStatus } from "app/shared/order";
export function StatusTag({ value }: { value: string }) {
return <Tag color={OrderStatus.color(value)}>{OrderStatus.label(value)}</Tag>;
}app/orders/[id:int]/page.tsx
import { StatusTag } from "app/components/StatusTag";
// …
<StatusTag value={order.status} />Good to know
- Components don’t import
app/db,*.table.ts,repository.tsormanh/env. Data comes throughuseApiClient()or props. - Build on antd and pro-components. Don’t rebuild a table, form or modal out of
divs. - Colors come from tokens (
theme.useToken(), classes likebg-surface,text-fg-secondary), never hex codes.checkwarnscode.hardcoded-color. - There is no
app/uiorapp/_uimodule. The app frame and ready-made screens (AppShell,ResourceList,StatRow…) live inmanh/shell.
Next steps
- Pick components by task — which antd component fits each kind of screen.
- shared/ — enums and pure functions components share with the server.
Last updated