DashboardShell
- Status
- Implemented
- Family
- 7 of 13
- Registry
- @lopifi/dashboard-shell
npx shadcn@latest add @lopifi/theme @lopifi/dashboard-shellThe component, rendering
Real data, the shipped component. Switch the theme to check the claims the spec makes below.
The four-layer spec
12/8/4-column responsive grid with optional user rearrangement. Widget positions persisted per user. Drag uses FLIP + spring.snap, measured once at drag start.
Equal-height rows via auto-rows-fr so figure baselines align across a row — the most visible alignment failure on any dashboard, and it's a one-line fix.
Lifted verbatim from Dashboard & charts. The doc and this page are the same paragraphs, so they cannot disagree.
What lands in your repository
One component is never one file. Everything below is copied into your project, where you own it.
- Files
components/ledger/dashboard-shell.tsx
- Lopifi dependencies · 1
- cn
- npm packages
- clsxtailwind-merge
- Registry entry
- /r/dashboard-shell.json
The whole component
No compiled bundle, no black box. This is the file the registry copies, and the file you will edit.
import * as React from "react";
import { cn } from "@/lib/ledger/cn";
export interface DashboardShellProps extends React.ComponentPropsWithoutRef<"div"> {
/**
* The heading level for `title`. A dashboard is normally the whole page, so
* `h1` is the honest default — but when one is embedded under a page that
* already has its own `h1` (the showcase does exactly this), two `h1`s is a
* document-outline bug. Set `h2` there.
*/
headingLevel?: "h1" | "h2";
subtitle?: string;
title: string;
toolbar?: React.ReactNode;
}
/**
* A 12/8/4-column responsive grid with equal-height rows, so figure
* baselines align across a row — the most visible alignment failure on any
* dashboard, and a one-line fix.
*/
export const DashboardShell = React.forwardRef<HTMLDivElement, DashboardShellProps>(
({ className, title, subtitle, toolbar, headingLevel: Heading = "h1", children, ...props }, ref) => (
<div className={cn("w-full", className)} ref={ref} {...props}>
<header className="mb-6 flex flex-wrap items-end justify-between gap-4">
<div>
<Heading className="text-title-lg font-medium">{title}</Heading>
{subtitle ? <p className="mt-1 text-body text-text-secondary">{subtitle}</p> : null}
</div>
{toolbar}
</header>
<div className="grid auto-rows-fr grid-cols-4 gap-4 md:grid-cols-8 xl:grid-cols-12">{children}</div>
</div>
),
);
DashboardShell.displayName = "DashboardShell";
export function DashboardTile({
span = 4,
className,
children,
}: {
span?: 3 | 4 | 6 | 8 | 12;
className?: string;
children: React.ReactNode;
}) {
return (
<div
className={cn(
"col-span-4",
span === 3 && "md:col-span-4 xl:col-span-3",
span === 4 && "md:col-span-4 xl:col-span-4",
span === 6 && "md:col-span-8 xl:col-span-6",
span === 8 && "md:col-span-8 xl:col-span-8",
span === 12 && "md:col-span-8 xl:col-span-12",
className,
)}
>
{children}
</div>
);
}
Also in Dashboard & charts
- KpiRow2–4 KPI cards with aligned baselines.Spec
- MoneyChartLine/area with a money axis and negative-aware baseline.
- MoneyBarChartGrouped/stacked, zero-baseline origin, hatched negatives.
- WaterfallChartThe P&L bridge. Essential and rare.
- CategoryBreakdownRanked bars, not a pie.
- CashCalendarDaily heatmap of cash movement.
- CandlestickChartFor FX/crypto pairs.
- ChartLegendInteractive, keyboard-navigable.Spec
- ChartTooltipTouch-persistent readout.Spec
- DataTableToggleEvery chart's accessible table equivalent.Spec
See also
A component is specified in one place, defined in another, and running in a third. All three, from here.
- Dashboard & charts — the family specThe four-layer specification this component was built against, before it was written.Doc
- Financial charts for React: waterfalls and sparklinesThe family running, with real figures in it, in both themes and at every density.Live
- CatalogAll 179 components, specified before they are written.Doc
Elsewhere in the system
Where DashboardShell sits in the rest of the system — the live section it renders in, the calculators that compute what it displays, and the ledger payloads it is fed from.
- DashboardShell, runningThe cards showcase — live, with theme, density, greyscale and reduced-motion switches.Live
- Dashboard & chartsWe wrap a charting engine (Recharts, or visx where more control is needed). We do not rebuild one. What we add is everything a chart library doesn't know about money. Specs for 11 React components: DashboardShell, KpiRow, MoneyChart, MoneyBarChart and 7 more.Doc
Components are copied into your repository and meant to be edited — rounding policy, fiscal calendar and compliance copy differ per company.
Told when Dashboard & charts changes
Components are copied into your repo, so a fix here does not reach you on its own. One email when a component in this family changes in a way that needs a migration — and nothing when it does not.