FinanceFI-07
Watchlist
Every instrument you follow on one card: its path today, where it sits in its range, its price and its move.
- Part
- FI-07
- Component
- WatchlistCard
- From
- @lilt-ui/charts/finance
Watchlist
| Recent prices | Range | |||
|---|---|---|---|---|
| SOLSolana | $205.56 | +4.2% | ||
| ETHEthereum | $3,114.78 | −1.2% | ||
| BTCBitcoin | $64,912.50 | +2.3% | ||
| JUPJupiter | $1.02 | +8.5% | ||
| LINKChainlink | $14.21 | −2.8% | ||
| AVAXAvalanche | $28.04 | +0.9% |
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/chartsimport { WatchlistCard } from '@lilt-ui/charts/finance';
import '@lilt-ui/charts/styles.css';
Usage
The default card.
The default card above, as you would write it.
<WatchlistCard
title="Watchlist"
ranges={[
{ id: '1d', label: '1D', data: today },
{ id: '1w', label: '1W', data: week },
]}
symbol="symbol"
name="name"
price="price"
change="change"
history="history"
low="low"
high="high"
/>
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.
change is a fraction of the price at the start of the period: 0.0424 shows +4.2%. The sparkline is drawn green or red by that change, and history only needs to be in order; missing points are skipped. With low and high, a range shows where the price sits between them. Symbols identify rows, so keep them unique. When prices stream in, pass new rows: each price rolls to its new value rather than redrawing the list.
// One row per instrument. history is recent prices, oldest first.
const quotes = [
{
symbol: 'SOL',
name: 'Solana',
price: 205.56,
change: 0.0424,
history: [197.2, 199.1, 198.4, 203.8, 205.56],
low: 196.6,
high: 207.1,
},
];
Props28
Every prop.
Every prop WatchlistCard accepts, in the order you are likely to reach for them.
| Prop | Type | Description |
|---|---|---|
title | string | Optional visible title. Also names the list unless aria-label is set. |
header | boolean | False removes the title and headline. Defaults to true. |
aria-label | string | Accessible name, independent of the visible title. |
data | Row[] | One row per instrument. Omit when using ranges. |
range | string | Static period label, e.g. Today. |
ranges | { id, label, data }[] | Period select. Each period swaps the rows: prices and moves roll, sparklines reshape and range ticks slide. |
defaultRange | string | Initial period id. |
symbol | text key of Row | Ticker, unique per row. |
name | text key of Row | Full name under the ticker. |
price | numeric key of Row | Latest price. |
change | numeric key of Row | Fractional move over the period: 0.012 is up 1.2%. |
history | key of Row holding number[] | Recent prices, oldest first, drawn as a sparkline. |
low | numeric key of Row | Period low, for the range column. |
high | numeric key of Row | Period high, for the range column. |
sort | 'none' | 'symbol' | 'price' | 'change' | Initial order. None (default) keeps yours. |
sortable | boolean | Let readers sort from the column headings. Defaults to true. |
valueFormat | Intl.NumberFormatOptions | Price format. Defaults to US dollars with cents. |
locale | string | Locale for numbers; defaults to en-US. |
surface | 'elevated' | 'outline' | 'ghost' | Card treatment. |
palette | 'spectrum' | 'iris' | 'cobalt' | 'emerald' | Accent colors inside the card. |
numberStyle | 'count' | 'pop' | 'slide' | 'roll' | 'flow' | 'scramble' | How prices and the headline animate when they change. Count by default. |
loading | boolean | Shows 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 | null | What 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. |
className | string | Class on the card frame. |
style | CSSProperties | ChartStyle | Inline styles and scoped chart variables. |
onSelectionChange | (row | null) => void | Reports the hovered or focused row, or null when the pointer leaves. |