Order Book

Animated order book with bid and ask depth, spread, and volume balance.

Preview

SOL / USDSimulated
Price USDSize SOLCumulative total SOL
247.207828.6K
247.051.2K7.8K
246.901.1K6.6K
246.752.2K5.5K
246.601.8K3.3K
246.452781.5K
246.303631.2K
246.15574858
246.00284284
Reference price: 245.85Spread 0.30 · 0.122%
Price USDSize SOLCumulative total SOL
245.70194194
245.55543737
245.403141.1K
245.255921.6K
245.107152.4K
244.957443.1K
244.807893.9K
244.657354.6K
244.501.1K5.7K
Bids 40.0%Visible depthAsks 60.0%

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @beui/order-book

API Reference

OrderBook

bids
readonly OrderBookLevel[]

Snapshot of buy levels. Equal prices are combined; invalid and zero sizes are omitted.

—
asks
readonly OrderBookLevel[]

Snapshot of sell levels. Supply new arrays when the book changes.

—
levels?
number

Number of nearest levels to show on each side.

—
lastPrice?
number

Last traded price. Omit to show the midpoint of the best bid and ask.

—
label?
string
Order book
baseSymbol?
string
—
quoteSymbol?
string
—
formatPrice?
((value: number) => string)
—
formatSize?
((value: number) => string)
—
className?
string
—

OrderBookHeader

className?
string
—

OrderBookSide

side
"bid" | "ask"
—
className?
string
—

OrderBookSpread

className?
string
—

OrderBookBalance

className?
string
—

Updated