Vela, our next-generation charting platform, is live at vela.luxalgo.com.
LuxAlgo

Layout and panels

API reference for the side rail, bottom dock, panel descriptors, and UI formatting helpers in @luxalgo/vela-pro.

View as Markdown

This page documents the layout primitives and UI utilities exported by @luxalgo/vela-pro, including the side rail, bottom dock, panel registration helpers, DOM utilities, icons, and value formatters.

Import symbols on this page from @luxalgo/vela-pro. Related guides: Workspace layout, Custom panels and widgets, Interface layout.

Feature enablers for this area (enableBottomDock, enableSchemeTracking, enableSideRail) are documented on Enablers and options.

Functions

append

function append(el: Element, children: readonly Child[]): void

See also: Child.

bottomDock

The bottom dock of a shell (by its root or a context), or null when it is off.

function bottomDock(host: HTMLElement | WidgetContext): BottomDockHandle | null

See also: BottomDockHandle. From @luxalgo/vela/plugin: WidgetContext.

bottomPanels

function bottomPanels(): BottomPanelDescriptor[]

See also: BottomPanelDescriptor.

clampDockHeight

Clamp a requested dock height: never under min, never squeezing the charts under chartFloor.

function clampDockHeight(px: number, l: DockHeightLimits): number

See also: DockHeightLimits.

decimalsOf

Decimals that print tick exactly (0.01 → 2, 0.5 → 1, 1 → 0).

Also exported from @luxalgo/vela-pro/plugin.

function decimalsOf(tick: number): number

describeRailEntry

Give a rail entry (a side panel or an item) its hover-card copy.

Also exported from @luxalgo/vela-pro/plugin.

function describeRailEntry(id: string, hint: RailHint): void

See also: RailHint.

ensureProUi

Inject Pro's base stylesheet into doc (idempotent).

Also exported from @luxalgo/vela-pro/plugin.

function ensureProUi(doc?: Document): void

Default: doc = document.

formatAgo

3m ago, just now.

function formatAgo(ms: number, now?: number): string

Default: now = Date.now().

formatClock

14:05:09: a clock time.

Also exported from @luxalgo/vela-pro/plugin.

function formatClock(ms: number): string

formatCompact

A large count compactly (1.2K, 3.4M).

Also exported from @luxalgo/vela-pro/plugin.

function formatCompact(value: number | null | undefined): string

formatDate

function formatDate(ms: number | null | undefined, timeZone?: string): string

formatDateTime

28 Oct 2026, 14:05 in the given IANA zone (default: the browser's).

Also exported from @luxalgo/vela-pro/plugin.

function formatDateTime(ms: number | null | undefined, timeZone?: string): string

formatDuration

A duration in ms as 2d 4h, 3h 12m, 45m, 12s.

Also exported from @luxalgo/vela-pro/plugin.

function formatDuration(ms: number | null | undefined): string

formatMoney

A money amount (2 decimals), signed when signed.

Also exported from @luxalgo/vela-pro/plugin.

function formatMoney(
    value: number | null | undefined,
    opts?: { signed?: boolean; currency?: string; decimals?: number },
): string

formatPercent

Also exported from @luxalgo/vela-pro/plugin.

function formatPercent(
    value: number | null | undefined,
    opts?: { signed?: boolean; decimals?: number },
): string

formatPrice

A price at the market's tick precision.

Also exported from @luxalgo/vela-pro/plugin.

function formatPrice(value: number | null | undefined, tick?: number): string

Default: tick = 0.01.

formatQty

A quantity: as many decimals as it carries, up to 8.

Also exported from @luxalgo/vela-pro/plugin.

function formatQty(value: number | null | undefined): string

h

Also exported from @luxalgo/vela-pro/plugin.

function h<K extends keyof HTMLElementTagNameMap>(
    tag: K,
    props?: ElementProps,
    ...children: Child[],
): HTMLElementTagNameMap[K]

See also: Child, ElementProps.

icon

A Vela icon (registry id) as an element: size in px.

Also exported from @luxalgo/vela-pro/plugin.

function icon(id: string, size?: number): HTMLElement

Default: size = 16.

pressDockPanel

A press on a panel's toggle (its tab, its rail button): opens the dock on that panel; on the panel already showing, closes the dock (the rail's own idiom for side panels).

