Skip to content

Install

View as Markdown

Terminal window
npm install @vinsa/towers
  • React 18 or later. It is the package’s only peer dependency.
  • Any bundler that can import a CSS file: Vite, Next.js, webpack and the rest.

The chart needs its stylesheet. Import it once, near the root of your app:

import '@vinsa/towers/styles.css';

The file is about 5 kB of plain CSS. Every class starts with rt-, so it will not collide with yours, and it does not need Tailwind or any other framework.

Export
Towers Draws a whole response. Start here.
TowerChart Draws one tower, for building your own layout.
Helpers layerKey, formatAmount, assignFills and others.
Types TowersResponse, RiskTowers, Tower, HorizontalBand, VerticalBlock.

The package ships ES modules and CommonJS, with TypeScript types included.

The components are marked as client components, so in Next.js you can render <Towers /> straight from a server component and pass it the response you fetched there. See the Next.js guide.