# PercentageBarChart

**📖 Live documentation:** https://cds.coinbase.com/components/charts/PercentageBarChart/

A bar chart component for comparing share or mix across categories as percentages. Supports horizontal and vertical orientations, 100% stacked bars, and a fixed 0–100% value axis.

## Import

```tsx
import { PercentageBarChart } from '@coinbase/cds-web/visualizations/chart'
```

## Examples

PercentageBarChart is a wrapper for [BarChart](/components/charts/BarChart) that simplifies the creation of segmented, part-to-whole horizontal visualizations. Charts are built using SVGs.

### Basics

The only prop required is `series`, which takes an array of series objects. Each series object needs an `id` and a value for `data`.

```jsx live
<PercentageBarChart
  height={16}
  series={[
    { id: 'a', data: 70, label: 'Segment A', color: 'var(--color-fgPositive)' },
    { id: 'b', data: 45, label: 'Segment B', color: 'var(--color-fgNegative)' },
  ]}
/>
```

### Stack Gap

Use `stackGap` to add space between segments while keeping the full bar length.

```jsx live
<PercentageBarChart
  height={20}
  series={[
    { id: 'a', data: 40, label: 'A', color: 'var(--color-fgPositive)' },
    { id: 'b', data: 35, label: 'B', color: 'var(--color-fgWarning)' },
    { id: 'c', data: 20, label: 'C', color: 'var(--color-accentBoldPurple)' },
  ]}
  stackGap={6}
/>
```

### Border Radius

