Black Friday: 30% off Pro

Get 30% off

Updated

Portfolio Allocation

Pro

Preview

Customize

Color
donut
Allocation
Duration0.60s
Width460px

Installation

Pro

Portfolio Allocation is a Pro component

Sign in to see the source, or install it with a license key. The live preview and props above are free to explore.

Install with a key

  1. Add the Pro registry to components.json:
    components.json
    {
      "registries": {
        "@uibrik-pro": {
          "url": "https://uibrik.com/r/pro/{name}.json",
          "headers": { "Authorization": "Bearer ${UIBRIK_LICENSE}" }
        }
      }
    }
  2. Put your key in .env.local and add that file to .gitignore:
    .env.local
    UIBRIK_LICENSE=your-license-key
  3. Install it:
    Terminal
    npx shadcn@latest add @uibrik-pro/portfolio-allocation

Usage

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"/>

Where to use Portfolio Allocation

  • 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

  • Finance dashboards

    Day change on every row and tile means no separate performance table.

    Pairs with KPI Tile

  • Fintech landing pages

    A chart that reshapes itself shows a product's polish in one click.

Props

PortfolioAllocation
title
Type string
"Portfolio"
Label above the total.
color
Type string
"#2f7cf6"
Colour the holdings are shaded from.
defaultView
Type "donut" | "treemap"
"donut"
Shape shown on mount.
defaultColorBy
Type "allocation" | "change"
"allocation"
Shade by size, or green and red by day change.
currency
Type string
"USD"
ISO currency code for values.
duration
Type number
0.6
How long the morph takes.
width
Type number
460
Width of the card; never wider than its container.
holdings
Type { 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
Type "donut" | "treemap"
–
Shape shown, controlled.
colorBy / onColorByChange
Type "allocation" | "change"
–
Colouring, controlled.
className
Type string
–
Classes for the wrapper.