Skip to main content

Treemap

Part-to-whole where parts vary by orders of magnitude. Squarified layout; labels carry the precision.

Signature
Density
Viewport
Theme and light/dark are set in the top bar
Live demo
Open ↗

When to use​

Part-to-whole where parts vary by orders of magnitude.

Accessibility​

Each chart ships an accessible fallback (a visually-hidden data table / aria-label summary) so the data is available to screen readers, not just sighted users. Colour is paired with shape/label, never used alone.

Install and import​

npx shadcn@latest add @prism/treemap
import { Treemap } from '@/components/prism/Treemap';

In a no-build prototype, read it from the bundle instead: const { Treemap } = window.PrismDesignSystem_39d121;

Props​

PropTypeRequiredDescription
itemsTreemapItem[]Yes
heightnumber—
formatValue(value: number) => React.ReactNode—
showShareboolean—Append each tile's share of the total. Default true.
captionstring—
classNamestring—