Skip to content
Charts55Components12Visuals14ASCII45
GitHubGet startedGet started
All chartsDepth chartFinance
PreviousNext: Order book

FinanceFI-04

Depth chart

How much could trade at each price: buying on the left, selling on the right, and the gap between.

Part
FI-04
Component
DepthChartCard
From
@lilt-ui/charts/finance

SOL · USDC

$182.41$182.41Mid price
Spread
$0.25 (0.137%)
Bid depth
13K
Ask depth
13.9K
Mid $182.41$178.53$182.53
Default01 / 01

Installation

One package, one sheet.

Add the package, then import the component and the stylesheet once. See Getting started for theming.

$npm install @lilt-ui/charts
import { DepthChartCard } from '@lilt-ui/charts/finance';
import '@lilt-ui/charts/styles.css';

Usage

The default card.

The default card above, as you would write it.

<DepthChartCard
  title="SOL · USDC"
  bids={book.bids}
  asks={book.asks}
  valueFormat={{ style: 'currency', currency: 'USD' }}
/>

Omit title to leave out the visible title. Set header={false} to remove the whole header, and use aria-label to name a chart inside your own card. surface="ghost" controls only the visual frame. See Card composition.

Data

The shape it reads.

Bids accumulate from the best (highest) bid down and asks from the best (lowest) ask up, so each curve shows how much size rests between the mid and a price. Orders at the same price merge. A crossed book, with a bid at or above an ask, throws rather than drawing a misleading spread. depthLevels returns the same cumulative levels, mid and spread for your own layouts.

// Resting orders: a price and the size at it, in any order.
const book = {
  bids: [
    { price: 182.28, size: 1050 },
    { price: 182.03, size: 626 },
  ],
  asks: [
    { price: 182.53, size: 356 },
    { price: 182.78, size: 1793 },
  ],
};

<DepthChartCard title="SOL · USDC" bids={book.bids} asks={book.asks} />

Props21

Every prop.

Every prop DepthChartCard accepts, in the order you are likely to reach for them.

PropTypeDescription
headerbooleanFalse removes the title, midpoint and summary stats. Defaults to true.
aria-labelstringAccessible name, independent of the visible title.
titlestringOptional visible title. Also names the chart unless aria-label is set.
bids{ price, size }[]Resting buy orders, in any order.
asks{ price, size }[]Resting sell orders, in any order.
valueFormatIntl.NumberFormatOptionsPrice format for the mid, spread and axis. Defaults to US dollars.
sizeFormatIntl.NumberFormatOptionsSize format for depth. Compact numbers by default.
heightnumberPlot height in pixels. Defaults to 220.
background'dots' | 'grid' | 'lines' | 'none'Texture behind the depth areas.
axis'minimal' | 'dots' | 'inline' | 'ruler' | 'classic' | 'segmented'Axis preset.
hoverStyle'soft' | 'solid' | 'accent'How the pills look.
surface'elevated' | 'outline' | 'ghost'Card treatment.
loadingbooleanShows a neutral loading skeleton, not data.
loadingStyle'shimmer' | 'draw' | 'breathe'Shimmer sweeps a highlight over still shapes; draw reveals them in order; breathe lets them settle. Follows the selected look, including depth, and respects reduced motion.
empty'dots' | 'shape' | ReactElement | nullWhat the card shows when the period has no data. Dots (default) gathers a quiet dot field around the message; shape lays the chart’s own outline behind it. Pass `<ChartEmpty>` with your own words, any element of your own, or null for nothing. Both looks stay still, so empty never reads as loading, and the headline reads a dash, never zero.
motion'auto' | 'none'None turns off decorative motion.
depthbooleanDraws both sides' edges as lit tubes with a soft shadow; every step keeps its exact price.
localestringLocale used for number formatting. Defaults to en-US.
classNamestringAdditional class on the card frame.
styleCSSProperties | ChartStyleInline styles and scoped --lilt-* chart variables.
numberStyle'count' | 'pop' | 'slide' | 'roll' | 'flow' | 'scramble'Headline number animation. Defaults to count; motion settings take precedence.
Previous chartPriceNext chartOrder book

Ready when your data is. Start with one install.

Install a package, import the stylesheet once, and drop in a card or a scene.

Read the guideRead the guideView on GitHubView on GitHub
ChartsAll chartsAll chartsFinanceFinanceCustomizeCustomizeFeaturesFeatures
ComponentsAll componentsAll componentsAIAIStatusStatusActionsActionsDataData
VisualsAll visualsAll visualsAIAIDataDataSecuritySecurityProductProduct
ASCIIAll scenesAll scenesTextTextInterfaceInterfaceBackgroundsBackgroundsMediaMediaDataData
DocsGetting startedGetting startedAPI referenceAPI referenceMotion & accessibilityMotion & accessibilityllms.txtllms.txt
React components with a little lilt.GitHubGitHubnpmnpm