Bar Chart

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

BarChart extends the internal Intent UI <BaseChart> component.

barCategoryGapnumber
Default: 5
barGapnumber
barPropsPartial<React.ComponentProps<typeof Bar>>
barRadiusnumber
barSizenumber
cartesianGridPropsCartesianGridProps
chartPropsOmit<ComponentProps<typeof BarChartPrimitive>, "data" | "stackOffset">
childrenReact.ReactNode
classNamestring
colorsreadonly (ChartColorKeys | string)[]
Default: DEFAULT_COLORS
configChartConfig
containerHeightnumber
Default: 370 desktop / 200 mobile
dataRecord<string, any>[]
Default: []
dataKeystring
displayEdgeLabelsOnlyboolean
Default: false
hideGridLinesboolean
Default: false
hideXAxisboolean
Default: false
hideYAxisboolean
Default: false
intervalTypeIntervalType
Default: equidistantPreserveStart
layoutChartLayout
Default: horizontal
legendLegendContentType | boolean
Default: true
legendPropsOmit<ComponentProps<typeof LegendPrimitive>, "content" | "ref">
tooltipTooltipContentType<ValueType, NameType> | boolean
Default: true
tooltipPropsBaseChartProps["tooltipProps"]
typeChartType
Default: default
valueFormatter(value: number) => string
Default: (value) => value.toString()
xAxisPropsXAxisPropsPrimitive
yAxisPropsYAxisPrimitiveProps

See the Recharts for the full API reference.

Design