Stocks
ProNewMarket quotes as a ticker tape, card grid or stack, compact list, sortable watchlist or chart with range tabs. Quotes come from props.
Installation
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
Props
<Stocks>
| Prop | Type | Default |
|---|---|---|
| quotes* | Quote[] | — |
| layout | "ticker" | "cards" | "stack" | "list" | "watchlist" | "chart"`ticker` is a scrolling tape, `cards` a grid, `stack` one card per row, `list` compact rows, `watchlist` a sortable table and `chart` one symbol with range tabs. | "cards" |
| title | stringA heading above the widget. | — |
| currency | string | "USD" |
| locale | string | "en-US" |
| colors | "green-up" | "red-up"`red-up` swaps the colors, as markets in East Asia do. | "green-up" |
| sparklines | booleanSmall charts in the ticker, cards, list and table. | true |
| onSelect | (symbol: string) => voidMakes each symbol a button. | — |
| duration | numberTicker: seconds for one full loop. | — |
| ranges | string[]Chart: range tabs. Defaults to the keys of the symbol's `ranges`. | — |
| range | stringChart: the open range, for controlled use (fetch the data in `onRangeChange`). | — |
| defaultRange | string | — |
| onRangeChange | (range: string) => void | — |
| symbol | stringChart: the symbol on show, for controlled use. | — |
| defaultSymbol | string | — |
| onSymbolChange | (symbol: string) => void | — |
| footnote | React.ReactNodeA line under the widget, such as "Delayed 15 minutes". | — |
| loading | boolean | — |
| error | stringAn error message in place of the quotes, with a retry button when `onRetry` is set. | — |
| onRetry | () => void | — |
| className | string | — |
<Chart>
| Prop | Type | Default |
|---|---|---|
| quotes* | Quote[] | — |
| format* | Format | — |
Accessibility
- The tape has a pause button and also stops on hover or focus; under reduced motion it is a plain scrollable row.
- Direction is never color alone: every change has an arrow and reads as “up” or “down”.
- Watchlist headers are buttons that set aria-sort. Range tabs are a tablist with arrow keys.
- The chart is a slider: arrow keys, Page Up/Down, Home and End read each price, and a status line announces the symbol when it changes.