Data Components

Components for displaying financial data

Data components display and interact with financial data in various formats.

TransactionTable

A table component for displaying financial transactions.

1import { TransactionTable } from "@openledger/accounting-react";
2
3function Transactions() {
4 return <TransactionTable />;
5}
PropTypeRequiredDescription
transactionsTransaction[]NoArray of transactions to display
isLoadingbooleanNoWhether the data is loading
onEdit(transaction: Transaction) => voidNoCallback when a transaction is edited
onDelete(transactionId: string) => voidNoCallback when a transaction is deleted
onCategorize(transaction: Transaction, category: Category) => voidNoCallback when a transaction is categorized

IntelligentTransactionTable

An enhanced transaction table with AI-powered categorization.

1import { IntelligentTransactionTable } from "@openledger/accounting-react";
2
3function AITransactions() {
4 const { transactions, loadingStatus } = useTransactions();
5
6 return (
7 <IntelligentTransactionTable
8 transactions={transactions || []}
9 loadingStatus={loadingStatus}
10 />
11 );
12}
PropTypeRequiredDescription
transactionsTransaction[]YesArray of transactions to display
loadingStatus"loading" | "success" | "error"YesStatus of transaction loading
onEdit(transaction: Transaction) => voidNoCallback when a transaction is edited
onRefresh() => voidNoCallback to refresh transaction data

TransactionAssistant

AI-powered assistant for transaction management.

1import { TransactionAssistant } from "@openledger/accounting-react";
2
3function AssistantPanel() {
4 const { transactions, loadingStatus, mutate } = useTransactions();
5
6 return (
7 <TransactionAssistant
8 transactions={transactions || []}
9 mutate={mutate}
10 loadingStatus={loadingStatus}
11 />
12 );
13}
PropTypeRequiredDescription
transactionsTransaction[]YesArray of transactions to manage
mutate() => voidYesFunction to refresh transactions
loadingStatus"loading" | "error" | "success"YesCurrent loading state

AreaChart

A responsive area chart component for visualizing financial data trends.

1import { AreaChart } from "@openledger/accounting-react";
2
3function CashBalanceChart() {
4 return (
5 <AreaChart
6 onBalanceChange={(balance) => console.log("Current balance:", balance)}
7 />
8 );
9}
PropTypeRequiredDescription
onBalanceChange(balance: number) => voidNoCallback with current balance
onStatsChange(stats: FinancialStats) => voidNoCallback with financial statistics
heightnumberNoChart height in pixels
widthnumberNoChart width in pixels
dataChartDataPoint[]NoCustom data for the chart

BarChart

A bar chart component for comparing financial metrics.

1import { BarChart } from "@openledger/accounting-react";
2
3function RevenueExpensesChart() {
4 return (
5 <BarChart
6 onStatsChange={(stats) => console.log("Stats:", stats)}
7 />
8 );
9}
PropTypeRequiredDescription
onStatsChange(stats: FinancialStats) => voidNoCallback with financial statistics
heightnumberNoChart height in pixels
widthnumberNoChart width in pixels
dataChartDataPoint[]NoCustom data for the chart

ThemedUnifiedDirectory

Component for displaying and selecting from hierarchical data structures.

1import { ThemedUnifiedDirectory } from "@openledger/accounting-react";
2
3function AccountSelector() {
4 return (
5 <ThemedUnifiedDirectory
6 items={accountsData}
7 onSelect={(item) => setSelectedAccount(item)}
8 title="Chart of Accounts"
9 />
10 );
11}
PropTypeRequiredDescription
itemsDirectoryItem[]YesItems to display in the directory
onSelect(item: DirectoryItem) => voidYesCallback when an item is selected
titlestringNoTitle for the directory
multiSelectbooleanNoWhether multiple items can be selected

FinancialOverview

Dashboard component displaying key financial metrics including revenue, expenses, profit, and cash balance.

1import { FinancialOverview } from "@openledger/accounting-react";
2import { useFinancialOverview } from "@openledger/accounting-react";
3
4function Overview() {
5 // Use useFinancialOverview hook to fetch data
6 const { financialOverview, isLoading } = useFinancialOverview({
7 month: "05",
8 year: "2025",
9 status: "all"
10 });
11
12 return (
13 <FinancialOverview
14 data={financialOverview}
15 />
16 );
17}
PropTypeRequiredDescription
dataFinancialOverviewResponseYesFinancial overview data to display

The component displays:

  • Revenue metrics with trend indicator
  • Profit calculation as percentage of revenue
  • Current cash balance with connected accounts
  • Expense breakdown with visualizations

