View Components

Pre-built UI components for financial interfaces.

OpenLedgerView

A comprehensive component that integrates all financial views in a tabbed interface, giving your users access to the complete Open Ledger experience.

TypeScript
1import { OpenLedgerView } from "@openledger/accounting-react";
2
3function App() {
4return (
5
6<div className="app-container">
7 <OpenLedgerView />
8</div>
9); }

DashboardView

A data visualization dashboard displaying key financial metrics including cash balance, profit/loss, revenue, and expenses.

TypeScript
1import { DashboardView } from "@openledger/accounting-react";
2
3function FinancialDashboard() {
4return <DashboardView />;
5}

TransactionsView

A component for displaying and managing financial transactions with advanced filtering and AI-powered categorization.

TypeScript
1import { TransactionsView } from "@openledger/accounting-react";
2
3function TransactionManagement() {
4return <TransactionsView />;
5}

LedgerView

A double-entry accounting ledger view showing journal entries and the chart of accounts with balance calculations.

TypeScript
1import { LedgerView } from "@openledger/accounting-react";
2
3function AccountingLedger() {
4return <LedgerView />;
5}

ReportView

A financial reporting component for generating and displaying standardized reports like Profit & Loss, Balance Sheet, and Cash Flow statements.

TypeScript
1import { ReportView } from "@openledger/accounting-react";
2
3function FinancialReports() {
4return <ReportView />;
5}

ChatView

An AI-powered financial assistant interface for natural language interaction with accounting data.

TypeScript
1import { ChatView } from "@openledger/accounting-react";
2
3function FinancialAssistant() {
4return <ChatView />;
5}

Context Hooks

Open Ledger provides several hooks to access financial data and functionality within your custom components.

useOpenLedgerContext

Access the OpenLedgerContext within your components.

TypeScript
1import { useOpenLedgerContext } from "@openledger/accounting-react";
2
3function EntityInfo() {
4const { auth, entityId, theme } = useOpenLedgerContext();
5
6return (
7
8<div>
9 <h2>Entity ID: {entityId}</h2>
10</div>
11); }

useTransactions

Access transaction-related data and functions.

TypeScript
1import { useTransactions } from "@openledger/accounting-react";
2
3function TransactionStats() {
4const {
5transactions,
6transactionsByMonth,
7loadingStatus,
8mutate
9} = useTransactions();
10
11if (loadingStatus === "loading") return <div>Loading transactions...</div>;
12if (loadingStatus === "error") return <div>Error loading transactions</div>;
13
14return (
15
16<div>
17 <h2>Transaction Count: {transactions?.length || 0}</h2>
18</div>
19); }

useAccounts

Access account-related data and functions.

TypeScript
1import { useAccounts } from "@openledger/accounting-react";
2
3function AccountStats() {
4const { accounts, loadingStatus } = useAccounts();
5
6if (loadingStatus === "loading") return <div>Loading accounts...</div>;
7if (loadingStatus === "error") return <div>Error loading accounts</div>;
8
9return (
10
11<div>
12 <h2>Account Count: {accounts?.length || 0}</h2>
13</div>
14); }

Customization

Open Ledger components can be customized using themes to match your application’s design. The theme object can be passed to the OpenLedgerProvider to modify colors, typography, and spacing throughout the UI.

TypeScript
1const theme = {
2 colors: {
3 primary: { hex: '#3366FF' },
4 secondary: { hex: '#FF6B3D' },
5 accent: { hex: '#00C851' },
6 text: { hex: '#212529' },
7 background: { hex: '#F8F9FA' }
8 }
9};
10
11<OpenLedgerProvider
12 entityId="your-company-id"
13 developerId="your-enterprise-id"
14 developerSecret="your-enterprise-secret"
15 theme={theme}
16 apiUrl="your-api-url"
17>
18 <YourApp />
19</OpenLedgerProvider>

Next Steps

For detailed information on individual components, please refer to these sections: