Skip to content

Order Book

Beta
Get Ritla UI

Sell orders above the current price and buy orders below, each with a depth bar sized by its total.

Preview

Mirrored is the same English content laid out right to left: it separates a mirroring bug from a translation one.

PreviewCode
EnglishMirroredArabic
LTR →

Installation

  1. Add the component

    npx ritla add order-book

    Also works with shadcn: npx shadcn@latest add @ritla/order-book

  2. Or copy by hand

    Installing by hand copies the component's source into your project. The source comes with a Ritla UI license, so the CLI is the short way to the same files.

Usage

order-book.tsx
import { OrderBook } from "@/components/ui/order-book";<OrderBook asks={asks} bids={bids} price={58.33} change={0.12} labels={labels} />

API reference

OrderBook

PropTypeDefaultDescription
asks / bids{ price, amount }[]NoneSell levels (closest last) and buy levels (closest first).
price / changenumberNoneThe current price and its change in percent.
priceDecimalsnumber2Digits after the point for prices.
labelsobjectNoneHeaders, group names and “Spread”, in the page language.

Accessibility

ARIA

  • A table (role="table") with column headers, and named groups for sell and buy orders.
  • Red and green are repeated by position: sells above the price, buys below.

Arabic and RTL notes

Mirrors

  • The columns mirror: price on the right, total on the left; depth bars grow from the left.

Does not mirror

  • Every figure stays left to right.
Numerals
Prices, amounts and totals follow numerals on RitlaProvider.
Arabic typography
numeric-12 rows, numeric-20 Semibold price.