Components/Charts/BarChart

BarChart

Charts

Vertical / horizontal bar chart with stacked mode.

Single or multi-series bar chart. orientation switches between vertical bars and horizontal bars. withBarValueLabel renders the value above each bar.

Usage

import { BarChart } from "nosible-ux"

const data = [
  { region: "Americas", signals: 480 },
  { region: "Europe", signals: 320 },
  { region: "APAC", signals: 210 },
]

export default function Example() {
  return (
    <BarChart
      data={data}
      dataKey="region"
      series={[{ name: "signals" }]}
      withTooltip
      withXAxis
      withYAxis
    />
  )
}

Examples

Horizontal with value labels

Props

Name TypeDefaultDescription
aria-label
string | undefinedAccessible label forwarded to the `role="img"` wrapper.
data
Record<string, unknown>[]Array of data objects keyed by `dataKey` + series names.
dataKey
stringKey used for the category axis.
h
number | undefinedContainer height in px. Default: `300`.
orientation
"horizontal" | "vertical" | undefinedBar orientation. - `"vertical"` — bars grow upward (default). - `"horizontal"` — bars grow rightward.
series
BarChartSeries[]Series definitions — one bar group per entry.
withBarValueLabel
boolean | undefinedShow value labels on each bar. Default: `false`.
withLegend
boolean | undefinedLegend below the chart. Default: `true`.
withTooltip
boolean | undefinedBranded tooltip on hover. Default: `true`.
withXAxis
boolean | undefinedRender the X-axis. Default: `true`.
withYAxis
boolean | undefinedRender the Y-axis. Default: `true`.