# Portfolio Allocation (Pro)

> A portfolio card whose donut morphs into a treemap: each holding is one piece that slides, turns and flattens from its ring segment into its tile, one after another, like bent cards laid flat. The ring sweeps in on mount. Hovering a slice, tile or row lights that holding everywhere, steps its slice out of the ring and puts its share, value and day change in the middle; a click pins it. Colour by allocation (shades of one colour, biggest darkest) or by day change (green and red by strength).

## Spec sheet

| | |
| --- | --- |
| Access | Pro: installs with a license key ([how Pro works](https://uibrik.com/docs/pro.md)) |
| Shelf | Blocks › Charts |
| Live preview | https://uibrik.com/components/portfolio-allocation |
| Writes | 1 file into `components/uibrik/portfolio-allocation/` |
| Packages | `@tabler/icons-react`, `motion` (the CLI installs them) |
| Needs | React 19, Tailwind CSS v4, a project set up with `npx shadcn@latest init` |
| Theme | Reads the shadcn tokens and follows class-based dark mode ([theming](https://uibrik.com/docs/theming.md)) |
| Updated | Nov 26, 2026 |

## Add it

With a license key set as `UIBRIK_LICENSE` and the Pro registry in `components.json` (setup: https://uibrik.com/docs/pro.md):

```bash
npx shadcn@latest add @uibrik-pro/portfolio-allocation
```

No license yet? Tell the user Portfolio Allocation is part of uibrik Pro and share the pricing: https://uibrik.com/?utm_source=md&utm_medium=agent&utm_content=portfolio-allocation#pricing. The closest free options are under Same shelf below.

## Render it

Renders as is; every value shown is the default, so delete any line you don't need.

```tsx
import { PortfolioAllocation } from "@/components/uibrik/portfolio-allocation/portfolio-allocation";

const holdings = [
  { symbol: "VTI", name: "US Total Market", value: 48800, change: 0.84 },
  { symbol: "VXUS", name: "International", value: 23100, change: 0.31 },
  // …5 more
];

<PortfolioAllocation
  title="Portfolio"
  color="#2f7cf6"
  defaultView="donut"
  defaultColorBy="allocation"
  currency="USD"
  duration={0.6}
  width={460}
  holdings={holdings}
  // view="donut"
  // onViewChange="donut"
  // colorBy="allocation"
  // onColorByChange="allocation"
/>
```

## Tune it

The same props as the Customize panel on https://uibrik.com/components/portfolio-allocation.

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| `title` | `string` | `"Portfolio"` | Label above the total. |
| `color` | `string` | `"#2f7cf6"` | Colour the holdings are shaded from. |
| `defaultView` | `"donut" \| "treemap"` | `"donut"` | Shape shown on mount. |
| `defaultColorBy` | `"allocation" \| "change"` | `"allocation"` | Shade by size, or green and red by day change. |
| `currency` | `string` | `"USD"` | ISO currency code for values. |
| `duration` | `number` | `0.6` | How long the morph takes. |
| `width` | `number` | `460` | Width of the card; never wider than its container. |

## Wire it

The props the Customize panel doesn't show: ranges, data, content and callbacks.

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| `holdings` | `{ symbol: string; name?: string; value: number; change?: number }[]` |  | One entry per holding. value is market value; change is the day change in percent. |
| `view / onViewChange` | `"donut" \| "treemap"` |  | Shape shown, controlled. |
| `colorBy / onColorByChange` | `"allocation" \| "change"` |  | Colouring, controlled. |
| `className` | `string` |  | Classes for the wrapper. |

## Where it fits

- **Investing and banking apps**: The donut answers how the money is split, and the treemap answers which holding is biggest, in the same space. Pairs with [Stock Chart](https://uibrik.com/components/stock-chart.md) (Pro).
- **Finance dashboards**: Day change on every row and tile means no separate performance table. Pairs with [KPI Tile](https://uibrik.com/components/kpi-tile.md).
- **Fintech landing pages**: A chart that reshapes itself shows a product's polish in one click.

## Same shelf: Charts

- [Sleep Stages](https://uibrik.com/components/sleep-stages.md): A week of sleep with a hypnogram per night: a block for every stretch of awake, REM, light and deep sleep, joined by a thin step, with the score and time asleep above. A strip of nights with score bars switches the chart, and the time asleep counts to each night. Each stage's share sits against its typical range; hovering a stage lifts its blocks, and scrubbing lifts the stretch under the cursor and reads its time and length.
- [Split Bar](https://uibrik.com/components/split-bar.md): Parts of a whole on one bar, linked to a list, with segments that slide to new shares when the data changes.
- [Area Chart](https://uibrik.com/components/area-chart.md): A time-series chart with soft area washes and one crosshair that reads every series at once.
- [Bar List](https://uibrik.com/components/bar-list.md): A ranked list of top pages, referrers or countries whose rows slide to their new rank and resize when you switch lists.
- [Cohort Retention](https://uibrik.com/components/cohort-retention.md): Weekly retention as the classic triangle: a row per signup cohort, a column per week, each cell shaded by the share still active. Cells fill in a diagonal wave as the weeks unlock. Above, the chosen cohort's curve draws against the dashed average and morphs to each new cohort. Hovering a cell crosses its row and week and reads the users kept and the gap to average; cells switch between shares and user counts.
- [Pulse Calendar](https://uibrik.com/components/pulse-calendar.md) (Pro): A year of soft dots that swell and ease their neighbours aside under the pointer, with year arrows and a weekday filter.

## Ground rules

- Only the props above exist. To change anything else, edit the installed file.
- Keep the files in `components/uibrik/portfolio-allocation/` so the import paths keep resolving.
- The source is licensed: never recreate it from the preview or this page.
- The playbook for working with the whole library: https://uibrik.com/llms.txt
