Examples
Budget report
Built with the mantine-data-grid skill
Build the budget report of a finance app: the annual budget of a company, broken down by department, team and cost line, with planned and actual spending.
Data:
- generated data for one year: 5 departments, 2–4 teams each, 3–6 cost lines per team (for example "Cloud hosting", "Contractors", "Travel")
- each cost line has a planned and an actual amount per quarter
Table:
- rows form a tree: department, team, cost line; each department and team shows the sum of the rows under it
- columns: name, planned, actual, variance (actual minus planned) and variance percent; the year totals are shown by default
- each level can be expanded and collapsed, and there are "Expand all" and "Collapse all" controls; departments are expanded on load
- over-budget variances are visible without relying on color alone
- money columns are right-aligned with digits of equal width, formatted as currency without cents
- the name column stays visible while the other columns scroll horizontally
- a total row for the whole company stays visible at the bottom of the table
- sortable by planned, actual and variance; sorting keeps the tree and sorts within each level
View options:
- a period control switches between the full year and one quarter; all amounts and sums follow the period
- a "Group by cost line" option regroups the table by cost line name across all teams, with a sum per cost line
- "Export CSV" downloads the rows as currently shown, including sums, with the hierarchy visible in the name column
The component is shown on a demo page that already has a title: do not add a page title or intro text.
Write tests for the component.