# Install

> Add the @vinsa/towers package to a React app.

**npm**

```sh
npm install @vinsa/towers
```

**pnpm**

```sh
pnpm add @vinsa/towers
```

**yarn**

```sh
yarn add @vinsa/towers
```

## Requirements

- 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.

## Import the styles once

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

```tsx
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.

## What the package exports

| Export | |
| --- | --- |
| [`Towers`](https://towers.vinsa.dev/docs/react/towers.md) | Draws a whole response. Start here. |
| [`TowerChart`](https://towers.vinsa.dev/docs/react/tower-chart.md) | Draws one tower, for building your own layout. |
| [Helpers](https://towers.vinsa.dev/docs/react/helpers.md) | `layerKey`, `formatAmount`, `assignFills` and others. |
| Types | `TowersResponse`, `RiskTowers`, `Tower`, `HorizontalBand`, `VerticalBlock`. |

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

## Server components

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](https://towers.vinsa.dev/docs/guides/nextjs.md).
