Visualizations

Bar Chart

Bar charts are commonly used to compare categorical data by representing each category with bars of varying lengths. They support stacking and formatting.

Loading...

Installation

Install the component via the CLI in one command.

npx shadcn@latest add @intentui/bar-chart

Composed components

When you install this component via the CLI, it automatically loads all composed components, so you don’t need to add them individually.

Manual installation

Use this approach if you prefer to install and wire up the component yourself instead of using the CLI.

npm install recharts react-aria-components

Examples

Stacked

Stacked bar charts let you compare parts of a whole across categories. Each bar stacks its values to show how they build up.

Loading...

Custom format

Custom format bar charts let you style the appearance, including bar radius, spacing, and color, for visual alignment with your product.

Loading...

Custom tooltip

Custom tooltips let you enrich the bar hover experience with icons, values, and additional context. Ideal for readable data at a glance.

Loading...

Custom legend

Custom legends help identify bar categories with icons, colors, or labels tailored to your dataset.

Loading...

Custom colors

Custom colors allow you to set specific colors for each bar, enhancing visual distinction and brand alignment.

Loading...

Controlled

Controlled bar charts let you dynamically manage state. You can filter datasets, toggle views, or update the display based on user interaction.

Loading...

Component API

The BarChart component renders categorical data with vertical or horizontal bars.

PropTypeDefault
barCategoryGapnumber5
barGapnumber-
barPropsPartial<React.ComponentProps<typeof Bar>>-
barRadiusnumber-
barSizenumber-
cartesianGridPropsCartesianGridProps-
chartPropsOmit<ComponentProps<typeof BarChartPrimitive>, "data" | "stackOffset">-
childrenReact.ReactNode-
classNamestring-
colorsreadonly (ChartColorKeys | string)[]DEFAULT_COLORS
configChartConfig-
containerHeightnumber370 desktop / 200 mobile
dataRecord<string, any>[][]
dataKeystring-
displayEdgeLabelsOnlybooleanfalse
hideGridLinesbooleanfalse
hideXAxisbooleanfalse
hideYAxisbooleanfalse
intervalTypeIntervalTypeequidistantPreserveStart
layoutChartLayouthorizontal
legendLegendContentType | booleantrue
legendPropsOmit<ComponentProps<typeof LegendPrimitive>, "content" | "ref">-
tooltipTooltipContentType<ValueType, NameType> | booleantrue
tooltipPropsBaseChartProps["tooltipProps"]-
typeChartTypedefault
valueFormatter(value: number) => string(value) => value.toString()
xAxisPropsXAxisPropsPrimitive-
yAxisPropsYAxisPrimitiveProps-

See the Recharts for the full API reference.

Unlock the full power of
Intent UI Design

Build modern web apps faster with 1000+ resources across components, blocks, patterns, templates, and starter kits.

Learn more