Skip to content

NewMCP server for your coding agent. Set it up ›

Nexus UI
Get Pro

Stock Line, animated React component

  • Pro
  • Dashboards
  • Hover
  • Spring

A trading-app price chart: scrub along it and a dot rides the line while the price rolls digit by digit and the change turns green or red. Switching range morphs the line into its new shape, and on 1D the last price keeps ticking live.

Props

PropTypeDefaultWhat it does
theme"auto""auto" follows the page's .dark class; "light" or "dark" pins the card's palette.
symbol"NXUS"Ticker shown in the corner and read out in the chart's label.
smoothtrueDraw the line as smooth curves instead of straight segments.
filltrueFade a gradient area under the line.
up"#30d158"Line and change colour while the price is at or above the range's open.
down"#ff453a"Line and change colour while the price is below the range's open.
autoplayfalseCycles through the ranges and sweeps the dot along each one until someone interacts.

Add it to your project

  1. 1

    Set up your project once

    You need a Next.js project with Tailwind CSS and the @/ import alias. In its root folder, run this once. It creates components.json and the cn() helper in src/lib/utils.ts:

    npx shadcn@latest init -d

    Starting from nothing? The Quick Start walks through the whole thing.

  2. 2

    Connect the registry with your API key

    Stock Line is a Pro item, so the CLI has to send your API key. Do this once per project:

    1. Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with nxs_ and is shown only once.
    2. In your project root, next to package.json, create a file named .env.local with this line, using your own key:
      NEXUS_API_KEY=nxs_your_key_here
    3. Open components.json and add this entry inside the outermost braces, next to "aliases". Leave {name} and ${NEXUS_API_KEY} exactly as written; the CLI fills them in:
      "registries": {
        "@nexus-labs": {
          "url": "https://www.nexus-ui.com/api/registry/{name}",
          "headers": {
            "Authorization": "Bearer ${NEXUS_API_KEY}"
          }
        }
      }

How Stock Line works

A price chart in the style of a trading app. Run along it and a dot rides the line while the price rolls digit by digit and the change turns green or red. Switching range morphs the line from one shape into the next instead of redrawing it, and on 1D the last point keeps ticking live.

The source, the install command and the build prompt come with Pro.