function pressDockPanel(state: DockState, id: string): DockState

See also: DockState.

railItems

function railItems(): RailItemDescriptor[]

See also: RailItemDescriptor.

registerBottomPanel

Register (or replace) a bottom panel. Shells built afterwards dock it.

Also exported from @luxalgo/vela-pro/plugin.

function registerBottomPanel(desc: BottomPanelDescriptor): () => void

See also: BottomPanelDescriptor.

registerProIcons

Register Pro's icons (idempotent). Every enabler calls it before projecting chrome.

Also exported from @luxalgo/vela-pro/plugin.

function registerProIcons(): void

registerRailItem

Register (or replace) a rail item. Shells already built show it on their next refresh.

function registerRailItem(desc: RailItemDescriptor): () => void

See also: RailItemDescriptor.

setData

function setData(
    el: HTMLElement,
    data: Record<string, string | number | boolean | null | undefined>,
): void

sideRail

The shell's sidebar, for a badge on an entry: sideRail(ctx)?.setBadge(id, count).

Also exported from @luxalgo/vela-pro/plugin.

function sideRail(ctx: WidgetContext): SidebarControl | null

From @luxalgo/vela/plugin: SidebarControl, WidgetContext.

Classes

Disposer

Drop every listener registered through listen at once: a surface's teardown.

Also exported from @luxalgo/vela-pro/plugin.

class Disposer {
    add(fn: () => void): void;
    listen<K extends keyof WindowEventMap>(
        target: Window,
        type: K,
        fn: (e: WindowEventMap[K]) => void,
        opts?: AddEventListenerOptions | boolean,
    ): void;
    listen<K extends keyof DocumentEventMap>(
        target: Document,
        type: K,
        fn: (e: DocumentEventMap[K]) => void,
        opts?: AddEventListenerOptions | boolean,
    ): void;
    listen<K extends keyof HTMLElementEventMap>(
        target: HTMLElement,
        type: K,
        fn: (e: HTMLElementEventMap[K]) => void,
        opts?: AddEventListenerOptions | boolean,
    ): void;
    listen(
        target: EventTarget,
        type: string,
        fn: EventListener,
        opts?: AddEventListenerOptions | boolean,
    ): void;
    dispose(): void;
}

Interfaces and types

BottomDockHandle

Drive a shell's dock from code (a panel opening itself when a strategy runs).

interface BottomDockHandle {
    readonly isOpen: boolean;
    readonly active: string | null;
    open(id?: string): void;
    close(): void;
    toggle(id: string): void;
    setMaximized(on: boolean): void;
    onChange(cb: () => void): () => void;
}
MemberTypeDescription
isOpenboolean
activestring | null
open()(id?: string) => void
close()() => void
toggle()(id: string) => voidThe rail's press: open on id, or close when id is already showing.
setMaximized()(on: boolean) => void
onChange()(cb: () => void) => () => void

BottomPanelDescriptor

interface BottomPanelDescriptor {
    id: string;
    title: MessageLike;
    icon: string;
    description?: MessageLike;
    order?: number;
    rail?: boolean;
    restoreOpen?: boolean;
    minHeight?: number;
    collapseBelow?: number;
    chrome?: 'header' | 'none';
    mount(ctx: WidgetContext, body: HTMLElement, header: BottomPanelHeader): BottomPanelHandle | void;
}
MemberTypeDescription
idstringStable id: the key the open panel persists under.
titleMessageLike
iconstring
description?MessageLikeRail hover-card text.
order?numberRail order (ascending, default 100).
rail?booleanA rail button toggles the panel (default true). False for a panel that opens itself: the strategy tester, when a strategy reports a backtest.
restoreOpen?booleanReopen the dock on this panel when the saved state had it open (default: what rail says). False for a panel that opens itself.
minHeight?numberThe dock's floor while this panel shows, px (default: the dock's minHeight).
collapseBelow?numberReleased from a drag below this height, the dock snaps down to the panel's floor.
chrome?'header' | 'none''header' (default): the dock draws a title bar with maximize and close. 'none': the panel draws its own header in the body it is handed (tabs in it, its own close).
mount()(ctx: WidgetContext, body: HTMLElement, header: BottomPanelHeader) => BottomPanelHandle | voidMounted once per shell, when the dock mounts, so a panel can listen while hidden.

