Basic Usage
Anatomy
Examples
Custom Column Configuration
Define how each column renders and formats data.With Color Coding
Apply different styling for bids and asks.Depth Visualization
Show cumulative depth with background bars.Right-to-Left Layout
Display the table with right-to-left text direction.Without Header
Hide the table header for a cleaner look.Custom Row Rendering
Provide complete control over row rendering.Skeleton Loading
Display a loading skeleton while data is being fetched.Building Custom Tables
Use individual table components for complete customization.Props
Root
PriceLevel[]
required
Array of price level objects containing price, quantity, and total.
'bids' | 'asks'
The type of orderbook side to display.Default:
'bids''ltr' | 'rtl'
Text direction for the table layout.Default:
'ltr'OrderbookTableColumns
Column configuration object defining how data is displayed.
number
Maximum total value for calculating depth bar widths.
boolean
Whether to display the table header row.Default:
true(context) => ReactNode
Custom render function for table rows.
OrderbookTableRowProps
Props to pass to each row component.
OrderbookTableHeaderProps
Props to pass to the header component.
OrderbookTableBodyProps
Props to pass to the body component.
string
Additional CSS classes to apply.
Column
ReactNode
required
Table components to render within the column.
string
Additional CSS classes to apply.
Header
OrderbookTableColumns
Column configuration for header labels.
'bids' | 'asks'
Orderbook side type.
'ltr' | 'rtl'
Text direction.
string
Additional CSS classes to apply.
Body
PriceLevel[]
required
Array of price levels to render.
'bids' | 'asks'
Orderbook side type.
number
Maximum total for depth calculations.
OrderbookTableColumns
Column configuration.
(context) => ReactNode
Custom row renderer.
OrderbookTableRowProps
Props to pass to each row.
'ltr' | 'rtl'
Text direction.
Row
ReactNode
required
Cell components to render.
OrderbookTableRowBarProps
Depth bar configuration.
'ltr' | 'rtl'
Text direction.
string
Additional CSS classes to apply.
Cell
ReactNode
required
Content to render in the cell.
string
Additional CSS classes to apply.
Skeleton
number
Number of skeleton rows to display.Default:
20Formatting Utilities
TheOrderbookTable includes utility functions for formatting numeric values.
formatPrice
Format numbers as USD currency.value: number- The number to formatdecimals?: number- Number of decimal places (default: 2)
formatDigits
Format numbers with specific decimal precision.value: number- The number to formatoptions: object- Formatting optionsdecimals?: number- Decimal places (default: 8)minVal?: number- Threshold for ”< X” display (default: 1e-8)useGrouping?: boolean- Use thousand separators (default: true)
defaultBarColorMap
Default colors for depth visualization bars.Notes
The table automatically calculates depth percentages based on the
maxTotal prop. Ensure this value represents the maximum cumulative total for accurate visualization.