LedgerTable

A flexible table for displaying general ledger data with account hierarchies.

1import { LedgerTable } from "@openledger/accounting-react";
2
3function GeneralLedger() {
4 const { accountBalances, loadingStatus } = useGeneralLedger();
5
6 return (
7 <LedgerTable
8 accounts={accountBalances || []}
9 isLoading={loadingStatus === "loading"}
10 />
11 );
12}
PropTypeRequiredDescription
accountsAccountBalance[]YesAccount balances to display
isLoadingbooleanNoWhether data is loading
onAccountClick(accountId: string) => voidNoCallback when an account is clicked
showActionsbooleanNoWhether to show action buttons

ReportWidget

A flexible component for displaying financial reports.

1import { ReportWidget } from "@openledger/accounting-react";
2
3function ProfitLossReport() {
4 return (
5 <ReportWidget
6 title="Profit & Loss"
7 period="monthly"
8 type="profit_loss"
9 onPeriodChange={(period) => console.log("Period:", period)}
10 />
11 );
12}
PropTypeRequiredDescription
titlestringYesReport title
monthstringNoMonth to filter data (format: ‘MM’)
yearstringNoYear to filter data (format: ‘YYYY’)
type"INCOME" | "BALANCE" | "CASHFLOW"NoReport type
status"all" | "posted"NoTransaction status filter (default: “all”)
onReportLoad(report: FinancialReports) => voidNoCallback when reports are loaded
onPeriodChange(month: string, year: string) => voidNoCallback when period changes
themeAccelThemeConfigNoTheme configuration

HierarchicalTable

A specialized table for displaying hierarchical financial data with expandable accounts and sections.

1import { HierarchicalTable } from "@openledger/accounting-react";
2import { useGeneralLedger } from "@openledger/accounting-react";
3
4function AccountsTable() {
5 const { accountHierarchy, loadingStatus } = useGeneralLedger();
6
7 const formatCurrency = (amount, useParentheses) => {
8 const absAmount = Math.abs(amount);
9 const formatted = new Intl.NumberFormat('en-US', {
10 style: 'currency',
11 currency: 'USD'
12 }).format(absAmount);
13
14 return amount < 0 && useParentheses ? `(${formatted})` : formatted;
15 };
16
17 return (
18 <HierarchicalTable
19 title="Chart of Accounts"
20 hierarchy={{
21 assets: accountHierarchy.filter(a => a.type === 'ASSET'),
22 liabilities: accountHierarchy.filter(a => a.type === 'LIABILITY'),
23 equity: accountHierarchy.filter(a => a.type === 'EQUITY'),
24 revenue: accountHierarchy.filter(a => a.type === 'REVENUE'),
25 expenses: accountHierarchy.filter(a => a.type === 'EXPENSE')
26 }}
27 formatCurrency={formatCurrency}
28 period={{
29 month: 5,
30 year: 2025
31 }}
32 />
33 );
34}
PropTypeRequiredDescription
titlestringYesTitle for the hierarchical table
hierarchy{ assets: AccountNode[], liabilities: AccountNode[], equity: AccountNode[], revenue: AccountNode[], expenses: AccountNode[] }YesGrouped account nodes by type
formatCurrency(amount: number, useParentheses?: boolean) => stringYesFunction to format monetary amounts
period{ startDate?: string, endDate?: string, month?: number, year?: number }NoPeriod information for the report

JournalTable

A double-entry accounting table for displaying journal entries with expandable transaction details.

1import { JournalTable } from "@openledger/accounting-react";
2import { useGeneralLedger } from "@openledger/accounting-react";
3
4function JournalEntries() {
5 const { journalEntries, loadingStatus } = useGeneralLedger();
6
7 const formatAmount = (amount) => {
8 return new Intl.NumberFormat('en-US', {
9 style: 'currency',
10 currency: 'USD'
11 }).format(amount);
12 };
13
14 return (
15 <JournalTable
16 title="Journal Entries"
17 entries={journalEntries || []}
18 formatAmount={formatAmount}
19 period={{
20 month: 5,
21 year: 2025
22 }}
23 />
24 );
25}
PropTypeRequiredDescription
titlestringYesTitle for the journal table
entriesJournalEntry[]YesJournal entries to display
formatAmount(amount: string | number, useParentheses?: boolean) => stringYesFunction to format monetary amounts
period{ startDate?: string, endDate?: string, month?: number, year?: number }NoPeriod information for the report