Order Book

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

Preview

SOL / USDSimulated
Price USDSize SOLCumulative total SOL
7828.6K
1.2K7.8K
1.1K6.6K
2.2K5.5K
1.8K3.3K
2781.5K
3631.2K
574858
284284
Reference price: 245.85Spread 0.30 · 0.122%
Price USDSize SOLCumulative total SOL
194194
543737
3141.1K
5921.6K
7152.4K
7443.1K
7893.9K
7354.6K
1.1K5.7K

Hover a level to see the cost of filling up to it

Bids 40.0%Visible depthAsks 60.0%

Click a price to use it, for example in an order ticket.

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)
—
activeLevel?
OrderBookActiveLevel

The level whose depth is inspected: it and every better level on its side are highlighted, and `OrderBookDepthSummary` totals them. Controlled.

—
defaultActiveLevel?
OrderBookActiveLevel
—
onActiveLevelChange?
((level: OrderBookActiveLevel) => void)
—
onLevelSelect?
((level: DepthLevel, side: "bid" | "ask") => void)

Makes each price a button, for example to fill an order ticket.

—
className?
string
—

OrderBookHeader

className?
string
—

OrderBookSide

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

OrderBookSpread

className?
string
—

OrderBookBalance

className?
string
—

OrderBookDepthSummary

placeholder?
ReactNode
Hover a level to see the cost of filling up to it
children?
((summary: DepthSummary) => ReactNode)

Custom readout for the inspected levels.

—
className?
string
—

Updated