foods
@foodpilot/foods is FoodPilot's design system for React: the MUI-based components, tenant themes and charts of
platform-app.
- Storybook: foods-storybook.foodpilot.tech, organised like IBM Carbon's.
- Figma Design System: Design System, the design source of truth.
- For AI assistants:
llms.txt(llmstxt.org), also served at foods-storybook.foodpilot.tech/llms.txt.
Use foods
npm install @foodpilot/foods
Peer dependencies:
- always:
reactandreact-dom18 or 19,@mui/material^6.4,@emotion/reactand@emotion/styled^11.14,i18next,react-i18nextandlodash; - only for the components that use them:
@mui/icons-material,@mui/lab, the@mui/x-*packages,rechartsandmaterial-react-table.
import { FoodsThemeProvider } from "@foodpilot/foods/themes";
import { Button } from "@foodpilot/foods/Button";
<FoodsThemeProvider theme="foodpilot">
{/* "foodpilot" | "winepilot" | "collective" */}
<App />
</FoodsThemeProvider>;
Every export is named, from the root entry or a component entry: see IMPORT_EXAMPLES.md. Style
with the theme tokens (palette, 8 px spacing, typography variants, shadows), never raw values. Components translate
their texts with react-i18next, the English strings being the keys; the application provides the translations.
Storybook
npm run storybook serves it on port 6006, npm run build-storybook builds it into storybook-static/. The
demo.yml workflow deploys it after every release.
| Section | What it holds | Folder |
|---|---|---|
| Getting Started | Welcome, and the guides for designers, product and developers | src/getting-started/ |
| Components | The components to use, by Figma Design System page: Actions, Avatar and user, Content, Data display, Feedbacks, Inputs, Modals, Navigation | src/components/<Category>/ |
| Elements | The foundations: colours, typography, spacing, shadows, breakpoints, icons | src/elements/ |
| Layout | Page layouts | src/layout/ |
| Preview | Components still being built or redesigned | src/preview/ |
| Legacy | Components removed from the Figma Design System, kept for the screens that use them | src/legacy/<Category>/ |
| Deprecated | Deliberate deprecations | src/deprecated/<Category>/ |
Each component has an Overview page (src/docs/DocsPage.tsx) with:
- its match with the Figma design (the doc status of its Figma frame) and the day its usage guidelines were copied from Figma;
- its description;
- the usage guidelines from Figma: do's and don'ts, anatomy, behaviour, content and states, or No usage guidelines yet;
- every story;
- the props (Component API);
- its references.
In Storybook:
- each story has controls, logs its callbacks in Actions and plays its main interaction in Interactions;
- the toolbar switches the tenant theme (FoodPilot, WinePilot, Positive), the background and the viewport;
- the texts are in English.
Contribute
AGENTS.md holds the rules for any change. In short:
-
Stories: a component's stories go in
src/components/<Category>/<Component>.stories.tsx, without atitle, since the folder decides the sidebar, and their meta starts with a stableid, the file name in lower case, so the URLs survive a move. Their texts are in English, with fitting controls,fn()callbacks and aplayfunction. Usage guidelines come from Figma, inparameters.guidelines, with the Figma docstatusand thesyncedAtday. -
llms.txt: when a component or its stories are added, moved or removed, run
npm run llmsand commitllms.txt. CI fails when it is stale. -
Legacy: a component's stories move to
src/legacy/withgit mvonce it is removed from the Figma Design System, thenllms.txtis refreshed. The platform-design skill of the frontend harness reports the stories platform-app no longer imports; that alone does not move them. -
Checks:
npm run prettier,npm run lint,npm run tsc;npm test, which includes the stories' plays and thellms.txtcheck;npm run build,npm run depcruise:check.
CI is described in docs/ci.md, size budgets in BUNDLE_ANALYSIS.md.
-
Releases:
npm run publish:patch|minor|majordispatches the release workflow frommain. platform-app gets a change after that release and its own dependency update.