shadcn.io is an independent project built on shadcn/ui
On this page9 sections
A ticker writes one market quote on a single line: a logo, the symbol, the price and the change, with a rise in green beside an up arrow and a fall in red beside a down arrow. It fits a watchlist row, a portfolio summary or a quote inside a sentence. The numbers come from your own feed, and the ticker only formats them, in the currency and locale you give it.
For a figure that animates as it counts up or rolls over, use Counting Number or Sliding Number.
Installation
Anatomy

Usage
import {
Ticker, TickerIcon, TickerPrice, TickerPriceChange, TickerSymbol,
} from "@/components/ui/ticker";<Ticker>
<TickerIcon src="https://github.com/bitcoin.png" symbol="BTC" />
<TickerSymbol symbol="BTC" />
<TickerPrice price={67432.5} />
<TickerPriceChange change={2.34} isPercent />
</Ticker>Every part is optional, so a ticker can be only a symbol and a change. isPercent makes 2.34 read as 2.34%, and without it the change is written as money in the ticker's currency.
Accessibility
Ticker is a span with no role, so a screen reader reads the symbol, the price and the change as ordinary text, in order. The change carries its sign in the text, +2.34% or -1.12%, so the direction doesn't rest on color alone, and the arrow is hidden from assistive technology. The logo has an empty alt, since the symbol beside it already names the stock, and the two letters that can stand in for it are hidden too. A new price isn't announced, which suits a feed that updates every few seconds. Rendered as a link or a button, the ticker's text becomes the control's name, so keep it to the symbol and the figures.
Demos
Currencies
Four exchanges, each Ticker with its own currency and locale: dollars in en-US, euros in de-DE, pounds in en-GB and rupees in en-IN. The change is money here rather than a percent, so it's written in the same currency with its sign. Intl.NumberFormat places the symbol and the separators, down to the Indian grouping in ₹1,02,845.75.
Inline
Two tickers inside a sentence about chip makers, each a logo, a symbol and a percent change. The ticker never breaks inside, so it moves to the next line whole, like a word. Every part, the logo's tile included, is a span, so a ticker can go inside a p. In running text, a symbol and a change say enough without the price.
Live
Three stocks whose prices drift every two seconds, from a stand-in feed inside the demo. Each new price slides up into place, or only fades in under reduced motion, and a change turns from green to red when its price drops below the day's open. A real feed works the same way: pass the new price and change on each update.
FAQ
How do I change the Ticker's currency format?
Pass currency and locale to Ticker, such as EUR and de-DE, and every price and money change inside it is written by Intl.NumberFormat in that format, as in the four markets of the Currencies demo. The locale stays en-US until you set it, so the server and the browser write the same text.
A well-formed code that Intl doesn't know, such as BTC, is written as the code itself: BTC 1,234.50. A malformed code falls back to US dollars, and a malformed locale, such as en_US with an underscore, falls back to en-US. Each falls back on its own, so a typo in the locale keeps your currency, and neither throws while the ticker renders.
Why does the Ticker round a price like 0.1234 to two decimals?
Two decimals is the default for every number the ticker writes, so a coin at 0.1234 would show as $0.12 and yen would get a .00 they don't use. Set decimals on TickerPrice or TickerPriceChange to the number of digits you want after the point, always shown.
Dogecoin in the first demo sets it to 4 and reads $0.1234, while the other coins keep two. For yen, set it to 0. The change's arrow and color follow the rounded text, so a change too small to show at that precision reads as flat.
How does TickerPriceChange pick its color and arrow?
From the sign of change. A positive number is up, in the success color with the arrow pointing up, a negative one is down, in the destructive color with the arrow turned over, and zero is flat and muted, with no arrow. The direction is also on the element as data-direction, set to up, down or flat.
The sign is read after rounding, from the text the ticker writes, so a change of 0.001 shows as 0.00% and is flat, never green beside a zero.
The colors are the success-foreground and destructive tokens of your theme. Change those classes in components/ui/ticker to recolor every ticker at once.
What does TickerIcon show when the logo doesn't load?
The symbol's first two letters, in capitals, in place of the logo. TickerIcon is an Avatar with the logo as its image and the letters as its fallback, and without a src the letters show from the start.
The letters also show while the logo is still loading, then give way to the image.
How do I make a Ticker a link or a button in Solid?
Use asChild on Ticker to render it as an a or a button that holds the parts. The first demo on this page does this with a button for each row of its crypto list, and its code shows the form asChild takes in Solid.
Either element gets a hover background and a focus ring from the ticker's own classes. Use a link when the row opens a quote page and a button when it opens a panel on the same page.
Does the Ticker fetch or stream prices?
No. It writes the numbers you pass it and nothing more. Keep the feed in your app, a WebSocket or a poll, and pass each new price and change as props.
A new price slides in when its text changes, and only fades in under reduced motion. Nothing is announced to screen readers as prices move. If a change matters, such as a price alert, announce that one event yourself in a status region.
How do I line up Ticker prices in a column?
The price and the change already use tabular figures, so every digit has the same width. Give TickerPriceChange a fixed width with its text pushed to the end, w-16 and justify-end, as the Live demo does, and the changes form a right-aligned column.
In that demo the price and the change sit together at the end of each row, so the fixed width also lines the prices up on their right edge.
API Reference
Ticker
<span>
currency?string
The ISO 4217 code prices and money changes are written in. A
well-formed code Intl doesn't know, such as BTC, is written as the
code itself; a malformed one falls back to USD.
- Default
"USD"
locale?string
The locale numbers are written in. Fixed by default, so the server and
the browser write them the same way. A malformed tag falls back to
en-US.
- Default
"en-US"
asChild?(props: ParentProps) => JSX.Element
Render your own element: a function that gets the part's props to spread on it.
- Type
(props: ParentProps) => JSX.Element
class?string
Merged with the part's classes.
TickerIcon
data-slot="ticker-icon"
symbolstring
The symbol whose letters stand in for the logo.
dir?"ltr" | "rtl"
The document's text/writing direction.
- Type
"ltr" | "rtl"- Default
"ltr"
id?string
The unique identifier of the machine.
ids?object
The ids of the elements in the avatar. Useful for composition.
- Type
{ root?: string; image?: string; fallback?: string }
onStatusChange?(details: StatusChangeDetails) → void
Functional called when the image loading status changes.
- Type
(details: StatusChangeDetails) → void- Parameters
details– { status: LoadStatus }- Returns
void
size?"default" | "sm" | "lg"
The size.
- Type
"default" | "sm" | "lg"
src?string
The logo's address. Without one, or while it fails, the symbol's first two letters show.
asChild?(props: ParentProps) => JSX.Element
Render your own element: a function that gets the part's props to spread on it.
- Type
(props: ParentProps) => JSX.Element
class?string
Merged with the part's classes.
TickerSymbol
<span> data-slot="ticker-symbol"
symbolstring
The symbol, written in capitals: btc shows as BTC.
class?string
Merged with the part's classes.
TickerPrice
<span> data-slot="ticker-price"
pricenumber
The price, written in the ticker's currency and locale.
decimals?number
How many digits after the decimal point, always shown: 4 for a coin at
0.1234, 0 for yen.
- Default
2
class?string
Merged with the part's classes.
TickerPriceChange
<span> data-slot="ticker-price-change"
changenumber
The change: positive is up, negative is down, and one that rounds to zero is flat.
decimals?number
How many digits after the decimal point, always shown.
- Default
2
isPercent?boolean
Whether change is a percent (2.5 is 2.5%) rather than money.
- Default
false
class?string
Merged with the part's classes.
data-direction?string
Mirrors direction.










