Order Book

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.

Default—
asks
readonly OrderBookLevel[]

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

Default—
levels?
number

Number of nearest levels to show on each side.

Default—
lastPrice?
number

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

Default—
label?
string
DefaultOrder book
baseSymbol?
string
Default—
quoteSymbol?
string
Default—
formatPrice?
((value: number) => string)
Default—
formatSize?
((value: number) => string)
Default—
activeLevel?
OrderBookActiveLevel

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

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

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

Default—
className?
string
Default—

OrderBookHeader

className?
string
Default—

OrderBookSide

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

OrderBookSpread

className?
string
Default—

OrderBookBalance

className?
string
Default—

OrderBookDepthSummary

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

Custom readout for the inspected levels.

Default—
className?
string
Default—

Updated