Skip to main content
The OrderbookTable component renders bid and ask data in a tabular format with support for custom columns, styling, and depth visualization.

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.
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: 20

Formatting Utilities

The OrderbookTable includes utility functions for formatting numeric values.

formatPrice

Format numbers as USD currency.
Parameters:
  • value: number - The number to format
  • decimals?: number - Number of decimal places (default: 2)

formatDigits

Format numbers with specific decimal precision.
Parameters:
  • value: number - The number to format
  • options: object - Formatting options
  • decimals?: 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.
For optimal performance with large datasets, consider limiting the number of rendered rows using the responsive breakpoint feature in the Orderbook component.
When using custom renderRow, you’re responsible for implementing depth visualization and proper styling for bids vs asks.