See also: BottomPanelHandle, BottomPanelHeader. From @luxalgo/vela/plugin: MessageLike, WidgetContext.

BottomPanelHandle

interface BottomPanelHandle {
    onOpen?(): void;
    onClose?(): void;
    destroy?(): void;
}
MemberTypeDescription
onOpen?()() => voidThe panel became the visible tab of an open dock.
onClose?()() => voidThe panel stopped being visible (another tab, or the dock closed).
destroy?()() => void

BottomPanelHeader

The chrome a bottom panel shares with the dock.

Also exported from @luxalgo/vela-pro/plugin.

interface BottomPanelHeader {
    readonly slot: HTMLElement;
    setCount(count: number | null): void;
    close(): void;
    isMaximized(): boolean;
    setMaximized(on: boolean): void;
    fold(height: number | null): void;
}
MemberTypeDescription
slotHTMLElementControls shown at the header's right while this panel is the active tab.
setCount()(count: number | null) => voidA count beside the panel's title (open positions, trades); null hides it.
close()() => voidClose the dock: what a panel drawing its own header wires its close button to.
isMaximized()() => boolean
setMaximized()(on: boolean) => voidFill the shell with the dock, or give the charts their room back.
fold()(height: number | null) => voidFold the dock to exactly height px (a one-line header) while this panel shows, with no resize edge; null unfolds it back to the height the user dragged it to.

Child

type Child = Node | string | number | null | undefined | false | readonly Child[];

DockHeightLimits

interface DockHeightLimits {
    min: number;
    shell: number;
    chartFloor: number;
}
MemberTypeDescription
minnumberThe dock's own floor (its header plus a few rows).
shellnumberThe shell's height.
chartFloornumberWhat the charts keep, at least, above the dock.

DockState

interface DockState {
    open: boolean;
    active: string | null;
}

ElementProps

interface ElementProps {
    class?: string;
    part?: string;
    data?: Record<string, string | number | boolean | null | undefined>;
    attrs?: Record<string, string | number | boolean | null | undefined>;
    style?: Partial<CSSStyleDeclaration> | string;
    text?: string;
    title?: string;
    on?: { [K in keyof HTMLElementEventMap]?: (e: HTMLElementEventMap[K]) => void };
}
MemberTypeDescription
class?stringSpace-separated class list.
part?stringThe styling hook: data-part="…".
data?Record<string, string | number | boolean | null | undefined>data-* attributes ({ side: 'buy' } → data-side="buy"); null/false drops one.
attrs?Record<string, string | number | boolean | null | undefined>Plain attributes; null/false drops one, true writes an empty one.
style?Partial<CSSStyleDeclaration> | string
text?string
title?string
on?{ [K in keyof HTMLElementEventMap]?: (e: HTMLElementEventMap[K]) => void }

RailHint

Hover-card copy for a rail entry (a side panel or an item).

interface RailHint {
    description?: MessageLike;
    shortcut?: string;
}

From @luxalgo/vela/plugin: MessageLike.

RailItemDescriptor

interface RailItemDescriptor {
    id: string;
    title: MessageLike;
    icon: string;
    description?: MessageLike;
    shortcut?: string;
    order?: number;
    run(ctx: WidgetContext): void;
    active?(ctx: WidgetContext): boolean;
    subscribe?(ctx: WidgetContext, refresh: () => void): () => void;
}
MemberTypeDescription
idstringStable id: what a host lists in top/bottom, and what hides it.
titleMessageLike
iconstring
description?MessageLikeHover-card text.
shortcut?stringA shortcut shown on the hover card (Alt+T).
order?numberSort key within the 'items' flow slot (ascending, default 100).
run()(ctx: WidgetContext) => void
active?()(ctx: WidgetContext) => booleanPressed look (a toggle that is on).
subscribe?()(ctx: WidgetContext, refresh: () => void) => () => voidRe-read active when the item's own state changes: call refresh.

From @luxalgo/vela/plugin: MessageLike, WidgetContext.

Constants

PRO_UI_STYLE_ID

const PRO_UI_STYLE_ID: 'vela-pro-ui';

On this page