Bar charts are used to compare discrete values across categories.
Note
Bar charts are versatile and can support stacked bars for cumulative totals, 100% stacked bars to compare relative proportions, and differential bars showing positive and negative changes relative to an anchor value.
Name | Description | Type | Required | Default |
labels | Adds chart labels and defines their position | boolean | (value: string | number | Date) => string | {position: "above" | "center"; collision?: boolean; display: (value: string | number | Date) => string;} | No | - |
horizontal | Horizontal bar chart | boolean | No | false |
anchor | Used to set the baseline for a diverging bar chart (positive/negative bars) | number | No | 0 |
size | Width of the bars as a percent (0-100) | number | No | 50 |
radius | Radius of the bars as an angle (0-360) | number | No | 0 |
glow | Adds a glow effect around the bars | boolean | No | false |
children | Custom element rendered within the chart | ReactNode | No | - |
loading | Displays a loading skeleton | boolean | No | false |
Custom styling can be applied to the bars and corresponding labels, by targeting the class names below.
Class Name | Element |
bars__bar | The rect element representing each bar |
bars__label | Container for each data label |
bars__label-text | Span containing the label text |