DocumentationNuxt Charts v3

Category Distribution

A component to visualize categorical data

Use CategoryDistribution to display a value and its category shares. It requires Vue and Tailwind CSS and inherits Nuxt UI colors when available. Colors, values, and trend direction come from your data.

Example

Here's an example of the CategoryDistribution in action, monitoring a fictional marketing service.

100+8.2%
Marketing
Sales
Development
Support
Learn how to use the Nuxt Charts CLI to get premium components.

Props

PropTypeDefaultDescription
primaryValuestring | number—The main value to display
gap'sm' | 'lg' | 'xl''sm'Spacing between segments.
categoriesCategoryItem[]—Array of category items
trendTrendIndicator—Optional trend indicator object
legendClassstring''Additional classes for the legend
showFullLabelbooleantrueShow full label instead of truncated
titlestringundefinedOptional heading.
showLegendbooleantrueShow category labels.
showTooltipbooleantrueShow native segment tooltips.
tooltipFormatter(category) => stringLabel and value or percentageCustom tooltip text.

Category items have label, percentage, color, and an optional value. Colors accept CSS variables, such as var(--ui-primary). Shares are normalized across the available bar width, with gaps accounted for.

Use the header slot to replace the value and trend; it receives value and trend. The legend slot receives category and index for each item.