Bars use `borderRadius` like in [BarChart](/components/charts/BarChart/#border-radius).

```jsx live
<PercentageBarChart
  borderRadius={1000}
  height={28}
  series={[
    { id: 'a', data: 45, color: 'rgb(var(--purple30))', label: 'A' },
    { id: 'b', data: 30, color: 'rgb(var(--blue30))', label: 'B' },
    { id: 'c', data: 20, color: 'rgb(var(--teal30))', label: 'C' },
  ]}
  stackGap={2}
/>
```

### Data

**Negative** values, **`null`**, and **missing indices** from a shorter `data` array are treated as **zero** for that segment at that category. A **single-number** `data` value applies to the **first** category only—later categories count as zero for that series.

```jsx live
<PercentageBarChart
  height={100}
  showXAxis
  showYAxis
  barMinSize={12}
  borderRadius={8}
  series={[
    { id: 'a', data: [40, null, 20], label: 'A', color: 'var(--color-fgPositive)' },
    { id: 'b', data: [-10, 60, 30], label: 'B', color: 'var(--color-fgWarning)' },
    { id: 'c', data: [null, 50], label: 'C', color: 'var(--color-fgMuted)' },
    { id: 'd', data: 45, label: 'D', color: 'var(--color-fgNegative)' },
  ]}
  stackGap={2}
  xAxis={{ showTickMarks: true }}
  yAxis={{
    data: ['Q1', 'Q2', 'Q3'],
    position: 'left',
    categoryPadding: 0.45,
  }}
/>
```

If **every** group sums to zero after clamping, nothing is drawn—handle that in surrounding UI (empty state or copy).

### Customization

#### Bar Stack Spacing

Use `categoryPadding` on the band axis to adjust spacing between stacks.

```jsx live
<PercentageBarChart
  legend
  showXAxis
  showYAxis
  barMinSize={18}
  borderRadius={24}
  height={240}
  series={[
    { id: 'a', data: [55, 40, 35], label: 'A', color: 'var(--color-fgWarning)' },
    { id: 'b', data: [30, 45, 25], label: 'B', color: 'var(--color-accentBoldPurple)' },
    { id: 'c', data: [15, 15, 40], label: 'C', color: 'var(--color-fgMuted)' },
  ]}
  stackGap={4}
  xAxis={{ showTickMarks: true }}
  yAxis={{
    data: ['Q1', 'Q2', 'Q3'],
    position: 'left',
    categoryPadding: 0.7,
  }}
/>
```

#### Minimum Bar Size

`barMinSize` enforces a minimum pixel size for **individual** segments (non-zero values), similar to `BarChart`. Use it when a small share would otherwise be too narrow to see or interact with:

```jsx live
<PercentageBarChart
  barMinSize={16}
  height={16}
  series={[
    { id: 'a', data: 99, label: 'Segment A', color: 'var(--color-fgPositive)' },
    { id: 'b', data: 0.001, label: 'Segment B', color: 'var(--color-fgNegative)' },
  ]}
  stackGap={2}
/>
```

#### Custom Components

##### Slanted Stack Gap

A custom `BarComponent` that replaces the default rectangular inner edges with **slanted cuts**, creating a parallelogram-shaped gap purely from the path geometry—no `stackGap` needed. Outer ends stay pill-shaped.

```jsx live
function SlantedStackExample() {
  function getSlantedHorizontalBarPath(
    x,
    y,
    width,
    height,
    borderRadius,
    pillLeft,
    pillRight,
    slantDx,
  ) {
    if (width <= 0 || height <= 0 || pillLeft === pillRight) return undefined;

    const r = Math.min(borderRadius, height / 2, width / 2);
    const s = Math.min(Math.max(0, slantDx), width - r * 2);
    const x0 = x,
      x1 = x + width,
      y0 = y,
      y1 = y + height;

    if (pillLeft && !pillRight) {
      return [
        `M ${x0 + r} ${y0}`,
        `L ${x1} ${y0}`,
        `L ${x1 - s} ${y1}`,
        `L ${x0 + r} ${y1}`,
        `A ${r} ${r} 0 0 1 ${x0} ${y1 - r}`,
        `L ${x0} ${y0 + r}`,
        `A ${r} ${r} 0 0 1 ${x0 + r} ${y0}`,
        'Z',
      ].join(' ');
    }

    return [
      `M ${x0 + s} ${y0}`,
      `L ${x1 - r} ${y0}`,
      `A ${r} ${r} 0 0 1 ${x1} ${y0 + r}`,
      `L ${x1} ${y1 - r}`,
      `A ${r} ${r} 0 0 1 ${x1 - r} ${y1}`,
      `L ${x0} ${y1}`,
      'Z',
    ].join(' ');
  }

  const SLANT_DX = 8;

  const SlantedStackBar = memo(function SlantedStackBar(props) {
    const { layout } = useCartesianChartContext();
    const {
      x,
      y,
      width,
      height,
      borderRadius = 4,
      roundTop,
      roundBottom,
      dataX,
      d: defaultD,
      fill,
      fillOpacity,
      ...rest
    } = props;

    const d = useMemo(() => {
      if (layout !== 'horizontal') {
        return (
          defaultD ??
          getBarPath(x, y, width, height, borderRadius, !!roundTop, !!roundBottom, layout)
        );
      }
      const isLeftmost = Array.isArray(dataX) && Math.abs(dataX[0]) < 1;
      return (
        getSlantedHorizontalBarPath(
          x,
          y,
          width,
          height,
          borderRadius,
          isLeftmost,
          !isLeftmost,
          SLANT_DX,
        ) ??
        defaultD ??
        getBarPath(x, y, width, height, borderRadius, !!roundTop, !!roundBottom, layout)
      );
    }, [layout, defaultD, dataX, x, y, width, height, borderRadius, roundTop, roundBottom]);

    if (!d) return null;

    return (
      <Path
        {...rest}
        animate
        clipRect={null}
        d={d}
        fill={fill}
        fillOpacity={fillOpacity}
        transitions={props.transitions}
      />
    );
  });

  return (
    <PercentageBarChart
      animate={false}
      BarComponent={SlantedStackBar}
      barMinSize={12}
      borderRadius={24}
      height={12}
      series={[
        { id: 'team-a', data: 40, color: 'rgb(var(--teal60))' },
        { id: 'team-b', data: 61, color: 'var(--color-accentBoldBlue)' },
      ]}
    />
  );
}
```

##### Dotted bar

A custom `BarComponent` can render a **dotted fill** (SVG pattern mask plus outline). Set `BarComponent` on **one series** to emphasize a single segment, or on the **chart** to apply the same look to every segment.

```jsx live
function DottedBarExamples() {
  const DOTTED_BAR_OUTLINE_STROKE_WIDTH = 2;

  const DottedBarComponent = memo((props) => {
    const {
      dataX,
      x,
      y,
      width,
      height,
      borderRadius = 4,
      roundTop = true,
      roundBottom = true,
    } = props;
    const { layout } = useCartesianChartContext();
    const patternSize = 4;
    const dotSize = 1;
    const patternId = useId();
    const maskId = useId();
    const outlineInset = DOTTED_BAR_OUTLINE_STROKE_WIDTH / 2;

    const outlineGeometry = useMemo(() => {
      const insetWidth = width - 2 * outlineInset;
      const insetHeight = height - 2 * outlineInset;
      if (insetWidth <= 0 || insetHeight <= 0) {
        return null;
      }
      const insetX = x + outlineInset;
      const insetY = y + outlineInset;
      const insetRadius = Math.max(0, borderRadius - outlineInset);
      return {
        d: getBarPath(
          insetX,
          insetY,
          insetWidth,
          insetHeight,
          insetRadius,
          roundTop,
          roundBottom,
          layout,
        ),
        height: insetHeight,
        width: insetWidth,
        x: insetX,
        y: insetY,
      };
    }, [borderRadius, height, layout, outlineInset, roundBottom, roundTop, width, x, y]);

    const uniqueMaskId = `${maskId}-${dataX}`;
    const uniquePatternId = `${patternId}-${dataX}`;
    return (
      <>
        <defs>
          <pattern
            height={patternSize}
            id={uniquePatternId}
            patternUnits="userSpaceOnUse"
            width={patternSize}
            x={x}
            y={y}
          >
            <circle cx={patternSize / 2} cy={patternSize / 2} fill="white" r={dotSize} />
          </pattern>
          <mask id={uniqueMaskId}>
            <DefaultBar {...props} fill={`url(#${uniquePatternId})`} />
          </mask>
        </defs>
        <g mask={`url(#${uniqueMaskId})`}>
          <DefaultBar {...props} />
        </g>
        {outlineGeometry ? (
          <DefaultBar
            {...props}
            {...outlineGeometry}
            fill="transparent"
            stroke={props.fill}
            strokeWidth={DOTTED_BAR_OUTLINE_STROKE_WIDTH}
          />
        ) : (
          <DefaultBar
            {...props}
            fill="transparent"
            stroke={props.fill}
            strokeWidth={DOTTED_BAR_OUTLINE_STROKE_WIDTH}
          />
        )}
      </>
    );
  });

  const dottedBarSeries = [
    {
      id: 'segment-a',
      data: 60,
      label: 'Segment A',
      color: 'rgb(var(--teal60))',
      BarComponent: DottedBarComponent,
    },
    { id: 'segment-b', data: 30, label: 'Segment B', color: 'rgb(var(--chartreuse50))' },
    { id: 'segment-c', data: 10, label: 'Segment C', color: 'rgb(var(--indigo40))' },
  ];

  const dottedBarSeriesPlain = [
    { id: 'segment-a', data: 60, label: 'Segment A', color: 'rgb(var(--teal60))' },
    { id: 'segment-b', data: 30, label: 'Segment B', color: 'rgb(var(--chartreuse50))' },
    { id: 'segment-c', data: 10, label: 'Segment C', color: 'rgb(var(--indigo40))' },
  ];

  return (
    <VStack gap={3}>
      <VStack gap={1}>
        <Text color="fgMuted" font="label2">
          First series only
        </Text>
        <PercentageBarChart barMinSize={24} height={24} series={dottedBarSeries} stackGap={4} />
      </VStack>
      <VStack gap={1}>
        <Text color="fgMuted" font="label2">
          Chart-level BarComponent
        </Text>
        <PercentageBarChart
          BarComponent={DottedBarComponent}
          barMinSize={24}
          height={24}
          series={dottedBarSeriesPlain}
          stackGap={4}
        />
      </VStack>
    </VStack>
  );
}
```

### Animations

Configure motion with the `transitions` prop (forwarded to `BarChart`). Toggle motion with `animate`.

```jsx live
function AnimationsExample() {
  const [animate, setAnimate] = useState(true);

  function randomShares() {
    const raw = [Math.random() + 0.1, Math.random() + 0.1, Math.random() + 0.1];
    const sum = raw[0] + raw[1] + raw[2];
    return raw.map((v) => Math.max(1, Math.round((v / sum) * 100)));
  }

  function generateData() {
    return [randomShares(), randomShares(), randomShares()];
  }

  const [data, setData] = useState(generateData);

  useEffect(() => {
    const id = setInterval(() => setData(generateData()), 800);
    return () => clearInterval(id);
  }, []);

  const series = [
    { id: 'btc', data: data.map((q) => q[0]), label: 'BTC', color: assets.btc.color },
    {
      id: 'eth',
      data: data.map((q) => q[1]),
      label: 'ETH',
      color: assets.eth.color,
    },
    {
      id: 'other',
      data: data.map((q) => q[2]),
      label: 'Other',
      color: 'var(--color-fgMuted)',
    },
  ];

  return (
    <VStack gap={2}>
      <HStack justifyContent="flex-end" alignItems="center" gap={1}>
        <Switch checked={animate} onChange={() => setAnimate((v) => !v)}>
          Animate
        </Switch>
      </HStack>
      <PercentageBarChart
        animate={animate}
        legend
        showXAxis
        showYAxis
        barMinSize={14}
        borderRadius={48}
        height={220}
        inset={{ left: 24, right: 0, top: 0, bottom: 0 }}
        legendPosition="top"
        transitions={{
          enter: { type: 'tween', staggerDelay: 0.5 },
          update: { type: 'tween' },
        }}
        series={series}
        stackGap={2}
        xAxis={{
          showTickMarks: true,
          tickLabelFormatter: (value) => `${value}%`,
        }}
        yAxis={{
          categoryPadding: 0.75,
          data: ['Q1 2025', 'Q2 2025', 'Q3 2025'],
          position: 'left',
          requestedTickCount: 5,
          showTickMarks: true,
        }}
      />
    </VStack>
  );
}
```

### Composed Examples

#### Live-updating Data

Using a custom legend, you can create a prediction markets-style chart that stays in sync when data changes.

```jsx live
function LiveFeedExample() {
  const liveFeedSubtitleBase = 100;
  const liveFeedYesDollarsPerPercentPoint = (182 - liveFeedSubtitleBase) / 50;
  const liveFeedNoDollarsPerPercentPoint = (222 - liveFeedSubtitleBase) / 50;

  function getLiveFeedProjectedValue(seriesId, percentage) {
    const inverseShare = 100 - percentage;
    if (seriesId === 'yes') {
      return Math.round(liveFeedSubtitleBase + inverseShare * liveFeedYesDollarsPerPercentPoint);
    }
    if (seriesId === 'no') {
      return Math.round(liveFeedSubtitleBase + inverseShare * liveFeedNoDollarsPerPercentPoint);
    }
    return undefined;
  }

  const liveFeedCurrencyFormat = {
    style: 'currency',
    currency: 'USD',
    maximumFractionDigits: 0,
  };

  const LiveFeedCTALegendEntry = memo(function LiveFeedCTALegendEntry({ seriesId, label, color }) {
    const { series } = useCartesianChartContext();
    const seriesData = series.find((s) => s.id === seriesId);
    const percentage = seriesData?.data?.[0] ?? 0;
    const projectedValue = getLiveFeedProjectedValue(seriesId, percentage);

    return (
      <Button
        compact
        borderRadius={200}
        style={{ backgroundColor: color, borderColor: color }}
        width="25%"
      >
        <VStack alignItems="center" gap={0.25}>
          <HStack alignItems="center" gap={0.5}>
            <Text color="fgInverse" font="label1">
              {label} {'· '}
            </Text>
            <RollingNumber
              color="fgInverse"
              font="label1"
              format={{ style: 'percent', maximumFractionDigits: 0 }}
              value={percentage / 100}
            />
          </HStack>
          {projectedValue != null && (
            <HStack alignItems="center" gap={0.5}>
              <Text color="fgInverse" font="legal">
                ${liveFeedSubtitleBase} →
              </Text>
              <RollingNumber
                color="fgInverse"
                font="legal"
                format={liveFeedCurrencyFormat}
                value={projectedValue}
              />
            </HStack>
          )}
        </VStack>
      </Button>
    );
  });

  function LiveFeedChart() {
    const [tick, setTick] = useState(0);

    const yesValue = 50 + Math.sin(tick * 0.05) * 49;
    const noValue = 50 - Math.sin(tick * 0.05) * 49;

    const series = [
      { id: 'yes', data: yesValue, label: 'Yes', color: 'var(--color-fgPositive)' },
      { id: 'no', data: noValue, label: 'No', color: 'var(--color-fgNegative)' },
    ];

    useEffect(() => {
      const id = setInterval(() => setTick((t) => t + 4), 1000);
      return () => clearInterval(id);
    }, []);

    return (
      <PercentageBarChart
        barMinSize={16}
        borderRadius={1000}
        height={64}
        legend={
          <Legend
            EntryComponent={LiveFeedCTALegendEntry}
            justifyContent="space-evenly"
            paddingTop={1}
          />
        }
        legendPosition="bottom"
        series={series}
        stackGap={2}
      />
    );
  }

  return <LiveFeedChart />;
}
```

#### Vertical Mix

Monthly **BTC / ETH / Other** portfolio allocation across a full year, with `layout="vertical"` and the legend on the right.

```jsx live
<PercentageBarChart
  legend
  showXAxis
  showYAxis
  barMinSize={28}
  borderRadius={48}
  height={240}
  layout="vertical"
  legendPosition="right"
  series={[
    {
      id: 'btc',
      data: [55, 52, 48, 45, 50, 58, 62, 57, 53, 49, 44, 46],
      label: 'BTC',
      color: assets.btc.color,
    },
    {
      id: 'eth',
      data: [30, 33, 35, 38, 32, 27, 25, 29, 34, 37, 40, 38],
      label: 'ETH',
      color: assets.eth.color,
    },
    {
      id: 'other',
      data: [15, 15, 17, 17, 18, 15, 13, 14, 13, 14, 16, 16],
      label: 'Other',
      color: 'var(--color-fgMuted)',
    },
  ]}
  stackGap={1}
  xAxis={{
    categoryPadding: 0.5,
    data: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
    position: 'bottom',
    showTickMarks: true,
  }}
