Skip to content

DashboardShell

Responsive grid with optional rearrange.
Implemented
Status
Implemented
Family
7 of 13
Registry
@lopifi/dashboard-shell
npx shadcn@latest add @lopifi/theme @lopifi/dashboard-shell

The component, rendering

Real data, the shipped component. Switch the theme to check the claims the spec makes below.

Preview

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.

components/ledger/dashboard-shell.tsx
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

See also

A component is specified in one place, defined in another, and running in a third. All three, from here.

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.

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.

One address, no list rental, unsubscribe in one click.

Works in your QuickBooks Online or Xero file

Get your books closed every month

Lopifi is building AI bookkeeping that keeps your books closed on US GAAP as transactions happen, with a CPA review every quarter, for $200 a month. We’re not open yet.

$200/month when we open. No card now.