Skip to content

ExportMenu

CSV/XLSX/PDF with a stated scope.
Implemented
Status
Implemented
Family
5 of 13
Registry
@lopifi/export-menu
npx shadcn@latest add @lopifi/theme @lopifi/export-menu

The component, rendering

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

Preview

The four-layer spec

CSV / XLSX / PDF. States the scope explicitly — "Export 1,284 filtered transactions" — because exporting the current page when the user expected the full filtered set is a silent data error. Includes the resolved period and filters in the exported file's header.

Lifted verbatim from Ledger & tables. 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/export-menu.tsx

Lopifi dependencies · 2
cnicons
npm packages
@base-ui-components/reactclsxtailwind-merge
Registry entry
/r/export-menu.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/export-menu.tsx
"use client";

import { Menu } from "@base-ui-components/react/menu";
import { cn } from "@/lib/ledger/cn";
import { ArrowDownTrayIcon } from "@/components/ledger/icons";

export interface ExportMenuProps {
  className?: string;
  onExport: (format: "csv" | "xlsx" | "pdf") => void;
  /** Stated explicitly — exporting the page when the user expected the full
      filtered set is a silent data error. */
  scopeCount: number;
  scopeDescription: string;
}

export function ExportMenu({ scopeCount, scopeDescription, onExport, className }: ExportMenuProps) {
  return (
    <Menu.Root>
      <Menu.Trigger
        className={cn(
          "inline-flex h-8 items-center gap-2 rounded-sm border border-border bg-surface px-3 text-label font-medium",
          "transition-colors duration-1 ease-standard hover:bg-surface-hover",
          className,
        )}
      >
        <ArrowDownTrayIcon aria-hidden="true" className="size-3.5" />
        Export
      </Menu.Trigger>
      <Menu.Portal>
        <Menu.Positioner align="end" className="z-dropdown" sideOffset={8}>
          <Menu.Popup
            className="w-[280px] rounded-md border border-border bg-surface-raised p-1 shadow-elevation-3"
            style={{ transformOrigin: "var(--transform-origin)" }}
          >
            <p className="px-3 py-2 text-caption text-text-secondary">
              Exports <span className="numeric font-medium">{scopeCount.toLocaleString()}</span>{" "}
              {scopeDescription}. The resolved period and filters are written into the file header.
            </p>
            {(["csv", "xlsx", "pdf"] as const).map((f) => (
              <Menu.Item
                className="cursor-pointer rounded-xs px-3 py-2 text-body outline-none data-[highlighted]:bg-surface-hover"
                key={f}
                onClick={() => onExport(f)}
              >
                Export as {f.toUpperCase()}
              </Menu.Item>
            ))}
          </Menu.Popup>
        </Menu.Positioner>
      </Menu.Portal>
    </Menu.Root>
  );
}

The accounting it encodes

Concepts this component renders. Each one is defined once, in the lexicon, and used identically in the code and the copy.

Also in Ledger & tables

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 ExportMenu 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 Ledger & tables 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.