/>
```

#### Buy vs Sell

You can combine a PercentageBarChart with a custom legend to create a buy vs sell chart.

```jsx live
function BuyVsSellExample() {
  const series = [
    { id: 'buy', data: 76, color: 'var(--color-fgPositive)', legendShape: 'circle' },
    { id: 'sell', data: 24, color: 'var(--color-fgNegative)', legendShape: 'square' },
  ];

  function BuyVsSellLegend() {
    const [buy, sell] = series;
    return (
      <HStack gap={1} justifyContent="space-between">
        <DefaultLegendEntry
          color={buy.color}
          label={
            <Text color="fgMuted" font="legal">
              {`${buy.data}% bought`}
            </Text>
          }
          seriesId={buy.id}
          shape={buy.legendShape}
        />
        <DefaultLegendEntry
          color={sell.color}
          label={
            <Text color="fgMuted" font="legal">
              {`${sell.data}% sold`}
            </Text>
          }
          seriesId={sell.id}
          shape={sell.legendShape}
        />
      </HStack>
    );
  }

  return (
    <VStack gap={1.5}>
      <PercentageBarChart
        barMinSize={8}
        borderRadius={24}
        height={8}
        series={series}
        stackGap={4}
      />
      <BuyVsSellLegend />
    </VStack>
  );
}
```

## Props

| Prop | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `BarComponent` | `BarComponent` | No | `-` | Component to render the bar. |
| `BarStackComponent` | `BarStackComponent` | No | `DefaultBarStack` | Custom component to render the stack container. Can be used to add clip paths, outlines, or other custom styling. |
| `alignContent` | `ResponsiveProp<center \| normal \| start \| end \| flex-start \| flex-end \| stretch \| baseline \| first baseline \| last baseline \| space-between \| space-around \| space-evenly>` | No | `-` | - |
| `alignItems` | `ResponsiveProp<center \| normal \| start \| end \| flex-start \| flex-end \| self-start \| self-end \| stretch \| baseline \| first baseline \| last baseline>` | No | `-` | - |
| `alignSelf` | `ResponsiveProp<center \| normal \| auto \| start \| end \| flex-start \| flex-end \| self-start \| self-end \| stretch \| baseline \| first baseline \| last baseline>` | No | `-` | - |
| `animate` | `boolean` | No | `true` | Whether to animate the chart. |
| `as` | `div` | No | `-` | The underlying element or component the polymorphic component will render.  Changing as also changes the inherited native props (e.g. href for as=a) and the expected ref type. |
| `aspectRatio` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto \| ResponsiveValue<AspectRatio \| undefined>` | No | `-` | - |
| `background` | `currentColor \| fg \| fgMuted \| fgInverse \| fgPrimary \| fgWarning \| fgPositive \| fgNegative \| bg \| bgAlternate \| bgInverse \| bgOverlay \| bgElevation1 \| bgElevation2 \| bgPrimary \| bgPrimaryWash \| bgSecondary \| bgTertiary \| bgSecondaryWash \| bgNegative \| bgNegativeWash \| bgPositive \| bgPositiveWash \| bgWarning \| bgWarningWash \| bgLine \| bgLineHeavy \| bgLineInverse \| bgLinePrimary \| bgLinePrimarySubtle \| accentSubtleRed \| accentBoldRed \| accentSubtleGreen \| accentBoldGreen \| accentSubtleBlue \| accentBoldBlue \| accentSubtlePurple \| accentBoldPurple \| accentSubtleYellow \| accentBoldYellow \| accentSubtleGray \| accentBoldGray \| transparent \| ResponsiveValue<Color \| undefined>` | No | `-` | - |
| `barMinSize` | `number` | No | `-` | Minimum size for individual bars in the stack. |
| `barPadding` | `number` | No | `0.1` | Padding between bar groups (0-1). |
| `borderBottomWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| ResponsiveValue<BorderWidth \| undefined>` | No | `-` | - |
| `borderColor` | `currentColor \| fg \| fgMuted \| fgInverse \| fgPrimary \| fgWarning \| fgPositive \| fgNegative \| bg \| bgAlternate \| bgInverse \| bgOverlay \| bgElevation1 \| bgElevation2 \| bgPrimary \| bgPrimaryWash \| bgSecondary \| bgTertiary \| bgSecondaryWash \| bgNegative \| bgNegativeWash \| bgPositive \| bgPositiveWash \| bgWarning \| bgWarningWash \| bgLine \| bgLineHeavy \| bgLineInverse \| bgLinePrimary \| bgLinePrimarySubtle \| accentSubtleRed \| accentBoldRed \| accentSubtleGreen \| accentBoldGreen \| accentSubtleBlue \| accentBoldBlue \| accentSubtlePurple \| accentBoldPurple \| accentSubtleYellow \| accentBoldYellow \| accentSubtleGray \| accentBoldGray \| transparent \| ResponsiveValue<Color \| undefined>` | No | `-` | - |
| `borderEndWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| ResponsiveValue<BorderWidth \| undefined>` | No | `-` | - |
| `borderRadius` | `number` | No | `4` | Border radius for the bar. |
| `borderStartWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| ResponsiveValue<BorderWidth \| undefined>` | No | `-` | - |
| `borderTopWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| ResponsiveValue<BorderWidth \| undefined>` | No | `-` | - |
| `borderWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| ResponsiveValue<BorderWidth \| undefined>` | No | `-` | - |
| `bordered` | `boolean` | No | `-` | Add a border around all sides of the box. |
| `borderedBottom` | `boolean` | No | `-` | Add a border to the bottom side of the box. |
| `borderedEnd` | `boolean` | No | `-` | Add a border to the trailing side of the box. |
| `borderedHorizontal` | `boolean` | No | `-` | Add a border to the leading and trailing sides of the box. |
| `borderedStart` | `boolean` | No | `-` | Add a border to the leading side of the box. |
| `borderedTop` | `boolean` | No | `-` | Add a border to the top side of the box. |
| `borderedVertical` | `boolean` | No | `-` | Add a border to the top and bottom sides of the box. |
| `bottom` | `ResponsiveProp<Bottom<string \| number>>` | No | `-` | - |
| `classNames` | `{ root?: string; chart?: string \| undefined; } \| undefined` | No | `-` | Custom class names for the component. |
| `color` | `currentColor \| fg \| fgMuted \| fgInverse \| fgPrimary \| fgWarning \| fgPositive \| fgNegative \| bg \| bgAlternate \| bgInverse \| bgOverlay \| bgElevation1 \| bgElevation2 \| bgPrimary \| bgPrimaryWash \| bgSecondary \| bgTertiary \| bgSecondaryWash \| bgNegative \| bgNegativeWash \| bgPositive \| bgPositiveWash \| bgWarning \| bgWarningWash \| bgLine \| bgLineHeavy \| bgLineInverse \| bgLinePrimary \| bgLinePrimarySubtle \| accentSubtleRed \| accentBoldRed \| accentSubtleGreen \| accentBoldGreen \| accentSubtleBlue \| accentBoldBlue \| accentSubtlePurple \| accentBoldPurple \| accentSubtleYellow \| accentBoldYellow \| accentSubtleGray \| accentBoldGray \| transparent \| ResponsiveValue<Color \| undefined>` | No | `-` | - |
| `columnGap` | `0 \| 1 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9 \| ResponsiveValue<Space \| undefined>` | No | `-` | - |
| `dangerouslySetBackground` | `string` | No | `-` | - |
| `display` | `ResponsiveProp<grid \| revert \| none \| block \| inline \| inline-block \| flex \| inline-flex \| inline-grid \| contents \| flow-root \| list-item>` | No | `-` | - |
| `elevation` | `0 \| 1 \| 2 \| ResponsiveValue<Elevation \| undefined>` | No | `-` | - |
| `fillOpacity` | `number` | No | `-` | Fill opacity for the bar. |
| `flexBasis` | `ResponsiveProp<FlexBasis<string \| number>>` | No | `-` | - |
| `flexDirection` | `ResponsiveProp<column \| row \| row-reverse \| column-reverse>` | No | `-` | - |
| `flexGrow` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| ResponsiveValue<FlexGrow \| undefined>` | No | `-` | - |
| `flexShrink` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| ResponsiveValue<FlexShrink \| undefined>` | No | `-` | - |
| `flexWrap` | `ResponsiveProp<nowrap \| wrap \| wrap-reverse>` | No | `-` | - |
| `font` | `ResponsiveProp<FontFamily \| inherit>` | No | `-` | - |
| `fontFamily` | `ResponsiveProp<FontFamily \| inherit>` | No | `-` | - |
| `fontSize` | `ResponsiveProp<FontSize \| inherit>` | No | `-` | - |
| `fontWeight` | `ResponsiveProp<FontWeight \| inherit>` | No | `-` | - |
| `gap` | `0 \| 1 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9 \| ResponsiveValue<Space \| undefined>` | No | `-` | - |
| `grid` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| none \| ResponsiveValue<Grid \| undefined>` | No | `-` | - |
| `gridArea` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto \| ResponsiveValue<GridArea \| undefined>` | No | `-` | - |
| `gridAutoColumns` | `ResponsiveProp<GridAutoColumns<string \| number>>` | No | `-` | - |
| `gridAutoFlow` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| column \| dense \| row \| ResponsiveValue<GridAutoFlow \| undefined>` | No | `-` | - |
| `gridAutoRows` | `ResponsiveProp<GridAutoRows<string \| number>>` | No | `-` | - |
| `gridColumn` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto \| ResponsiveValue<GridColumn \| undefined>` | No | `-` | - |
| `gridColumnEnd` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto \| ResponsiveValue<GridColumnEnd \| undefined>` | No | `-` | - |
| `gridColumnStart` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto \| ResponsiveValue<GridColumnStart \| undefined>` | No | `-` | - |
| `gridRow` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto \| ResponsiveValue<GridRow \| undefined>` | No | `-` | - |
| `gridRowEnd` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto \| ResponsiveValue<GridRowEnd \| undefined>` | No | `-` | - |
| `gridRowStart` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto \| ResponsiveValue<GridRowStart \| undefined>` | No | `-` | - |
| `gridTemplate` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| none \| ResponsiveValue<GridTemplate \| undefined>` | No | `-` | - |
| `gridTemplateAreas` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| none \| ResponsiveValue<GridTemplateAreas \| undefined>` | No | `-` | - |
| `gridTemplateColumns` | `ResponsiveProp<GridTemplateColumns<string \| number>>` | No | `-` | - |
| `gridTemplateRows` | `ResponsiveProp<GridTemplateRows<string \| number>>` | No | `-` | - |
| `height` | `ResponsiveProp<Height<string \| number>>` | No | `-` | - |
| `inset` | `number \| Partial<ChartInset>` | No | `0` | Inset around the entire chart (outside the axes). |
| `justifyContent` | `ResponsiveProp<left \| right \| center \| normal \| start \| end \| flex-start \| flex-end \| stretch \| space-between \| space-around \| space-evenly>` | No | `-` | - |
| `key` | `Key \| null` | No | `-` | - |
| `layout` | `horizontal \| vertical` | No | `'horizontal'` | Chart layout - describes the direction bars/areas grow. - vertical: Bars grow vertically. X is category axis, Y is value axis. - horizontal (default): Bars grow horizontally. Y is category axis, X is value axis. |
| `left` | `ResponsiveProp<Left<string \| number>>` | No | `-` | - |
| `legend` | `null \| string \| number \| bigint \| false \| true \| ReactElement<unknown, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal \| Promise<AwaitedReactNode>` | No | `-` | Whether to show the legend or a custom legend element. - true renders the default Legend component - A React element renders that element as the legend - false or omitted hides the legend |
| `legendAccessibilityLabel` | `string` | No | `'Legend'` | Accessibility label for the legend group. |
| `legendPosition` | `top \| bottom \| left \| right` | No | `'bottom'` | Position of the legend relative to the chart. |
| `lineHeight` | `ResponsiveProp<LineHeight \| inherit>` | No | `-` | - |
| `margin` | `ResponsiveProp<0 \| -1 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
| `marginBottom` | `ResponsiveProp<0 \| -1 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
| `marginEnd` | `ResponsiveProp<0 \| -1 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
| `marginStart` | `ResponsiveProp<0 \| -1 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
| `marginTop` | `ResponsiveProp<0 \| -1 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
| `marginX` | `ResponsiveProp<0 \| -1 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
| `marginY` | `ResponsiveProp<0 \| -1 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
| `maxHeight` | `ResponsiveProp<MaxHeight<string \| number>>` | No | `-` | - |
| `maxWidth` | `ResponsiveProp<MaxWidth<string \| number>>` | No | `-` | - |
| `minHeight` | `ResponsiveProp<MinHeight<string \| number>>` | No | `-` | - |
| `minWidth` | `ResponsiveProp<MinWidth<string \| number>>` | No | `-` | - |
| `onChange` | `FormEventHandler<HTMLDivElement>` | No | `-` | - |
| `opacity` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| ResponsiveValue<Opacity \| undefined>` | No | `-` | - |
| `overflow` | `ResponsiveProp<hidden \| auto \| visible \| clip \| scroll>` | No | `-` | - |
| `padding` | `0 \| 1 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9 \| ResponsiveValue<Space \| undefined>` | No | `-` | - |
| `paddingBottom` | `0 \| 1 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9 \| ResponsiveValue<Space \| undefined>` | No | `-` | - |
| `paddingEnd` | `0 \| 1 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9 \| ResponsiveValue<Space \| undefined>` | No | `-` | - |
| `paddingStart` | `0 \| 1 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9 \| ResponsiveValue<Space \| undefined>` | No | `-` | - |
| `paddingTop` | `0 \| 1 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9 \| ResponsiveValue<Space \| undefined>` | No | `-` | - |
| `paddingX` | `0 \| 1 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9 \| ResponsiveValue<Space \| undefined>` | No | `-` | - |
| `paddingY` | `0 \| 1 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9 \| ResponsiveValue<Space \| undefined>` | No | `-` | - |
| `pin` | `top \| bottom \| left \| right \| all` | No | `-` | Direction in which to absolutely pin the box. |
| `position` | `ResponsiveProp<fixed \| static \| relative \| absolute \| sticky>` | No | `-` | - |
| `ref` | `null \| RefObject<HTMLButtonElement \| null> \| (instance: HTMLButtonElement \| null) => void \| (() => VoidOrUndefinedOnly)` | No | `-` | Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref). |
| `right` | `ResponsiveProp<Right<string \| number>>` | No | `-` | - |
| `roundBaseline` | `boolean` | No | `true` | Whether to round the baseline of a bar (where the value is 0). |
| `rowGap` | `0 \| 1 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9 \| ResponsiveValue<Space \| undefined>` | No | `-` | - |
| `series` | `PercentageBarSeries[]` | No | `-` | Configuration objects that define how to visualize the data. Each series contains its own data. |
| `showXAxis` | `boolean` | No | `-` | Whether to show the X axis. |
| `showYAxis` | `boolean` | No | `-` | Whether to show the Y axis. |
| `stackGap` | `number` | No | `-` | Gap between bars in the stack. |
| `stackMinSize` | `number` | No | `-` | Minimum size for the entire stack. |
| `stroke` | `string` | No | `-` | Stroke color for the bar outline. |
| `strokeWidth` | `number` | No | `-` | Stroke width for the bar outline. |
| `style` | `CSSProperties` | No | `-` | Custom styles for the root element. |
| `styles` | `{ root?: CSSProperties; chart?: CSSProperties \| undefined; } \| undefined` | No | `-` | Custom styles for the component. |
| `testID` | `string` | No | `-` | Used to locate this element in unit and end-to-end tests. Under the hood, testID translates to data-testid on Web. On Mobile, testID stays the same - testID |
| `textAlign` | `ResponsiveProp<center \| start \| end \| justify>` | No | `-` | - |
| `textDecoration` | `ResponsiveProp<none \| underline \| overline \| line-through \| underline overline \| underline double>` | No | `-` | - |
| `textTransform` | `ResponsiveProp<capitalize \| lowercase \| none \| uppercase>` | No | `-` | - |
| `top` | `ResponsiveProp<Top<string \| number>>` | No | `-` | - |
| `transform` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| none \| ResponsiveValue<Transform \| undefined>` | No | `-` | - |
| `transition` | `Orchestration & Repeat & Tween \| Orchestration & Repeat & Spring \| Orchestration & Repeat & Keyframes \| Orchestration & Repeat & Inertia \| Orchestration & Repeat & Just \| Orchestration & Repeat & None \| Orchestration & Repeat & PermissiveTransitionDefinition \| Orchestration & Repeat & Tween & { [key: string]: TransitionDefinition; } \| Orchestration & Repeat & Spring & { [key: string]: TransitionDefinition; } \| Orchestration & Repeat & Keyframes & { [key: string]: TransitionDefinition; } \| Orchestration & Repeat & Inertia & { [key: string]: TransitionDefinition; } \| Orchestration & Repeat & Just & { [key: string]: TransitionDefinition; } \| Orchestration & Repeat & None & { [key: string]: TransitionDefinition; } \| Orchestration & Repeat & PermissiveTransitionDefinition & { [key: string]: TransitionDefinition; }` | No | `-` | Transition for updates. |
| `transitions` | `{ enter?: BarTransition \| null; enterOpacity?: BarTransition \| null \| undefined; update?: BarTransition \| null \| undefined; } \| undefined` | No | `transitions = {{ enter: { type: 'spring', stiffness: 900, damping: 120, mass: 4, staggerDelay: 0.25 }, enterOpacity: { type: 'tween', duration: 0.2 }, update: { type: 'spring', stiffness: 900, damping: 120, mass: 4 } }}` | Transition configuration for enter and update animations. |
| `userSelect` | `ResponsiveProp<text \| none \| auto \| all>` | No | `-` | - |
| `visibility` | `ResponsiveProp<hidden \| visible>` | No | `-` | - |
| `width` | `ResponsiveProp<Width<string \| number>>` | No | `-` | - |
| `xAxis` | `(Partial<CartesianAxisConfigProps> & SharedProps & { bandGridLinePlacement?: AxisBandPlacement; bandTickMarkPlacement?: AxisBandPlacement \| undefined; label?: string \| undefined; labelGap?: number \| undefined; minTickLabelGap?: number \| undefined; requestedTickCount?: number \| undefined; showGrid?: boolean \| undefined; showLine?: boolean \| undefined; showTickMarks?: boolean \| undefined; tickMarkSize?: number \| undefined; ticks?: number[] \| ((value: number) => boolean) \| undefined; tickMarkLabelGap?: number \| undefined; tickInterval?: number \| undefined; tickMinStep?: number \| undefined; tickMaxStep?: number \| undefined; } & { className?: string \| undefined; classNames?: { root?: string \| undefined; label?: string \| undefined; tickLabel?: string \| undefined; gridLine?: string \| undefined; line?: string \| undefined; tickMark?: string \| undefined; } \| undefined; style?: CSSProperties \| undefined; styles?: { root?: CSSProperties \| undefined; label?: CSSProperties \| undefined; tickLabel?: CSSProperties \| undefined; gridLine?: CSSProperties \| undefined; line?: CSSProperties \| undefined; tickMark?: CSSProperties \| undefined; } \| undefined; GridLineComponent?: LineComponent \| undefined; LineComponent?: LineComponent \| undefined; TickMarkLineComponent?: LineComponent \| undefined; tickLabelFormatter?: ((value: number) => ChartTextChildren) \| undefined; TickLabelComponent?: AxisTickLabelComponent \| undefined; } & { axisId?: string \| undefined; position?: top \| bottom \| undefined; height?: number \| undefined; }) \| undefined` | No | `-` | Configuration for x-axis. Accepts axis config and axis props. To show the axis, set showXAxis to true. |
| `yAxis` | `(Partial<CartesianAxisConfigProps> & SharedProps & { bandGridLinePlacement?: AxisBandPlacement; bandTickMarkPlacement?: AxisBandPlacement \| undefined; label?: string \| undefined; labelGap?: number \| undefined; minTickLabelGap?: number \| undefined; requestedTickCount?: number \| undefined; showGrid?: boolean \| undefined; showLine?: boolean \| undefined; showTickMarks?: boolean \| undefined; tickMarkSize?: number \| undefined; ticks?: number[] \| ((value: number) => boolean) \| undefined; tickMarkLabelGap?: number \| undefined; tickInterval?: number \| undefined; tickMinStep?: number \| undefined; tickMaxStep?: number \| undefined; } & { className?: string \| undefined; classNames?: { root?: string \| undefined; label?: string \| undefined; tickLabel?: string \| undefined; gridLine?: string \| undefined; line?: string \| undefined; tickMark?: string \| undefined; } \| undefined; style?: CSSProperties \| undefined; styles?: { root?: CSSProperties \| undefined; label?: CSSProperties \| undefined; tickLabel?: CSSProperties \| undefined; gridLine?: CSSProperties \| undefined; line?: CSSProperties \| undefined; tickMark?: CSSProperties \| undefined; } \| undefined; GridLineComponent?: LineComponent \| undefined; LineComponent?: LineComponent \| undefined; TickMarkLineComponent?: LineComponent \| undefined; tickLabelFormatter?: ((value: number) => ChartTextChildren) \| undefined; TickLabelComponent?: AxisTickLabelComponent \| undefined; } & { axisId?: string \| undefined; position?: left \| right \| undefined; width?: number \| undefined; }) \| undefined` | No | `-` | Configuration for y-axis. Accepts axis config and axis props. To show the axis, set showYAxis to true. |
| `zIndex` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto \| ResponsiveValue<ZIndex \| undefined>` | No | `-` | - |


