Form Components

Interactive components for financial data entry and manipulation.

Card

A flexible container component for grouping related content with consistent styling.

TypeScript
1import { Card } from "@openledger/accounting-react";
2
3function BalanceCard() {
4return (
5
6<Card className="h-full p-4">
7 <h2 className="text-lg font-medium">Cash Balance</h2>
8 <div className="text-2xl font-semibold">$50,000</div>
9 <p className="text-sm">As of January 31, 2023</p>
10</Card>
11); }

OLRuntimeProvider

Provider component that enables AI-powered assistants and automated features.

TypeScript
1import { OLRuntimeProvider } from "@openledger/accounting-react";
2import { TransactionAssistant } from "@openledger/accounting-react";
3
4function AIEnhancedTransactions() {
5 return (
6 <OLRuntimeProvider>
7 <TransactionAssistant
8 transactions={transactions}
9 mutate={refreshTransactions}
10 loadingStatus="success"
11 />
12 </OLRuntimeProvider>
13 );
14}

The OLRuntimeProvider enables:

  • AI-powered transaction categorization
  • Natural language financial queries
  • Automated accounting suggestions
  • Report generation with explanations

ConnectBankAccount

Component for securely connecting bank accounts via Plaid integration.

TypeScript
1import { ConnectBankAccount } from "@openledger/accounting-react";
2
3function BankConnection() {
4return (
5
6<ConnectBankAccount
7 onSuccess={(accounts) => console.log("Connected accounts:", accounts)}
8 onExit={() => console.log("Connection flow exited")}
9/>
10); }
PropTypeDescription
onSuccess(accounts: PlaidAccount[]) => voidCallback when accounts are successfully connected
onExit() => voidCallback when user exits the connection flow

CategorizeAllButton

Button component that triggers AI-powered batch categorization of transactions.

TypeScript
1import { CategorizeAllButton } from "@openledger/accounting-react";
2import { useTransactions } from "@openledger/accounting-react";
3
4function TransactionTools() {
5 const { transactions, mutate } = useTransactions();
6
7 return (
8 <CategorizeAllButton
9 transactions={transactions || []}
10 onComplete={() => {
11 mutate();
12 console.log('Categorization complete');
13 }}
14 />
15 );
16}
PropTypeDescription
transactionsTransaction[]Transactions to categorize
onComplete() => voidCallback when categorization completes

SyncPlaidButton

Component for manually triggering synchronization with connected financial accounts.

TypeScript
1import { SyncPlaidButton } from "@openledger/accounting-react";
2
3function SyncControls() {
4return (
5
6<SyncPlaidButton
7 onSuccess={() => console.log("Sync completed")}
8 onError={(error) => console.error("Sync error:", error)}
9/>
10); }
PropTypeDescription
onSuccess() => voidCallback on successful sync
onError(error: Error) => voidCallback on sync error

TransactionForm

Form component for creating or editing individual financial transactions.

TypeScript
1import { TransactionForm } from "@openledger/accounting-react";
2import { useOpenLedgerContext } from "@openledger/accounting-react";
3
4function EditTransaction() {
5 const { categories } = useOpenLedgerContext();
6
7 return (
8 <TransactionForm
9 transaction={selectedTransaction}
10 categories={categories || []}
11 onSubmit={(values) => handleUpdateTransaction(values)}
12 isSubmitting={isLoading}
13 />
14 );
15}
PropTypeDescription
transactionTransactionTransaction to edit (optional for new transactions)
categoriesCategory[]Available categories for classification
onSubmit(values: TransactionFormValues) => voidForm submission handler
isSubmittingbooleanLoading state during submission