Updated
Portfolio Allocation
ProCustomize
Color
donut
Allocation
Duration0.60s
Width460px
Installation
ProPortfolio 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
- 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}" } } } } - Put your key in
.env.localand add that file to.gitignore:.env.local UIBRIK_LICENSE=your-license-key - Install it:
Terminal npx shadcn@latest add @uibrik-pro/portfolio-allocation
Loading your installation…
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.